aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2024-07-30 15:58:23 -0700
committerDustin Mierau <dustin@mierau.me>2024-07-30 15:58:23 -0700
commit93841e378308f959566e1411a7cba6a2602db2e8 (patch)
tree3c7b1df41662cfbfdb2c0c99fe86721ba6a6301e /Hotline/macOS
parent9ec47750f898aab12acca4a367d839b340cb7683 (diff)
Display connected user count on tracker listings.
Diffstat (limited to 'Hotline/macOS')
-rw-r--r--Hotline/macOS/TrackerView.swift24
1 files changed, 22 insertions, 2 deletions
diff --git a/Hotline/macOS/TrackerView.swift b/Hotline/macOS/TrackerView.swift
index ad0b08c..a52bccd 100644
--- a/Hotline/macOS/TrackerView.swift
+++ b/Hotline/macOS/TrackerView.swift
@@ -362,6 +362,8 @@ struct TrackerBookmarkSheet: View {
struct TrackerItemView: View {
let bookmark: Bookmark
+ @State private var onlineAnimationMaxState: Bool = true
+
var body: some View {
HStack(alignment: .center, spacing: 6) {
if bookmark.type == .tracker {
@@ -392,6 +394,7 @@ struct TrackerItemView: View {
.padding([.leading, .trailing], 2)
.controlSize(.small)
}
+ Spacer(minLength: 0)
case .server:
Image(systemName: "bookmark.fill")
.resizable()
@@ -406,6 +409,7 @@ struct TrackerItemView: View {
.scaledToFit()
.frame(width: 16, height: 16, alignment: .center)
Text(bookmark.name).lineLimit(1).truncationMode(.tail)
+ Spacer(minLength: 0)
case .temporary:
Spacer()
.frame(width: 14 + 8 + 16)
@@ -420,9 +424,25 @@ struct TrackerItemView: View {
.lineLimit(1)
.truncationMode(.tail)
}
+ Spacer(minLength: 0)
+ if let serverUserCount = bookmark.serverUserCount,
+ serverUserCount > 0 {
+ Text(String(serverUserCount))
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
+
+ Circle()
+ .fill(.fileComplete)
+ .frame(width: 7, height: 7)
+ .opacity(onlineAnimationMaxState ? 1.0 : 0.2)
+ .onAppear {
+ withAnimation(.easeInOut(duration: 1.0).repeatForever()) {
+ onlineAnimationMaxState.toggle()
+ }
+ }
+ .padding(.trailing, 6)
+ }
}
-
- Spacer()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onChange(of: bookmark.expanded) {