feat(tui): expand v2 plugin context
This commit is contained in:
parent
3b0d8f0e6f
commit
010133f6df
14 changed files with 545 additions and 204 deletions
|
|
@ -11,7 +11,10 @@ export type DialogConfirmProps = {
|
|||
message: string
|
||||
onConfirm?: () => void
|
||||
onCancel?: () => void
|
||||
label?: string
|
||||
label?: {
|
||||
confirm?: string
|
||||
cancel?: string
|
||||
}
|
||||
}
|
||||
|
||||
export type DialogConfirmResult = boolean | undefined
|
||||
|
|
@ -81,7 +84,7 @@ export function DialogConfirm(props: DialogConfirmProps) {
|
|||
}}
|
||||
>
|
||||
<text fg={key === store.active ? themeV2.text.action.primary.focused : themeV2.text.subdued}>
|
||||
{Locale.titlecase(key === "cancel" ? (props.label ?? key) : key)}
|
||||
{Locale.titlecase(props.label?.[key] ?? key)}
|
||||
</text>
|
||||
</box>
|
||||
)}
|
||||
|
|
@ -91,7 +94,7 @@ export function DialogConfirm(props: DialogConfirmProps) {
|
|||
)
|
||||
}
|
||||
|
||||
DialogConfirm.show = (dialog: DialogContext, title: string, message: string, label?: string) => {
|
||||
DialogConfirm.show = (dialog: DialogContext, title: string, message: string, label?: DialogConfirmProps["label"]) => {
|
||||
return new Promise<DialogConfirmResult>((resolve) => {
|
||||
dialog.replace(
|
||||
() => (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue