Skip to content

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

improvement: update request secret tab to v3 components

Scott Wilson140fd474ece7
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
index ec4b95c552..682826f617 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/AddSecretRequestModal.tsx
@@ -1,4 +1,10 @@
-import { Modal, ModalContent } from "@app/components/v2";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle
+} from "@app/components/v3";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { RequestSecretForm } from "./RequestSecretForm";
@@ -13,18 +19,21 @@ type Props = {
export const AddSecretRequestModal = ({ popUp, handlePopUpToggle }: Props) => {
return (
- <Modal
- isOpen={popUp?.createSecretRequest?.isOpen}
+ <Dialog
+ open={popUp?.createSecretRequest?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("createSecretRequest", isOpen);
}}
>
- <ModalContent
- title="Request a Secret"
- subTitle="Securely request one off secrets from your team or people outside your organization."
- >
+ <DialogContent className="max-w-xl">
+ <DialogHeader>
+ <DialogTitle>Request a Secret</DialogTitle>
+ <DialogDescription>
+ Securely request one off secrets from your team or people outside your organization.
+ </DialogDescription>
+ </DialogHeader>
<RequestSecretForm />
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
index d79fcfcfa4..a5de185b0c 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretForm.tsx
@@ -1,13 +1,28 @@
import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
-import { faCheck, faCopy, faRedo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { useSearch } from "@tanstack/react-router";
+import { Check, Copy, Info, ReplyIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";
+import {
+ Button,
+ Field,
+ FieldDescription,
+ FieldError,
+ FieldLabel,
+ IconButton,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useTimedReset } from "@app/hooks";
import { SecretSharingAccessType, useCreateSecretRequest } from "@app/hooks/api/secretSharing";
@@ -83,41 +98,52 @@ export const RequestSecretForm = () => {
const hasSecretLink = Boolean(secretLink);
return !hasSecretLink ? (
- <form onSubmit={handleSubmit(onFormSubmit)}>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4">
<Controller
control={control}
name="name"
render={({ field, fieldState: { error } }) => (
- <FormControl label="Name (Optional)" isError={Boolean(error)} errorText={error?.message}>
- <Input {...field} placeholder="API Key" type="text" />
- </FormControl>
+ <Field>
+ <FieldLabel>
+ Name <span className="text-xs text-muted italic">- Optional</span>
+ </FieldLabel>
+ <Input {...field} placeholder="API Key" type="text" isError={Boolean(error)} />
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
)}
/>
<Controller
control={control}
name="expiresIn"
- defaultValue="3600000"
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Expires In"
- errorText={error?.message}
- tooltipText="Select for how long someone is able to input the secret. If a secret is shared with you in time, it will remain available to you, even after the expiration."
- isError={Boolean(error)}
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {expiresInOptions.map(({ label, value: expiresInValue }) => (
- <SelectItem value={String(expiresInValue || "")} key={label}>
- {label}
- </SelectItem>
- ))}
+ <Field>
+ <FieldLabel>
+ Expires In
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="size-3 cursor-help text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ Select for how long someone is able to input the secret. If a secret is shared
+ with you in time, it will remain available to you, even after the expiration.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Select value={field.value} onValueChange={(e) => onChange(e)}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {expiresInOptions.map(({ label, value: expiresInValue }) => (
+ <SelectItem value={String(expiresInValue || "")} key={label}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
)}
/>
@@ -126,62 +152,58 @@ export const RequestSecretForm = () => {
name="accessType"
defaultValue={SecretSharingAccessType.Organization}
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- tooltipText="Select who is able to input the secret"
- label="General Access"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- <SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
- <SelectItem value={SecretSharingAccessType.Organization}>
- People within your organization
- </SelectItem>
+ <Field>
+ <FieldLabel>
+ General Access
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="size-3 cursor-help text-muted" />
+ </TooltipTrigger>
+ <TooltipContent>Select who is able to input the secret</TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <Select value={field.value} onValueChange={(e) => onChange(e)}>
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={SecretSharingAccessType.Anyone}>Anyone</SelectItem>
+ <SelectItem value={SecretSharingAccessType.Organization}>
+ People within your organization
+ </SelectItem>
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldDescription>Controls who can provide the requested secret</FieldDescription>
+ {error && <FieldError>{error.message}</FieldError>}
+ </Field>
)}
/>
-
- <Button
- className="mt-4"
- size="sm"
- type="submit"
- isLoading={isSubmitting}
- isDisabled={isSubmitting}
- >
- Create Request Link
- </Button>
+ <div className="flex w-full justify-end">
+ <Button variant="org" type="submit" isPending={isSubmitting} isDisabled={isSubmitting}>
+ Create Request Link
+ </Button>
+ </div>
</form>
) : (
<>
- <div className="mr-2 flex items-center justify-end rounded-md bg-white/5 p-2 text-base text-gray-400">
+ <div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-label">
<p className="mr-4 break-all">{secretLink}</p>
<IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative ml-2"
+ aria-label="copy icon"
+ variant="ghost-muted"
+ size="sm"
+ className="absolute top-1 right-1"
onClick={() => {
navigator.clipboard.writeText(secretLink);
setCopyTextSecret("Copied");
}}
>
- <FontAwesomeIcon icon={isCopyingSecret ? faCheck : faCopy} />
+ {isCopyingSecret ? <Check className="size-4" /> : <Copy className="size-4" />}
</IconButton>
</div>
- <Button
- className="mt-4 w-full bg-mineshaft-700 py-3 text-bunker-200"
- colorSchema="primary"
- variant="outline_bg"
- size="sm"
- onClick={() => setSecretLink("")}
- rightIcon={<FontAwesomeIcon icon={faRedo} className="pl-2" />}
- >
+ <Button className="w-full" variant="org" size="lg" onClick={() => setSecretLink("")}>
Request Another Secret
+ <ReplyIcon />
</Button>
</>
);
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
index 1253cdbc06..f01807af16 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestSecretTab.tsx
@@ -1,8 +1,25 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { ReplyIcon, Trash2 } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { Button, DeleteActionModal } from "@app/components/v2";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DocumentationLinkBadge
+} from "@app/components/v3";
import { useDeleteSecretRequest } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -10,8 +27,6 @@ import { AddSecretRequestModal } from "./AddSecretRequestModal";
import { RequestedSecretsTable } from "./RequestedSecretsTable";
import { RevealSecretValueModal } from "./RevealSecretValueModal";
-type DeleteModalData = { name: string; id: string };
-
export const RequestSecretTab = () => {
const { popUp, handlePopUpToggle, handlePopUpClose, handlePopUpOpen } = usePopUp([
"createSecretRequest",
@@ -34,36 +49,56 @@ export const RequestSecretTab = () => {
};
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">Secret Requests</p>
- <Button
- colorSchema="primary"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => {
- handlePopUpOpen("createSecretRequest");
- }}
- >
- Request Secret
- </Button>
- </div>
- <RequestedSecretsTable handlePopUpOpen={handlePopUpOpen} />
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ Secret Requests
+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-sharing" />
+ </CardTitle>
+ <CardDescription>Request and manage secrets from your team</CardDescription>
+ <CardAction>
+ <Button
+ variant="org"
+ onClick={() => {
+ handlePopUpOpen("createSecretRequest");
+ }}
+ >
+ <ReplyIcon />
+ Request Secret
+ </Button>
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ <RequestedSecretsTable handlePopUpOpen={handlePopUpOpen} />
+ </CardContent>
<AddSecretRequestModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
<RevealSecretValueModal
isOpen={popUp.revealSecretRequestValue.isOpen}
popUp={popUp}
onOpenChange={(isOpen) => handlePopUpToggle("revealSecretRequestValue", isOpen)}
/>
- <DeleteActionModal
- isOpen={popUp.deleteSecretRequestConfirmation.isOpen}
- title={`Delete ${
- (popUp?.deleteSecretRequestConfirmation?.data as DeleteModalData)?.name || " "
- } secret request?`}
- onChange={(isOpen) => handlePopUpToggle("deleteSecretRequestConfirmation", isOpen)}
- deleteKey={(popUp?.deleteSecretRequestConfirmation?.data as DeleteModalData)?.name}
- onClose={() => handlePopUpClose("deleteSecretRequestConfirmation")}
- onDeleteApproved={onDeleteApproved}
- />
- </div>
+ <AlertDialog
+ open={popUp.deleteSecretRequestConfirmation.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteSecretRequestConfirmation", isOpen)}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Delete secret request?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This action cannot be undone. The secret request 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/RequestSecret/RequestedSecretsRow.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
index 4501e1659a..5eb3b43885 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsRow.tsx
@@ -1,10 +1,31 @@
-import { faCopy, faEye, faSpinner, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
+import {
+ CheckIcon,
+ ClockAlertIcon,
+ Copy,
+ Ellipsis,
+ EyeIcon,
+ GlobeIcon,
+ HourglassIcon,
+ Trash2
+} from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { IconButton, Td, Tooltip, Tr } from "@app/components/v2";
-import { Badge } from "@app/components/v3";
+import {
+ Badge,
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ IconButton,
+ OrgIcon,
+ TableCell,
+ TableRow,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
SecretSharingAccessType,
TSharedSecret,
@@ -30,106 +51,104 @@ export const RequestedSecretsRow = ({
}
return (
- <Tr key={row.id}>
- <Td>{row.name ? `${row.name}` : "-"}</Td>
- <Td>
+ <TableRow key={row.id}>
+ <TableCell isTruncatable>{row.name || <span className="text-muted">&mdash;</span>}</TableCell>
+ <TableCell>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <Badge
+ variant={row.accessType === SecretSharingAccessType.Anyone ? "neutral" : "org"}
+ >
+ {row.accessType === SecretSharingAccessType.Anyone ? <GlobeIcon /> : <OrgIcon />}
+ {row.accessType === SecretSharingAccessType.Anyone ? "Anyone" : "Organization"}
+ </Badge>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ {row.accessType === SecretSharingAccessType.Anyone
+ ? "Anyone can input the secret."
+ : "Only members of the organization can input the secret."}
+ </TooltipContent>
+ </Tooltip>
+ </TableCell>
+ <TableCell>{format(new Date(row.createdAt), "MMM d, yyyy h:mm a")}</TableCell>
+ <TableCell>
+ {row.expiresAt ? (
+ format(new Date(row.expiresAt), "MMM d, yyyy h:mm a")
+ ) : (
+ <span className="text-muted">&mdash;</span>
+ )}
+ </TableCell>
+ <TableCell>
{isExpired && !row.encryptedSecret ? (
- <Badge variant="danger">Expired</Badge>
+ <Badge variant="danger">
+ <ClockAlertIcon />
+ Expired
+ </Badge>
) : (
<Badge variant={row.encryptedSecret ? "success" : "warning"}>
+ {row.encryptedSecret ? <CheckIcon /> : <HourglassIcon />}
{row.encryptedSecret ? "Secret Provided" : "Pending Secret"}
</Badge>
)}
- </Td>
- <Td>
- <Tooltip
- content={
- row.accessType === SecretSharingAccessType.Anyone
- ? "Anyone can input the secret."
- : "Only members of the organization can input the secret."
- }
- >
- <Badge variant="info">
- {row.accessType === SecretSharingAccessType.Anyone ? "Anyone" : "Organization Members"}
- </Badge>
- </Tooltip>
- </Td>
- <Td>{`${format(new Date(row.createdAt), "yyyy-MM-dd - HH:mm a")}`}</Td>
- <Td>{row.expiresAt ? format(new Date(row.expiresAt), "yyyy-MM-dd - HH:mm a") : "-"}</Td>
- <Td>
- <div className="flex items-center gap-2">
- <Tooltip
- content={
- row.encryptedSecret
- ? "Reveal secret"
- : "Secret value must be provided before it can be viewed."
- }
- >
- <IconButton
- isDisabled={!row.encryptedSecret}
- className={row.encryptedSecret ? "" : "opacity-50"}
- onClick={async (e) => {
- e.stopPropagation();
-
- const secretRequest = await revealSecretValue({
- id: row.id
- });
-
+ </TableCell>
+ <TableCell>
+ <div className="flex items-center justify-end gap-x-4">
+ {row.encryptedSecret && (
+ <Button
+ onClick={async () => {
+ const secretRequest = await revealSecretValue({ id: row.id });
handlePopUpOpen("revealSecretRequestValue", {
secretValue: secretRequest.secretValue,
secretRequestName: secretRequest.name
});
}}
- variant="plain"
- ariaLabel="reveal"
- >
- <FontAwesomeIcon
- className={isPending ? "animate-spin" : ""}
- icon={!isPending ? faEye : faSpinner}
- />
- </IconButton>
- </Tooltip>
-
- <Tooltip content="Copy link">
- <IconButton
- isDisabled={Boolean(row.encryptedSecret) || isExpired}
- className={Boolean(row.encryptedSecret) || isExpired ? "opacity-50" : ""}
- onClick={async (e) => {
- e.stopPropagation();
-
- navigator.clipboard.writeText(
- `${window.location.origin}/secret-request/secret/${row.id}`
- );
-
- createNotification({
- text: "Shared secret link copied to clipboard.",
- type: "success"
- });
- }}
- variant="plain"
- ariaLabel="copy link"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </Tooltip>
-
- <Tooltip content="Delete">
- <IconButton
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteSecretRequestConfirmation", {
- name: "delete",
- id: row.id
- });
- }}
- variant="plain"
- ariaLabel="delete"
+ isPending={isPending}
+ variant="ghost"
+ size="xs"
>
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
- </Tooltip>
+ <EyeIcon /> Reveal Secret
+ </Button>
+ )}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton className="ml-auto" variant="ghost" size="xs" aria-label="actions">
+ <Ellipsis className="size-4" />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ isDisabled={Boolean(row.encryptedSecret) || isExpired}
+ onClick={() => {
+ navigator.clipboard.writeText(
+ `${window.location.origin}/secret-request/secret/${row.id}`
+ );
+ createNotification({
+ text: "Shared secret link copied to clipboard.",
+ type: "success"
+ });
+ }}
+ >
+ <Copy />
+ Copy Link
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="danger"
+ onClick={() =>
+ handlePopUpOpen("deleteSecretRequestConfirmation", {
+ name: "delete",
+ id: row.id
+ })
+ }
+ >
+ <Trash2 />
+ Delete
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
- </Td>
- </Tr>
+ </TableCell>
+ </TableRow>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
index 5e9edca7b0..c8ce8ed0f2 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RequestedSecretsTable.tsx
@@ -1,17 +1,18 @@
import { useState } from "react";
-import { faKey } from "@fortawesome/free-solid-svg-icons";
import {
- EmptyState,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
Pagination,
+ Skeleton,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableHead,
+ TableHeader,
+ TableRow
+} from "@app/components/v3";
import { useGetSecretRequests } from "@app/hooks/api/secretSharing";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -31,42 +32,60 @@ export const RequestedSecretsTable = ({ handlePopUpOpen }: Props) => {
offset: (page - 1) * perPage,
limit: perPage
});
+
+ const hasSecrets = !isPending && data?.secrets && data.secrets.length > 0;
+
return (
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>Name</Th>
- <Th>Status</Th>
- <Th>Access Type</Th>
- <Th>Created At</Th>
- <Th>Valid Until</Th>
- <Th aria-label="button" className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={7} innerKey="shared-secrets" />}
- {!isPending &&
- data?.secrets?.map((row) => (
- <RequestedSecretsRow key={row.id} row={row} handlePopUpOpen={handlePopUpOpen} />
- ))}
- </TBody>
- </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)}
- />
- )}
+ <div>
+ {(isPending || hasSecrets) && (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="w-1/4">Name</TableHead>
+ <TableHead>Access Type</TableHead>
+ <TableHead>Created</TableHead>
+ <TableHead>Expires</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: 6 }).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) => (
+ <RequestedSecretsRow 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 && (
- <EmptyState title="No secrets requested yet" icon={faKey} />
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No secrets requested yet</EmptyTitle>
+ <EmptyDescription>Request a secret to get started</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
)}
- </TableContainer>
+ </div>
);
};
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
index 5aa529e77b..4958e35f93 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/RequestSecret/RevealSecretValueModal.tsx
@@ -1,7 +1,17 @@
-import { faCheck, faCopy } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { ClipboardCheckIcon, Copy } from "lucide-react";
-import { Button, IconButton, Modal, ModalClose, ModalContent, Tooltip } from "@app/components/v2";
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+ IconButton,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useToggle } from "@app/hooks";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -13,41 +23,43 @@ type Props = {
type ContentProps = {
secretValue: string;
- secretRequestName?: string;
+ onClose: () => void;
};
-const Content = ({ secretValue, secretRequestName }: ContentProps) => {
+const Content = ({ secretValue, onClose }: ContentProps) => {
const [isSecretValueCopied, setIsSecretValueCopied] = useToggle(false);
return (
<>
- {secretRequestName && (
- <p className="mb-8 text-sm text-mineshaft-200">
- Shared secret value for <strong>{secretRequestName}</strong>
- </p>
- )}
-
- <div className="mb-8 flex items-center justify-between rounded-md bg-mineshaft-700 p-2 text-base text-gray-400">
+ <div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-label">
<p className="mr-4 break-all">{secretValue}</p>
- <Tooltip content="Click to copy">
- <IconButton
- ariaLabel="copy icon"
- colorSchema="secondary"
- className="group relative"
- onClick={() => {
- navigator.clipboard.writeText(secretValue);
- setIsSecretValueCopied.on();
- }}
- >
- <FontAwesomeIcon icon={isSecretValueCopied ? faCheck : faCopy} />
- </IconButton>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="copy icon"
+ variant="ghost"
+ size="sm"
+ className="absolute top-1 right-1"
+ onClick={() => {
+ navigator.clipboard.writeText(secretValue);
+ setIsSecretValueCopied.on();
+ }}
+ >
+ {isSecretValueCopied ? (
+ <ClipboardCheckIcon className="size-4" />
+ ) : (
+ <Copy className="size-4" />
+ )}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Click to copy</TooltipContent>
</Tooltip>
</div>
- <div className="mt-8 flex w-full items-center justify-between gap-2">
- <ModalClose asChild>
- <Button colorSchema="secondary">Close</Button>
- </ModalClose>
+ <div className="flex w-full justify-end">
+ <Button variant="outline" onClick={onClose}>
+ Close
+ </Button>
</div>
</>
);
@@ -58,16 +70,17 @@ export const RevealSecretValueModal = ({ isOpen, onOpenChange, popUp }: Props) =
secretValue: string;
secretRequestName?: string;
};
-
- const title = data?.secretRequestName
- ? `Shared secret value for secret request ${data.secretRequestName}`
- : "Shared secret value";
-
return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent title={title}>
- <Content secretRequestName={data?.secretRequestName} secretValue={data?.secretValue} />
- </ModalContent>
- </Modal>
+ <Dialog open={isOpen} onOpenChange={onOpenChange}>
+ <DialogContent className="max-w-xl">
+ <DialogHeader>
+ <DialogTitle>Shared secret value</DialogTitle>
+ <DialogDescription>
+ Shared secret value for secret request {data?.secretRequestName}
+ </DialogDescription>
+ </DialogHeader>
+ <Content secretValue={data?.secretValue} onClose={() => onOpenChange?.(false)} />
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index d4ec024e4c..aad8c14c3c 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -519,7 +519,7 @@ export const ShareSecretForm = ({
return (
<>
- <div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-foreground/85">
+ <div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-label">
<p className="mr-4 break-all">{secretLink}</p>
<IconButton
aria-label="copy icon"