Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app/src/components/dialog-select-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ export function DialogSelectFile(props: { mode?: DialogSelectFileMode; onOpenFil
key={(item) => item.id}
filterKeys={["title", "description", "category"]}
groupBy={grouped() ? (item) => item.category : () => ""}
sortBy={(a, b) => a.title.localeCompare(b.title)}
onMove={handleMove}
onSelect={handleSelect}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ function DialogCommand(props: { options: CommandOption[]; suggestedOptions: Comm
if (ref?.filter) return props.options
return [...props.suggestedOptions, ...props.options]
}
return <DialogSelect ref={(r) => (ref = r)} title="Commands" options={list()} />
return <DialogSelect sort={true} ref={(r) => (ref = r)} title="Commands" options={list()} />
}
5 changes: 3 additions & 2 deletions packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InputRenderable, RGBA, ScrollBoxRenderable, TextAttributes } from "@opentui/core"
import { useTheme, selectedForeground } from "@tui/context/theme"
import { entries, filter, flatMap, groupBy, pipe, take } from "remeda"
import { entries, filter, flatMap, groupBy, mapValues, pipe, take } from "remeda"
import { batch, createEffect, createMemo, For, Show, type JSX, on } from "solid-js"
import { createStore } from "solid-js/store"
import { useKeyboard, useTerminalDimensions } from "@opentui/solid"
Expand All @@ -15,6 +15,7 @@ export interface DialogSelectProps<T> {
title: string
placeholder?: string
options: DialogSelectOption<T>[]
sort?: boolean
flat?: boolean
ref?: (ref: DialogSelectRef<T>) => void
onMove?: (option: DialogSelectOption<T>) => void
Expand Down Expand Up @@ -108,7 +109,7 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
const result = pipe(
filtered(),
groupBy((x) => x.category ?? ""),
// mapValues((x) => x.sort((a, b) => a.title.localeCompare(b.title))),
mapValues((x) => (props.sort ? x.sort((a, b) => a.title.localeCompare(b.title)) : x)),
entries(),
)
return result
Expand Down