Showing 1 changed files with 34 additions and 6 deletions
+34 -6
USB Meter/Views/MeterRowView.swift
@@ -16,12 +16,21 @@ struct MeterRowView: View {
16 16
         HStack(spacing: 14) {
17 17
             Image(systemName: "sensor.tag.radiowaves.forward.fill")
18 18
                 .font(.system(size: 18, weight: .semibold))
19
-                .foregroundColor(Meter.operationalColor(for: meter.operationalState))
19
+                .foregroundColor(meter.color)
20 20
                 .frame(width: 42, height: 42)
21 21
                 .background(
22 22
                     Circle()
23
-                        .fill(Meter.operationalColor(for: meter.operationalState).opacity(0.18))
23
+                        .fill(meter.color.opacity(0.18))
24 24
                 )
25
+                .overlay(alignment: .bottomTrailing) {
26
+                    Circle()
27
+                        .fill(connectivityTint)
28
+                        .frame(width: 12, height: 12)
29
+                        .overlay(
30
+                            Circle()
31
+                                .stroke(Color(uiColor: .systemBackground), lineWidth: 2)
32
+                        )
33
+                }
25 34
 
26 35
             VStack(alignment: .leading, spacing: 4) {
27 36
                 Text(meter.name)
@@ -34,9 +43,24 @@ struct MeterRowView: View {
34 43
             Spacer()
35 44
 
36 45
             VStack(alignment: .trailing, spacing: 4) {
37
-                Text(statusText)
38
-                    .font(.caption.weight(.semibold))
39
-                    .foregroundColor(Meter.operationalColor(for: meter.operationalState))
46
+                HStack(spacing: 6) {
47
+                    Circle()
48
+                        .fill(connectivityTint)
49
+                        .frame(width: 8, height: 8)
50
+                    Text(statusText)
51
+                        .font(.caption.weight(.semibold))
52
+                        .foregroundColor(.secondary)
53
+                }
54
+                .padding(.horizontal, 10)
55
+                .padding(.vertical, 6)
56
+                .background(
57
+                    Capsule(style: .continuous)
58
+                        .fill(connectivityTint.opacity(0.12))
59
+                )
60
+                .overlay(
61
+                    Capsule(style: .continuous)
62
+                        .stroke(connectivityTint.opacity(0.22), lineWidth: 1)
63
+                )
40 64
                 Text(meter.btSerial.macAddress.description)
41 65
                     .font(.caption2)
42 66
                     .foregroundColor(.secondary)
@@ -44,13 +68,17 @@ struct MeterRowView: View {
44 68
         }
45 69
         .padding(14)
46 70
         .meterCard(
47
-            tint: Meter.operationalColor(for: meter.operationalState),
71
+            tint: meter.color,
48 72
             fillOpacity: 0.16,
49 73
             strokeOpacity: 0.22,
50 74
             cornerRadius: 18
51 75
         )
52 76
     }
53 77
 
78
+    private var connectivityTint: Color {
79
+        Meter.operationalColor(for: meter.operationalState)
80
+    }
81
+
54 82
     private var statusText: String {
55 83
         switch meter.operationalState {
56 84
         case .notPresent: