Skip to content

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

improvement: update advanced secret share form settings and modal to v3

Scott Wilson3e703dd0a20a
diff --git a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
index a9450993fc..a4b6df750f 100644
--- a/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
+++ b/frontend/src/pages/organization/SecretSharingPage/components/ShareSecret/AddShareSecretModal.tsx
@@ -1,4 +1,10 @@
-import { Modal, ModalContent } from "@app/components/v2";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle
+} from "@app/components/v3";
import { useOrganization } from "@app/context";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { ShareSecretForm } from "@app/pages/public/ShareSecretPage/components";
@@ -14,16 +20,17 @@ type Props = {
export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
const { currentOrg } = useOrganization();
return (
- <Modal
- isOpen={popUp?.createSharedSecret?.isOpen}
+ <Dialog
+ open={popUp?.createSharedSecret?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("createSharedSecret", isOpen);
}}
>
- <ModalContent
- title="Share a Secret"
- subTitle="Securely share one off secrets with your team."
- >
+ <DialogContent className="max-w-xl">
+ <DialogHeader>
+ <DialogTitle>Share a Secret</DialogTitle>
+ <DialogDescription>Securely share one off secrets with your team.</DialogDescription>
+ </DialogHeader>
<ShareSecretForm
isPublic={false}
value={(popUp.createSharedSecret.data as { value?: string })?.value}
@@ -33,7 +40,7 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => {
maxSharedSecretLifetime={currentOrg?.maxSharedSecretLifetime}
maxSharedSecretViewLimit={currentOrg?.maxSharedSecretViewLimit}
/>
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
index d46be99c0f..9aa7ed869a 100644
--- a/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/ShareSecretPage.tsx
@@ -3,12 +3,7 @@ import { Helmet } from "react-helmet";
import { AuthPageBackground } from "@app/components/auth/AuthPageBackground";
import { AuthPageFooter } from "@app/components/auth/AuthPageFooter";
import { AuthPageHeader } from "@app/components/auth/AuthPageHeader";
-import {
- UnstableCard,
- UnstableCardContent,
- UnstableCardHeader,
- UnstableCardTitle
-} from "@app/components/v3";
+import { Card, CardContent, CardHeader, CardTitle } from "@app/components/v3";
import { ShareSecretForm } from "./components";
@@ -25,14 +20,14 @@ export const ShareSecretPage = () => {
</Helmet>
<AuthPageHeader />
- <UnstableCard className="z-50 m-auto w-full max-w-xl">
- <UnstableCardHeader>
- <UnstableCardTitle>Share a Secret</UnstableCardTitle>
- </UnstableCardHeader>
- <UnstableCardContent>
+ <Card className="z-50 m-auto w-full max-w-xl">
+ <CardHeader>
+ <CardTitle>Share a Secret</CardTitle>
+ </CardHeader>
+ <CardContent>
<ShareSecretForm isPublic />
- </UnstableCardContent>
- </UnstableCard>
+ </CardContent>
+ </Card>
<AuthPageFooter />
</div>
diff --git a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
index d8c4fc7a68..62b88cc879 100644
--- a/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
+++ b/frontend/src/pages/public/ShareSecretPage/components/ShareSecretForm.tsx
@@ -2,16 +2,23 @@ import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useSearch } from "@tanstack/react-router";
-import { Check, ClipboardCheck, Copy, ForwardIcon, Info, Lock, RefreshCw } from "lucide-react";
+import { Check, ClipboardCheck, Copy, ForwardIcon, Info, Lock } from "lucide-react";
+import { twMerge } from "tailwind-merge";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
Button,
Field,
FieldDescription,
FieldError,
FieldLabel,
+ IconButton,
+ Input,
Select,
SelectContent,
SelectItem,
@@ -21,13 +28,7 @@ import {
TextArea,
Tooltip,
TooltipContent,
- TooltipTrigger,
- UnstableAccordion,
- UnstableAccordionContent,
- UnstableAccordionItem,
- UnstableAccordionTrigger,
- UnstableIconButton,
- UnstableInput
+ TooltipTrigger
} from "@app/components/v3";
import { useTimedReset } from "@app/hooks";
import { useCreatePublicSharedSecret, useCreateSharedSecret } from "@app/hooks/api";
@@ -204,7 +205,7 @@ export const ShareSecretForm = ({
<FieldLabel>
Name <span className="text-xs text-muted italic">- Optional</span>
</FieldLabel>
- <UnstableInput
+ <Input
{...field}
placeholder="API Key"
type="text"
@@ -227,7 +228,7 @@ export const ShareSecretForm = ({
<TextArea
placeholder="Enter sensitive data to share via an encrypted link..."
{...field}
- className="h-40 min-h-[70px] resize-none"
+ className={twMerge("min-h-[70px] resize-none", isPublic ? "h-40" : "h-14")}
disabled={value !== undefined}
aria-invalid={Boolean(error)}
/>
@@ -243,7 +244,7 @@ export const ShareSecretForm = ({
<FieldLabel>
Password <span className="text-xs text-muted italic">- Optional</span>
</FieldLabel>
- <UnstableInput
+ <Input
{...field}
placeholder="Password"
type="password"
@@ -271,6 +272,7 @@ export const ShareSecretForm = ({
field.value === SecretSharingAccessType.Organization ||
!allowSecretSharingOutsideOrganization
}
+ variant="org"
disabled={!allowSecretSharingOutsideOrganization}
onCheckedChange={(v) =>
onChange(
@@ -297,10 +299,10 @@ export const ShareSecretForm = ({
/>
)}
- <UnstableAccordion type="single" collapsible>
- <UnstableAccordionItem value="advance-settings">
- <UnstableAccordionTrigger>Advanced Settings</UnstableAccordionTrigger>
- <UnstableAccordionContent>
+ <Accordion type="single" collapsible variant="ghost">
+ <AccordionItem value="advance-settings">
+ <AccordionTrigger>Advanced Settings</AccordionTrigger>
+ <AccordionContent className="flex flex-col gap-y-4">
<Controller
control={control}
name="expiresIn"
@@ -324,7 +326,7 @@ export const ShareSecretForm = ({
</SelectContent>
</Select>
{expiresInOptions.length !== filteredExpiresInOptions.length && (
- <FieldDescription className="text-yellow-500">
+ <FieldDescription className="text-warning">
Limited to{" "}
{filteredExpiresInOptions[filteredExpiresInOptions.length - 1].label} by
organization
@@ -334,7 +336,7 @@ export const ShareSecretForm = ({
</Field>
)}
/>
- <div className="flex w-full items-end gap-2">
+ <div className="flex w-full items-end gap-2 overflow-visible">
{maxSharedSecretViewLimit === null && (
<Controller
control={control}
@@ -349,7 +351,7 @@ export const ShareSecretForm = ({
<SelectTrigger className="w-full">
<SelectValue />
</SelectTrigger>
- <SelectContent position="popper">
+ <SelectContent>
{viewLimitOptions.map(({ label, value: viewLimitValue }) => (
<SelectItem
value={viewLimitValue.toString()}
@@ -372,7 +374,7 @@ export const ShareSecretForm = ({
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<Field className="flex-1">
{maxSharedSecretViewLimit && <FieldLabel>Max Views</FieldLabel>}
- <UnstableInput
+ <Input
onChange={onChange}
{...field}
min={1}
@@ -381,7 +383,7 @@ export const ShareSecretForm = ({
isError={Boolean(error)}
/>
{maxSharedSecretViewLimit && (
- <FieldDescription className="text-yellow-500">
+ <FieldDescription className="text-warning">
Limited to {maxSharedSecretViewLimit} view
{maxSharedSecretViewLimit === 1 ? "" : "s"} by organization
</FieldDescription>
@@ -418,7 +420,7 @@ export const ShareSecretForm = ({
</TooltipContent>
</Tooltip>
</FieldLabel>
- <UnstableInput
+ <Input
{...field}
autoComplete="off"
@@ -444,6 +446,7 @@ export const ShareSecretForm = ({
<Switch
checked={isOrgAccess ? false : (isChecked ?? false)}
onCheckedChange={onChange}
+ variant="org"
disabled={isOrgAccess}
id="allow-external-emails"
{...field}
@@ -478,14 +481,13 @@ export const ShareSecretForm = ({
/>
</>
)}
- </UnstableAccordionContent>
- </UnstableAccordionItem>
- </UnstableAccordion>
-
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
<div className="flex w-full justify-end">
<Button
size="md"
- variant="project"
+ variant={isPublic ? "project" : "org"}
type="submit"
isPending={isSubmitting}
isDisabled={isSubmitting}
@@ -496,7 +498,7 @@ export const ShareSecretForm = ({
</form>
);
- if (secretLink === "" || true)
+ if (secretLink === "")
return (
<>
<div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-foreground/85">
@@ -519,7 +521,7 @@ export const ShareSecretForm = ({
<>
<div className="relative flex items-center justify-center rounded-lg border border-border bg-container p-4 pr-6 text-foreground/85">
<p className="mr-4 break-all">{secretLink}</p>
- <UnstableIconButton
+ <IconButton
aria-label="copy icon"
variant="ghost"
className="absolute top-1 right-1"
@@ -529,7 +531,7 @@ export const ShareSecretForm = ({
}}
>
{isCopyingSecret ? <ClipboardCheck className="size-4" /> : <Copy className="size-4" />}
- </UnstableIconButton>
+ </IconButton>
</div>
<Button
className="mt-4 w-full"