tui: show enable/disable state in permission toggle and make it searchable by 'toggle permissions'
parent
405cc3f610
commit
f202536b65
|
|
@ -159,8 +159,9 @@ export function Prompt(props: PromptProps) {
|
||||||
command.register(() => {
|
command.register(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: "Toggle permissions",
|
title: autoaccept() ? "Disable permissions" : "Enable permissions",
|
||||||
value: "permission.auto_accept.toggle",
|
value: "permission.auto_accept.toggle",
|
||||||
|
search: "toggle permissions",
|
||||||
keybind: "permission_auto_accept_toggle",
|
keybind: "permission_auto_accept_toggle",
|
||||||
category: "Agent",
|
category: "Agent",
|
||||||
onSelect: (dialog) => {
|
onSelect: (dialog) => {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export interface DialogSelectOption<T = any> {
|
||||||
title: string
|
title: string
|
||||||
value: T
|
value: T
|
||||||
description?: string
|
description?: string
|
||||||
|
search?: string
|
||||||
footer?: JSX.Element | string
|
footer?: JSX.Element | string
|
||||||
category?: string
|
category?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
|
@ -85,8 +86,8 @@ export function DialogSelect<T>(props: DialogSelectProps<T>) {
|
||||||
// users typically search by the item name, and not its category.
|
// users typically search by the item name, and not its category.
|
||||||
const result = fuzzysort
|
const result = fuzzysort
|
||||||
.go(needle, options, {
|
.go(needle, options, {
|
||||||
keys: ["title", "category"],
|
keys: ["title", "category", "search"],
|
||||||
scoreFn: (r) => r[0].score * 2 + r[1].score,
|
scoreFn: (r) => r[0].score * 2 + r[1].score + r[2].score,
|
||||||
})
|
})
|
||||||
.map((x) => x.obj)
|
.map((x) => x.obj)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue