Newer Older
70 lines | 2.303kb
Bogdan Timofte authored a month ago
1
//
2
//  SidebarOfflineMeterCardView.swift
3
//  USB Meter
4
//
5

            
6
import SwiftUI
7

            
8
struct SidebarOfflineMeterCardView: View {
9
    let summary: AppData.MeterSummary
10

            
11
    var body: some View {
12
        HStack(spacing: 14) {
13
            Image(systemName: "sensor.tag.radiowaves.forward.fill")
14
                .font(.system(size: 18, weight: .semibold))
15
                .foregroundColor(.secondary)
16
                .frame(width: 42, height: 42)
17
                .background(
18
                    Circle()
19
                        .fill(Color.secondary.opacity(0.14))
20
                )
21
                .overlay(alignment: .bottomTrailing) {
22
                    Circle()
23
                        .fill(Color.secondary)
24
                        .frame(width: 12, height: 12)
25
                        .overlay(
26
                            Circle()
27
                                .stroke(Color(uiColor: .systemBackground), lineWidth: 2)
28
                        )
29
                }
30

            
31
            VStack(alignment: .leading, spacing: 4) {
32
                Text(summary.displayName)
33
                    .font(.headline)
34
                Text(summary.modelSummary.isEmpty ? "Unknown Model" : summary.modelSummary)
35
                    .font(.caption)
36
                    .foregroundColor(.secondary)
37
            }
38

            
39
            Spacer()
40

            
41
            VStack(alignment: .trailing, spacing: 4) {
42
                HStack(spacing: 6) {
43
                    Circle()
44
                        .fill(Color.secondary)
45
                        .frame(width: 8, height: 8)
46
                    Text("Offline")
47
                        .font(.caption.weight(.semibold))
48
                        .foregroundColor(.secondary)
49
                }
50
                .padding(.horizontal, 10)
51
                .padding(.vertical, 6)
52
                .background(
53
                    Capsule(style: .continuous)
54
                        .fill(Color.secondary.opacity(0.12))
55
                )
56
                .overlay(
57
                    Capsule(style: .continuous)
58
                        .stroke(Color.secondary.opacity(0.22), lineWidth: 1)
59
                )
60
            }
61
        }
62
        .padding(14)
63
        .meterCard(
64
            tint: .secondary,
65
            fillOpacity: 0.10,
66
            strokeOpacity: 0.16,
67
            cornerRadius: 18
68
        )
69
    }
70
}