30f9fa12d9
- Add /rename command to autocomplete when a session is active - Add rename dialog component for changing session names - Add rename option to session list dialog with 'r' keybind - Add session rename command to command registry
36 lines
862 B
TypeScript
36 lines
862 B
TypeScript
import { DialogPrompt } from "@tui/ui/dialog-prompt"
|
|
import { useDialog } from "@tui/ui/dialog"
|
|
import { useSync } from "@tui/context/sync"
|
|
import { createMemo } from "solid-js"
|
|
import { useSDK } from "../context/sdk"
|
|
|
|
interface DialogSessionRenameProps {
|
|
session: string
|
|
}
|
|
|
|
export function DialogSessionRename(props: DialogSessionRenameProps) {
|
|
const dialog = useDialog()
|
|
const sync = useSync()
|
|
const sdk = useSDK()
|
|
const session = createMemo(() => sync.session.get(props.session))
|
|
|
|
return (
|
|
<DialogPrompt
|
|
title="Rename Session"
|
|
value={session()?.title}
|
|
onConfirm={(value) => {
|
|
sdk.client.session.update({
|
|
path: {
|
|
id: props.session,
|
|
},
|
|
body: {
|
|
title: value,
|
|
},
|
|
})
|
|
dialog.clear()
|
|
}}
|
|
onCancel={() => dialog.clear()}
|
|
/>
|
|
)
|
|
}
|