Improve peer list UI polish

- Make entire peer list row tappable for starting private chats
- Fix separator bar visibility when private chat is fully open (offset by -1px)
- Keep favorite star as separate tap target
- Preserve double-tap gesture for showing fingerprints
This commit is contained in:
jack
2025-07-24 11:47:20 +02:00
parent ad5ee7eb4c
commit 0beee2fb27
+22 -22
View File
@@ -50,7 +50,7 @@ struct ContentView: View {
insertion: .move(edge: .trailing), insertion: .move(edge: .trailing),
removal: .move(edge: .trailing) removal: .move(edge: .trailing)
)) ))
.offset(x: showPrivateChat ? 0 : geometry.size.width) .offset(x: showPrivateChat ? -1 : geometry.size.width)
.offset(x: backSwipeOffset) .offset(x: backSwipeOffset)
.gesture( .gesture(
DragGesture() DragGesture()
@@ -437,7 +437,7 @@ struct ContentView: View {
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
// Header - match main toolbar height // Header - match main toolbar height
HStack { HStack {
Text("YOUR NETWORK") Text("NETWORK")
.font(.system(size: 16, weight: .bold, design: .monospaced)) .font(.system(size: 16, weight: .bold, design: .monospaced))
.foregroundColor(textColor) .foregroundColor(textColor)
Spacer() Spacer()
@@ -467,7 +467,7 @@ struct ContentView: View {
} }
if viewModel.connectedPeers.isEmpty { if viewModel.connectedPeers.isEmpty {
Text("no one connected...") Text("nobody around...")
.font(.system(size: 14, design: .monospaced)) .font(.system(size: 14, design: .monospaced))
.foregroundColor(secondaryTextColor) .foregroundColor(secondaryTextColor)
.padding(.horizontal) .padding(.horizontal)
@@ -534,25 +534,9 @@ struct ContentView: View {
Spacer() Spacer()
} }
} else { } else {
Button(action: { Text(displayName)
if peerNicknames[peerID] != nil { .font(.system(size: 14, design: .monospaced))
viewModel.startPrivateChat(with: peerID) .foregroundColor(peerNicknames[peerID] != nil ? textColor : secondaryTextColor)
withAnimation(.spring(response: 0.3, dampingFraction: 0.8)) {
showSidebar = false
sidebarDragOffset = 0
}
}
}) {
Text(displayName)
.font(.system(size: 14, design: .monospaced))
.foregroundColor(peerNicknames[peerID] != nil ? textColor : secondaryTextColor)
}
.buttonStyle(.plain)
.disabled(peerNicknames[peerID] == nil)
.onTapGesture(count: 2) {
// Show fingerprint on double tap
viewModel.showFingerprint(for: peerID)
}
// Encryption status icon (after peer name) // Encryption status icon (after peer name)
let encryptionStatus = viewModel.getEncryptionStatus(for: peerID) let encryptionStatus = viewModel.getEncryptionStatus(for: peerID)
@@ -580,6 +564,22 @@ struct ContentView: View {
} }
.padding(.horizontal) .padding(.horizontal)
.padding(.vertical, 8) .padding(.vertical, 8)
.contentShape(Rectangle())
.onTapGesture {
if !isMe && peerNicknames[peerID] != nil {
viewModel.startPrivateChat(with: peerID)
withAnimation(.spring(response: 0.3, dampingFraction: 0.8)) {
showSidebar = false
sidebarDragOffset = 0
}
}
}
.onTapGesture(count: 2) {
if !isMe {
// Show fingerprint on double tap
viewModel.showFingerprint(for: peerID)
}
}
} }
} }
} }