Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement: update shared secrets tab to v3 components
Scott Wilson62480976854f
diff --git a/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx b/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsxindex d32523c2b1..6312a90ea2 100644--- a/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx+++ b/frontend/src/pages/organization/SecretSharingPage/SecretSharingPage.tsx@@ -1,7 +1,5 @@import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";-import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { PageHeader } from "@app/components/v2";import { useOrganization } from "@app/context";@@ -26,21 +24,7 @@ export const SecretSharingPage = () => {scope={isSubOrganization ? "namespace" : "org"}title="Secret Sharing"description="Share secrets securely using a shareable link"- >- <a- target="_blank"- rel="noopener noreferrer"- href="https://infisical.com/docs/documentation/platform/secret-sharing"- >- <div className="flex w-max cursor-pointer items-center rounded-md border border-mineshaft-500 bg-mineshaft-600 px-4 py-2 text-mineshaft-200 duration-200 hover:border-primary/40 hover:bg-primary/10 hover:text-white">- Documentation{" "}- <FontAwesomeIcon- icon={faArrowUpRightFromSquare}- className="mb-[0.06rem] ml-1 text-xs"- />- </div>- </a>- </PageHeader>+ /><ShareSecretSection /></div></div>diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsxindex 2ea61ca989..b914141031 100644--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretTab.tsx@@ -1,8 +1,17 @@-import { faPlus } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { ForwardIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";-import { Button, DeleteActionModal } from "@app/components/v2";+import { DeleteActionModal } from "@app/components/v2";+import {+ Button,+ Card,+ CardAction,+ CardContent,+ CardDescription,+ CardHeader,+ CardTitle,+ DocumentationLinkBadge+} from "@app/components/v3";import { useDeleteSharedSecret } from "@app/hooks/api";import { usePopUp } from "@app/hooks/usePopUp";@@ -32,20 +41,28 @@ export const ShareSecretTab = () => {};return (- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">- <div className="mb-4 flex justify-between">- <p className="text-xl font-medium text-mineshaft-100">Shared Secrets</p>- <Button- colorSchema="primary"- leftIcon={<FontAwesomeIcon icon={faPlus} />}- onClick={() => {- handlePopUpOpen("createSharedSecret");- }}- >- Share Secret- </Button>- </div>- <ShareSecretsTable handlePopUpOpen={handlePopUpOpen} />+ <Card>+ <CardHeader>+ <CardTitle>+ Shared Secrets+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-sharing" />+ </CardTitle>+ <CardDescription>Manage and view your shared secrets</CardDescription>+ <CardAction>+ <Button+ variant="org"+ onClick={() => {+ handlePopUpOpen("createSharedSecret");+ }}+ >+ <ForwardIcon />+ Share Secret+ </Button>+ </CardAction>+ </CardHeader>+ <CardContent>+ <ShareSecretsTable handlePopUpOpen={handlePopUpOpen} />+ </CardContent><AddShareSecretModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><DeleteActionModalisOpen={popUp.deleteSharedSecretConfirmation.isOpen}@@ -57,6 +74,6 @@ export const ShareSecretTab = () => {onClose={() => handlePopUpClose("deleteSharedSecretConfirmation")}onDeleteApproved={onDeleteApproved}/>- </div>+ </Card>);};diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsxindex d4b40723b7..553d768a08 100644--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsRow.tsx@@ -1,9 +1,19 @@-import { faEnvelope, faEnvelopeOpen, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { format } from "date-fns";+import { Ellipsis, Mail, MailOpen, Trash2 } from "lucide-react";-import { IconButton, Td, Tooltip, Tr } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ IconButton,+ TableCell,+ TableRow,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { TSharedSecret } from "@app/hooks/api/secretSharing";import { UsePopUpState } from "@app/hooks/usePopUp";@@ -23,9 +33,8 @@ export const ShareSecretsRow = ({}) => void;}) => {- // const [isRowExpanded, setIsRowExpanded] = useToggle();const lastViewedAt = row.lastViewedAt- ? format(new Date(row.lastViewedAt), "yyyy-MM-dd - HH:mm a")+ ? format(new Date(row.lastViewedAt), "MMM d, yyyy h:mm a"): undefined;let isExpired = false;@@ -38,38 +47,58 @@ export const ShareSecretsRow = ({}return (- <Tr- key={row.id}- // className="h-10 cursor-pointer transition-colors duration-300 hover:bg-mineshaft-700"- // onClick={() => setIsRowExpanded.toggle()}- >- <Td>- <Tooltip content={lastViewedAt ? `Last opened at ${lastViewedAt}` : "Not yet opened"}>- <FontAwesomeIcon icon={lastViewedAt ? faEnvelopeOpen : faEnvelope} />+ <TableRow key={row.id}>+ <TableCell>+ <Tooltip>+ <TooltipTrigger asChild>+ {lastViewedAt ? (+ <MailOpen className="size-4 text-accent" />+ ) : (+ <Mail className="size-4 text-accent" />+ )}+ </TooltipTrigger>+ <TooltipContent>+ {lastViewedAt ? `Last opened at ${lastViewedAt}` : "Not yet opened"}+ </TooltipContent></Tooltip>- </Td>- <Td>{row.name ? `${row.name}` : "-"}</Td>- <Td>+ </TableCell>+ <TableCell>{row.name || <span className="text-muted">—</span>}</TableCell>++ <TableCell>{format(new Date(row.createdAt), "MMM d, yyyy h:mm a")}</TableCell>+ <TableCell>{format(new Date(row.expiresAt), "MMM d, yyyy h:mm a")}</TableCell>+ <TableCell>+ {row.expiresAfterViews !== null ? (+ row.expiresAfterViews+ ) : (+ <span className="text-muted">—</span>+ )}+ </TableCell>+ <TableCell><Badge variant={isExpired ? "danger" : "success"}>{isExpired ? "Expired" : "Active"}</Badge>- </Td>- <Td>{`${format(new Date(row.createdAt), "yyyy-MM-dd - HH:mm a")}`}</Td>- <Td>{format(new Date(row.expiresAt), "yyyy-MM-dd - HH:mm a")}</Td>- <Td>{row.expiresAfterViews !== null ? row.expiresAfterViews : "-"}</Td>- <Td>- <IconButton- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("deleteSharedSecretConfirmation", {- name: "delete",- id: row.id- });- }}- variant="plain"- ariaLabel="delete"- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </Td>- </Tr>+ </TableCell>+ <TableCell>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton variant="ghost" size="xs" aria-label="actions">+ <Ellipsis className="size-4" />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ variant="danger"+ onClick={() =>+ handlePopUpOpen("deleteSharedSecretConfirmation", {+ name: "delete",+ id: row.id+ })+ }+ >+ <Trash2 />+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>);};diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsxindex 5176c91626..c8c0c4ba67 100644--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/ShareSecretsTable.tsx@@ -1,17 +1,19 @@import { useState } from "react";-import { faKey } from "@fortawesome/free-solid-svg-icons";+import { KeyRound } from "lucide-react";import {- EmptyState,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,Pagination,+ Skeleton,Table,- TableContainer,- TableSkeleton,- TBody,- Th,- THead,- Tr-} from "@app/components/v2";+ TableBody,+ TableHead,+ TableHeader,+ TableRow+} from "@app/components/v3";import { useGetSharedSecrets } from "@app/hooks/api/secretSharing";import { UsePopUpState } from "@app/hooks/usePopUp";@@ -38,26 +40,38 @@ export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {limit: perPage});return (- <TableContainer>+ <div><Table>- <THead>- <Tr>- <Th className="w-5" />- <Th>Name</Th>- <Th>Status</Th>- <Th>Created At</Th>- <Th>Valid Until</Th>- <Th>Views Left</Th>- <Th aria-label="button" className="w-5" />- </Tr>- </THead>- <TBody>- {isPending && <TableSkeleton columns={7} innerKey="shared-secrets" />}+ <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} />))}- </TBody>+ </TableBody></Table>{!isPending &&data?.secrets &&@@ -72,8 +86,15 @@ export const ShareSecretsTable = ({ handlePopUpOpen }: Props) => {/>)}{!isPending && !data?.secrets?.length && (- <EmptyState title="No secrets shared yet" icon={faKey} />+ <Empty>+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <KeyRound />+ </EmptyMedia>+ <EmptyTitle>No secrets shared yet</EmptyTitle>+ </EmptyHeader>+ </Empty>)}- </TableContainer>+ </div>);};diff --git a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsxindex 9aa7ed869a..928b78eaa7 100644--- a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx+++ b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx@@ -24,7 +24,7 @@ export const ShareSecretPage = () => {<CardHeader><CardTitle>Share a Secret</CardTitle></CardHeader>- <CardContent>+ <CardContent className="flex flex-col gap-y-4"><ShareSecretForm isPublic /></CardContent></Card>diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsxindex 62b88cc879..5ec8eb88c9 100644--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx@@ -506,8 +506,8 @@ export const ShareSecretForm = ({<span>Shared secret link has been emailed to select users.</span></div><Button- className="mt-4 w-full"- variant="project"+ className="w-full"+ variant={isPublic ? "project" : "org"}size="lg"onClick={() => setSecretLink(null)}>@@ -534,8 +534,8 @@ export const ShareSecretForm = ({</IconButton></div><Button- className="mt-4 w-full"- variant="project"+ className="w-full"+ variant={isPublic ? "project" : "org"}size="lg"onClick={() => setSecretLink(null)}>