Offlin33er commited on
Commit
4eaa520
·
verified ·
1 Parent(s): 3cb8c4d

Palette: Ask AI + AI settings commands, and an Ask-AI row for free-form input

Browse files
app/src/main/java/dev/nova/browser/CommandPalette.kt CHANGED
@@ -15,10 +15,10 @@ import androidx.compose.ui.text.style.TextOverflow
15
  import androidx.compose.ui.unit.dp
16
 
17
  /**
18
- * Nova's primary UI after the pivot: a command palette. The user types a
19
- * command, a URL, or a search — the palette routes it. There is no URL bar
20
- * and no toolbar; content is edge-to-edge and the palette is summoned via
21
- * the floating ⌘ button.
22
  */
23
  @Composable
24
  fun CommandPalette(
@@ -38,6 +38,8 @@ fun CommandPalette(
38
  "Add-ons manager" to "addons",
39
  "Dev console" to "console",
40
  "Clear console" to "clear_console",
 
 
41
  )
42
 
43
  val filteredCommands =
@@ -63,7 +65,7 @@ fun CommandPalette(
63
  OutlinedTextField(
64
  value = query,
65
  onValueChange = { query = it },
66
- label = { Text("Command, URL, or search…") },
67
  singleLine = true,
68
  modifier = Modifier.fillMaxWidth(),
69
  )
@@ -93,6 +95,16 @@ fun CommandPalette(
93
  }
94
  .padding(vertical = 10.dp, horizontal = 4.dp),
95
  )
 
 
 
 
 
 
 
 
 
 
96
  HorizontalDivider(Modifier.padding(vertical = 4.dp))
97
  }
98
 
@@ -113,11 +125,13 @@ fun CommandPalette(
113
  }
114
 
115
  Text(
116
- "Active tab: ${activeTabId ?: "none"} · unrestricted mode: tracking protection off, permissions auto-granted, about:config on",
117
  style = MaterialTheme.typography.labelSmall,
118
  color = MaterialTheme.colorScheme.onSurfaceVariant,
119
  modifier = Modifier.padding(top = 8.dp),
120
  )
121
  }
122
  }
123
- }
 
 
 
15
  import androidx.compose.ui.unit.dp
16
 
17
  /**
18
+ * Nova's primary UI: a command palette. The user types a command, a URL, a
19
+ * search, or an AI question — the palette routes it. There is no URL bar and
20
+ * no toolbar; content is edge-to-edge and the palette is summoned via the
21
+ * floating ⌘ button.
22
  */
23
  @Composable
24
  fun CommandPalette(
 
38
  "Add-ons manager" to "addons",
39
  "Dev console" to "console",
40
  "Clear console" to "clear_console",
41
+ "Ask AI" to "ai_chat",
42
+ "AI settings" to "ai_settings",
43
  )
44
 
45
  val filteredCommands =
 
65
  OutlinedTextField(
66
  value = query,
67
  onValueChange = { query = it },
68
+ label = { Text("Command, URL, search, or AI question…") },
69
  singleLine = true,
70
  modifier = Modifier.fillMaxWidth(),
71
  )
 
95
  }
96
  .padding(vertical = 10.dp, horizontal = 4.dp),
97
  )
98
+ Text(
99
+ "🤖 Ask AI: $q",
100
+ style = MaterialTheme.typography.bodyLarge,
101
+ maxLines = 1,
102
+ overflow = TextOverflow.Ellipsis,
103
+ modifier = Modifier
104
+ .fillMaxWidth()
105
+ .clickable { onCommand("ask_ai:$q") }
106
+ .padding(vertical = 10.dp, horizontal = 4.dp),
107
+ )
108
  HorizontalDivider(Modifier.padding(vertical = 4.dp))
109
  }
110
 
 
125
  }
126
 
127
  Text(
128
+ "Active tab: ${activeTabIdLabel(tabCount)} · unrestricted mode: tracking protection off, permissions auto-granted, about:config on",
129
  style = MaterialTheme.typography.labelSmall,
130
  color = MaterialTheme.colorScheme.onSurfaceVariant,
131
  modifier = Modifier.padding(top = 8.dp),
132
  )
133
  }
134
  }
135
+ }
136
+
137
+ private fun activeTabIdLabel(activeTabId: Int?): String = activeTabId?.toString() ?: "none"