diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index 7359277a..b91f1be2 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -1140,15 +1140,6 @@ struct ContentView: View { .buttonStyle(.plain) .accessibilityLabel("Open unread private chat") } - // Bookmark toggle for current geohash (not shown for mesh) - if case .location(let ch) = locationManager.selectedChannel { - Button(action: { GeohashBookmarksStore.shared.toggle(ch.geohash) }) { - Image(systemName: GeohashBookmarksStore.shared.isBookmarked(ch.geohash) ? "bookmark.fill" : "bookmark") - .font(.system(size: 12)) - } - .buttonStyle(.plain) - .accessibilityLabel("Toggle bookmark for #\(ch.geohash)") - } // Location channels button '#' Button(action: { showLocationChannelsSheet = true }) { let badgeText: String = { @@ -1177,6 +1168,17 @@ struct ContentView: View { .padding(.leading, 8) .padding(.trailing, 8) + // Bookmark toggle (geochats): position after the #geohash badge with same spacing + if case .location(let ch) = locationManager.selectedChannel { + Button(action: { GeohashBookmarksStore.shared.toggle(ch.geohash) }) { + Image(systemName: GeohashBookmarksStore.shared.isBookmarked(ch.geohash) ? "bookmark.fill" : "bookmark") + .font(.system(size: 12)) + } + .buttonStyle(.plain) + .padding(.leading, 8) + .accessibilityLabel("Toggle bookmark for #\(ch.geohash)") + } + // Notes icon (mesh only and when location is authorized), to the right of #mesh if case .mesh = locationManager.selectedChannel, locationManager.permissionState == .authorized { Button(action: { diff --git a/bitchat/Views/LocationNotesView.swift b/bitchat/Views/LocationNotesView.swift index 71f1afc1..45175b66 100644 --- a/bitchat/Views/LocationNotesView.swift +++ b/bitchat/Views/LocationNotesView.swift @@ -55,11 +55,11 @@ struct LocationNotesView: View { let c = manager.notes.count Text("\(c) \(c == 1 ? "note" : "notes") ") .font(.system(size: 16, weight: .bold, design: .monospaced)) - Text("@") + Text("@ ") .font(.system(size: 16, weight: .bold, design: .monospaced)) Text("#\(geohash)") .font(.system(size: 16, weight: .bold, design: .monospaced)) - .foregroundColor(secondaryTextColor) + .foregroundColor(textColor) } if let buildingName = locationManager.locationNames[.building], !buildingName.isEmpty { Text(buildingName) @@ -93,9 +93,21 @@ struct LocationNotesView: View { ForEach(manager.notes) { note in VStack(alignment: .leading, spacing: 2) { HStack(spacing: 6) { - Text("@\(note.displayName)") - .font(.system(size: 12, weight: .semibold, design: .monospaced)) - .foregroundColor(secondaryTextColor) + // Render @name with darker green for the #abcd suffix to match chat style + HStack(spacing: 0) { + Text("@") + .font(.system(size: 12, weight: .semibold, design: .monospaced)) + .foregroundColor(secondaryTextColor) + let parts = splitSuffix(from: note.displayName) + Text(parts.0) + .font(.system(size: 12, weight: .semibold, design: .monospaced)) + .foregroundColor(secondaryTextColor) + if !parts.1.isEmpty { + Text(parts.1) + .font(.system(size: 12, weight: .semibold, design: .monospaced)) + .foregroundColor(textColor) + } + } Text(timestampText(for: note.createdAt)) .font(.system(size: 11, design: .monospaced)) .foregroundColor(secondaryTextColor.opacity(0.8)) @@ -177,3 +189,16 @@ struct LocationNotesView: View { return f }() } + +// Helper to split a trailing #abcd suffix +private func splitSuffix(from name: String) -> (String, String) { + guard name.count >= 5 else { return (name, "") } + let suffix = String(name.suffix(5)) + if suffix.first == "#", suffix.dropFirst().allSatisfy({ c in + ("0"..."9").contains(String(c)) || ("a"..."f").contains(String(c)) || ("A"..."F").contains(String(c)) + }) { + let base = String(name.dropLast(5)) + return (base, suffix) + } + return (name, "") +}