Ariver
2026-05-06 f7ed0fe62e2792ede1000fd13370f9528bb68a03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import SwiftUI
 
// MARK: - Tag Group Section (with centered separator-line header)
 
struct TagGroupView: View {
    let group: TagGroup
    let onSelectApp: (AppInfo) -> Void
    let tagFontSize: CGFloat
    let iconSize: CGFloat
    var showNames: Bool = true
 
    /// Adaptive columns — auto-fit based on icon size and available width.
    private var columns: [GridItem] {
        [GridItem(.adaptive(minimum: iconSize + 28, maximum: iconSize + 64), spacing: 6)]
    }
 
    // Subtle separator line color — adapts to light/dark mode
    private var lineColor: Color {
        .secondary.opacity(0.25)
    }
 
    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            // Centered separator line with tag name
            HStack(spacing: 0) {
                Rectangle()
                    .fill(lineColor)
                    .frame(height: 1)
 
                Text(group.name)
                    .font(.system(size: tagFontSize, weight: .semibold))
                    .foregroundStyle(.secondary)
                    .padding(.horizontal, 10)
 
                Rectangle()
                    .fill(lineColor)
                    .frame(height: 1)
            }
            .padding(.bottom, 6)
 
            // App icon grid — columns auto-adjust to icon size
            LazyVGrid(columns: columns, spacing: 2) {
                ForEach(group.apps) { app in
                    AppGridItem(
                        app: app,
                        iconSize: iconSize,
                        showName: showNames,
                        onSelect: { onSelectApp(app) }
                    )
                }
            }
        }
    }
}