import SwiftUI import BitFoundation struct MeshPeerList: View { @EnvironmentObject private var peerListModel: PeerListModel @ThemedPalette private var palette let onTapPeer: (PeerID) -> Void let onToggleFavorite: (PeerID) -> Void let onShowFingerprint: (PeerID) -> Void @Environment(\.colorScheme) var colorScheme @State private var orderedIDs: [String] = [] private enum Strings { static let noneNearby: LocalizedStringKey = "geohash_people.none_nearby" static let blockedTooltip = String(localized: "geohash_people.tooltip.blocked", comment: "Tooltip shown next to a blocked peer indicator") static let newMessagesTooltip = String(localized: "mesh_peers.tooltip.new_messages", comment: "Tooltip for the unread messages indicator") } var body: some View { let currentIDs = peerListModel.meshRows.map(\.id) let displayIDs = orderedIDs.filter { currentIDs.contains($0) } + currentIDs.filter { !orderedIDs.contains($0) } let peers: [MeshPeerRow] = displayIDs.compactMap { id in peerListModel.meshRows.first(where: { $0.id == id }) } if peerListModel.meshRows.isEmpty { VStack(alignment: .leading, spacing: 0) { Text(Strings.noneNearby) .bitchatFont(size: 14) .foregroundColor(palette.secondary) .padding(.horizontal) .padding(.top, 12) } } else { VStack(alignment: .leading, spacing: 0) { ForEach(0..