confirmation prompts on alias requests
This commit is contained in:
parent
21405f9d1d
commit
9c1f7d5739
|
@ -1,6 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { approveAlias, deleteAlias, fetchAllAliases } from "@/lib/actions";
|
||||
import GenericConfirmationDialog from "@/lib/components/ui/GenericConfirmationDialog";
|
||||
import GhostMessage from "@/lib/components/ui/GhostMessage";
|
||||
import LoadingSpinner from "@/lib/components/ui/LoadingSpinner";
|
||||
import { AliasEntry } from "@/lib/db";
|
||||
|
@ -44,22 +45,28 @@ export default function Aliases() {
|
|||
<Table.Cell justify='start'>{alias.alias}</Table.Cell>
|
||||
<Table.Cell justify='end'>
|
||||
<Flex gap='3' justify="end">
|
||||
<Button
|
||||
size="1"
|
||||
variant="outline"
|
||||
onClick={() => approveAlias(alias.alias)
|
||||
.then(() => { setAliases(aliases?.map((a) => a.id == alias.id ? { ...a, pending: false } : a)); })}
|
||||
<GenericConfirmationDialog
|
||||
title="Approve alias request"
|
||||
description={<>Are you sure you want to approve <Code>{alias.address}</Code>'s request for <Code>{alias.alias}</Code>?</>}
|
||||
labelConfirm="Approve"
|
||||
action={() => approveAlias(alias.alias)
|
||||
.then(() => setAliases(aliases?.map((a) => a.id == alias.id ? { ...a, pending: false } : a)))}
|
||||
>
|
||||
Approve
|
||||
</Button>
|
||||
<Button
|
||||
size="1"
|
||||
variant="soft"
|
||||
onClick={() => deleteAlias(alias.alias)
|
||||
<Button size="1" variant="surface">
|
||||
Approve
|
||||
</Button>
|
||||
</GenericConfirmationDialog>
|
||||
<GenericConfirmationDialog
|
||||
title="Deny alias request"
|
||||
description={<>Are you sure you want to deny <Code>{alias.address}</Code>'s request for <Code>{alias.alias}</Code>?</>}
|
||||
labelConfirm="Delete"
|
||||
action={() => deleteAlias(alias.alias)
|
||||
.then(() => setAliases(aliases?.filter(a => a.id != alias.id)))}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
<Button size="1" variant="soft">
|
||||
Delete
|
||||
</Button>
|
||||
</GenericConfirmationDialog>
|
||||
</Flex>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
|
@ -110,6 +117,7 @@ export default function Aliases() {
|
|||
<Button variant="outline">Cancel</Button>
|
||||
</Dialog.Close>
|
||||
<Dialog.Close>
|
||||
|
||||
<Button
|
||||
variant="soft"
|
||||
onClick={() => deleteAlias(alias.alias)
|
||||
|
|
|
@ -23,7 +23,7 @@ export default function GenericConfirmationDialog({
|
|||
<Button variant="outline">Cancel</Button>
|
||||
</Dialog.Close>
|
||||
<Dialog.Close>
|
||||
<Button variant="solid" onClick={action}>{labelConfirm ?? "Confirm"}</Button>
|
||||
<Button variant="soft" onClick={action}>{labelConfirm ?? "Confirm"}</Button>
|
||||
</Dialog.Close>
|
||||
</Flex>
|
||||
</Dialog.Content>
|
||||
|
|
Loading…
Reference in a new issue