fix: extended dialog to allow for dynamic title/description
This commit is contained in:
@@ -10,12 +10,22 @@ import {
|
|||||||
} from "@components/UI/Dialog.tsx";
|
} from "@components/UI/Dialog.tsx";
|
||||||
|
|
||||||
export interface PkiRegenerateDialogProps {
|
export interface PkiRegenerateDialogProps {
|
||||||
|
text: {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
button: string;
|
||||||
|
}
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: () => void;
|
onOpenChange: () => void;
|
||||||
onSubmit: () => void;
|
onSubmit: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PkiRegenerateDialog = ({
|
export const PkiRegenerateDialog = ({
|
||||||
|
text = {
|
||||||
|
title: "Regenerate Key Pair",
|
||||||
|
description: "Are you sure you want to regenerate key pair?",
|
||||||
|
button: "Regenerate",
|
||||||
|
},
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
@@ -25,14 +35,14 @@ export const PkiRegenerateDialog = ({
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogClose />
|
<DialogClose />
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Regenerate Key pair?</DialogTitle>
|
<DialogTitle>{text?.title}</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Are you sure you want to regenerate key pair?
|
{text?.description}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="destructive" onClick={() => onSubmit()}>
|
<Button variant="destructive" onClick={() => onSubmit()}>
|
||||||
Regenerate
|
{text?.button}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ChannelValidation } from "@app/validation/channel.tsx";
|
import type { ChannelValidation } from "@app/validation/channel.ts";
|
||||||
import { create } from "@bufbuild/protobuf";
|
import { create } from "@bufbuild/protobuf";
|
||||||
import { DynamicForm } from "@components/Form/DynamicForm.tsx";
|
import { DynamicForm } from "@components/Form/DynamicForm.tsx";
|
||||||
import { useToast } from "@core/hooks/useToast.ts";
|
import { useToast } from "@core/hooks/useToast.ts";
|
||||||
@@ -97,7 +97,8 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
|
|||||||
settings: {
|
settings: {
|
||||||
...channel?.settings,
|
...channel?.settings,
|
||||||
psk: pass,
|
psk: pass,
|
||||||
moduleSettings: {...channel?.settings?.moduleSettings,
|
moduleSettings: {
|
||||||
|
...channel?.settings?.moduleSettings,
|
||||||
positionPrecision: channel?.settings?.moduleSettings?.positionPrecision === undefined ? 10 : channel?.settings?.moduleSettings?.positionPrecision,
|
positionPrecision: channel?.settings?.moduleSettings?.positionPrecision === undefined ? 10 : channel?.settings?.moduleSettings?.positionPrecision,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -206,6 +207,11 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<PkiRegenerateDialog
|
<PkiRegenerateDialog
|
||||||
|
text={{
|
||||||
|
button: "Regenerate",
|
||||||
|
title: "Regenerate Pre-Shared Key?",
|
||||||
|
description: "Are you sure you want to regenerate the pre-shared key?",
|
||||||
|
}}
|
||||||
open={preSharedDialogOpen}
|
open={preSharedDialogOpen}
|
||||||
onOpenChange={() => setPreSharedDialogOpen(false)}
|
onOpenChange={() => setPreSharedDialogOpen(false)}
|
||||||
onSubmit={() => preSharedKeyRegenerate()}
|
onSubmit={() => preSharedKeyRegenerate()}
|
||||||
|
|||||||
@@ -302,6 +302,11 @@ export const Security = () => {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<PkiRegenerateDialog
|
<PkiRegenerateDialog
|
||||||
|
text={{
|
||||||
|
button: "Regenerate",
|
||||||
|
title: "Regenerate Key pair?",
|
||||||
|
description: "Are you sure you want to regenerate key pair?",
|
||||||
|
}}
|
||||||
open={state.privateKeyDialogOpen}
|
open={state.privateKeyDialogOpen}
|
||||||
onOpenChange={() =>
|
onOpenChange={() =>
|
||||||
dispatch({ type: "SHOW_PRIVATE_KEY_DIALOG", payload: false })}
|
dispatch({ type: "SHOW_PRIVATE_KEY_DIALOG", payload: false })}
|
||||||
|
|||||||
Reference in New Issue
Block a user