Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: polish shared secret page and update delete modal to v3

Scott Wilson701c6699d142
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
index b914141031..c3f64e34b5 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx
@@ -1,8 +1,16 @@
-import { ForwardIcon } from "lucide-react";
+import { ForwardIcon, Trash2 } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
Card,
CardAction,
@@ -64,16 +72,28 @@ export const ShareSecretTab = () => {
<ShareSecretsTable handlePopUpOpen={handlePopUpOpen} />
</CardContent>
<AddShareSecretModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
- isOpen={popUp.deleteSharedSecretConfirmation.isOpen}
- title={`Delete ${
- (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.name || " "
- } shared secret?`}
- onChange={(isOpen) => handlePopUpToggle("deleteSharedSecretConfirmation", isOpen)}
- deleteKey={(popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.name}
- onClose={() => handlePopUpClose("deleteSharedSecretConfirmation")}
- onDeleteApproved={onDeleteApproved}
- />
+ <AlertDialog
+ open={popUp.deleteSharedSecretConfirmation.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteSharedSecretConfirmation", isOpen)}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Delete shared secret?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This action cannot be undone. The shared secret link will no longer be accessible.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={onDeleteApproved}>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</Card>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
index 553d768a08..fc3a627f8a 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx
@@ -1,5 +1,5 @@
import { format } from "date-fns";
-import { Ellipsis, Mail, MailOpen, Trash2 } from "lucide-react";
+import { ClockAlertIcon, ClockIcon, Ellipsis, Mail, MailOpen, Trash2 } from "lucide-react";
import {
Badge,
@@ -74,7 +74,10 @@ export const ShareSecretsRow = ({
)}
</TableCell>
<TableCell>
- <Badge variant={isExpired ? "danger" : "success"}>{isExpired ? "Expired" : "Active"}</Badge>
+ <Badge variant={isExpired ? "danger" : "success"}>
+ {isExpired ? <ClockAlertIcon /> : <ClockIcon />}
+ {isExpired ? "Expired" : "Active"}
+ </Badge>
</TableCell>
<TableCell>
<DropdownMenu>
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
index c8c0c4ba67..a756eb2a1e 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx
@@ -1,10 +1,9 @@
import { useState } from "react";
-import { KeyRound } from "lucide-react";
import {
Empty,
+ EmptyDescription,
EmptyHeader,
- EmptyMedia,
EmptyTitle,
Pagination,
Skeleton,
@@ -39,59 +38,57 @@ export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {
offset: (page - 1) * perPage,
limit: perPage
});
+ const hasSecrets = !isPending && data?.secrets && data.secrets.length > 0;
+
return (
<div>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-5" />
- <TableHead className="w-1/4">Name</TableHead>
- <TableHead>Created</TableHead>
- <TableHead>Expires</TableHead>
- <TableHead>Views Left</TableHead>
- <TableHead>Status</TableHead>
- <TableHead aria-label="button" className="w-5" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {/* eslint-disable-next-line react/no-array-index-key */}
- {isPending &&
- Array.from({ length: 5 }).map((_, i) => (
- // eslint-disable-next-line react/no-array-index-key
- <TableRow key={`skeleton-${i}`}>
- {Array.from({ length: 7 }).map((__, j) => (
- // eslint-disable-next-line react/no-array-index-key
- <td key={`skeleton-cell-${j}`} className="px-3 py-3">
- <Skeleton className="h-4 w-full" />
- </td>
- ))}
- </TableRow>
- ))}
- {!isPending &&
- data?.secrets?.map((row) => (
- <ShareSecretsRow key={row.id} row={row} handlePopUpOpen={handlePopUpOpen} />
- ))}
- </TableBody>
- </Table>
- {!isPending &&
- data?.secrets &&
- data?.totalCount >= perPage &&
- data?.totalCount !== undefined && (
- <Pagination
- count={data.totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
+ {(isPending || hasSecrets) && (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="w-5" />
+ <TableHead className="w-1/4">Name</TableHead>
+ <TableHead>Created</TableHead>
+ <TableHead>Expires</TableHead>
+ <TableHead>Views Left</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead aria-label="button" className="w-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending &&
+ Array.from({ length: 5 }).map((_, i) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <TableRow key={`skeleton-${i}`}>
+ {Array.from({ length: 7 }).map((__, j) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <td key={`skeleton-cell-${j}`} className="px-3 py-3">
+ <Skeleton className="h-4 w-full" />
+ </td>
+ ))}
+ </TableRow>
+ ))}
+ {hasSecrets &&
+ data.secrets.map((row) => (
+ <ShareSecretsRow key={row.id} row={row} handlePopUpOpen={handlePopUpOpen} />
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ {hasSecrets && data.totalCount >= perPage && data.totalCount !== undefined && (
+ <Pagination
+ count={data.totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ />
+ )}
{!isPending && !data?.secrets?.length && (
- <Empty>
+ <Empty className="border">
<EmptyHeader>
- <EmptyMedia variant="icon">
- <KeyRound />
- </EmptyMedia>
<EmptyTitle>No secrets shared yet</EmptyTitle>
+ <EmptyDescription>Share a secret to get started</EmptyDescription>
</EmptyHeader>
</Empty>
)}
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index 5ec8eb88c9..d4ec024e4c 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -523,7 +523,8 @@ export const ShareSecretForm = ({
<p className="mr-4 break-all">{secretLink}</p>
<IconButton
aria-label="copy icon"
- variant="ghost"
+ variant="ghost-muted"
+ size="sm"
className="absolute top-1 right-1"
onClick={() => {
navigator.clipboard.writeText(secretLink || "");