mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 11:25:19 +00:00
Refactor room commands and improve UX
- Replace /list with /rooms showing all discovered rooms with join status - Remove /discover command (merged into /rooms) - Rename /favorite to /save for clarity - Make room-specific commands (/transfer, /pass, /save) only appear in room context - Remove voice notes from app info (feature doesn't exist) - Remove Commands line from app info screen - Show checkmark (✓) for joined rooms in /rooms output
This commit is contained in:
@@ -506,18 +506,24 @@ struct ContentView: View {
|
||||
// Command suggestions
|
||||
if showCommandSuggestions && !commandSuggestions.isEmpty {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
let commandDescriptions = [
|
||||
let baseCommands: [String: String] = [
|
||||
"/j": "join or create a room",
|
||||
"/list": "show your joined rooms",
|
||||
"/rooms": "show all discovered rooms",
|
||||
"/w": "see who's online",
|
||||
"/m": "send private message",
|
||||
"/clear": "clear chat messages",
|
||||
"/clear": "clear chat messages"
|
||||
]
|
||||
|
||||
let roomCommands: [String: String] = [
|
||||
"/transfer": "transfer room ownership",
|
||||
"/pass": "change room password",
|
||||
"/favorite": "toggle room retention",
|
||||
"/discover": "find active rooms"
|
||||
"/save": "save room messages locally"
|
||||
]
|
||||
|
||||
let commandDescriptions = viewModel.currentRoom != nil
|
||||
? baseCommands.merging(roomCommands) { (_, new) in new }
|
||||
: baseCommands
|
||||
|
||||
ForEach(commandSuggestions, id: \.self) { command in
|
||||
Button(action: {
|
||||
// Replace current text with selected command
|
||||
@@ -590,17 +596,22 @@ struct ContentView: View {
|
||||
|
||||
// Check for command autocomplete
|
||||
if newValue.hasPrefix("/") && newValue.count >= 1 {
|
||||
let commandDescriptions = [
|
||||
// Build context-aware command list
|
||||
var commandDescriptions = [
|
||||
("/j", "join or create a room"),
|
||||
("/list", "show your joined rooms"),
|
||||
("/rooms", "show all discovered rooms"),
|
||||
("/w", "see who's online"),
|
||||
("/m", "send private message"),
|
||||
("/clear", "clear chat messages"),
|
||||
("/transfer", "transfer room ownership"),
|
||||
("/pass", "change room password"),
|
||||
("/favorite", "toggle room retention"),
|
||||
("/discover", "find active rooms")
|
||||
("/clear", "clear chat messages")
|
||||
]
|
||||
|
||||
// Add room-specific commands if in a room
|
||||
if viewModel.currentRoom != nil {
|
||||
commandDescriptions.append(("/transfer", "transfer room ownership"))
|
||||
commandDescriptions.append(("/pass", "change room password"))
|
||||
commandDescriptions.append(("/save", "save room messages locally"))
|
||||
}
|
||||
|
||||
let input = newValue.lowercased()
|
||||
commandSuggestions = commandDescriptions
|
||||
.filter { $0.0.starts(with: input) }
|
||||
|
||||
Reference in New Issue
Block a user