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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function DialogMessage(props: {

return (
<DialogSelect
sort={true}
title="Message Actions"
options={[
{
Expand Down
8 changes: 6 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 @@ -21,6 +21,7 @@ export interface DialogSelectProps<T> {
onFilter?: (query: string) => void
onSelect?: (option: DialogSelectOption<T>) => void
skipFilter?: boolean
sort?: boolean
keybind?: {
keybind?: Keybind.Info
title: string
Expand Down Expand Up @@ -108,7 +109,10 @@ 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))),
(groups) => {
if (!props.sort || store.filter) return groups
return mapValues(groups, (x) => x.sort((a, b) => a.title.localeCompare(b.title)))
},
entries(),
)
return result
Expand Down