1package soy.iko.opencode.ui
3/** String routes for the app's NavHost. Kept simple and centralized. */
5 const val SERVERS = "servers"
6 const val SESSIONS = "sessions"
7 const val SETTINGS = "settings"
8 const val DIAGNOSTICS = "diagnostics"
9 const val USAGE = "usage"
11 const val FILES = "files"
12 const val SEARCH = "search"
14 const val SERVER_EDIT = "server_edit"
15 fun serverEdit(id: String? = null) =
16 if (id.isNullOrEmpty()) SERVER_EDIT else "$SERVER_EDIT?id=${android.net.Uri.encode(id)}"
18 /** Open the editor seeded with [sourceId]'s fields but creating a new profile. */
19 fun serverEditDuplicate(sourceId: String) = "$SERVER_EDIT?dup=${android.net.Uri.encode(sourceId)}"
21 const val CHAT = "chat"
22 fun chat(sessionId: String, focusMessageId: String? = null): String {
23 val base = "$CHAT/${android.net.Uri.encode(sessionId)}"
24 // An optional focusMessageId scrolls the chat to (and briefly highlights) that message,
25 // used by global search to jump directly to the matched message instead of the tail.
26 return if (focusMessageId != null && focusMessageId.isNotBlank()) {
27 "$base?focus=${android.net.Uri.encode(focusMessageId)}"
33 const val FILE_VIEW = "file_view"
34 fun fileView(path: String, line: Int? = null): String {
35 val base = "$FILE_VIEW?path=${android.net.Uri.encode(path)}"
36 // A positive [line] scrolls the viewer to that 1-based line (from a search hit).
37 return if (line != null && line > 0) "$base&line=$line" else base
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list