diff --git a/docs/images/platform/secret-sharing/new-time-bound-secret.png b/docs/images/platform/secret-sharing/new-time-bound-secret.png index 4e34788eb1..fb00ccbd0a 100644 Binary files a/docs/images/platform/secret-sharing/new-time-bound-secret.png and b/docs/images/platform/secret-sharing/new-time-bound-secret.png differ diff --git a/docs/images/platform/secret-sharing/new-view-bound-secret.png b/docs/images/platform/secret-sharing/new-view-bound-secret.png index c5aa6918db..bc88c3bf5a 100644 Binary files a/docs/images/platform/secret-sharing/new-view-bound-secret.png and b/docs/images/platform/secret-sharing/new-view-bound-secret.png differ diff --git a/frontend/src/views/ShareSecretPage/components/AddShareSecretModal.tsx b/frontend/src/views/ShareSecretPage/components/AddShareSecretModal.tsx index dcaf91b466..107c9beb40 100644 --- a/frontend/src/views/ShareSecretPage/components/AddShareSecretModal.tsx +++ b/frontend/src/views/ShareSecretPage/components/AddShareSecretModal.tsx @@ -21,7 +21,6 @@ import { SecretInput, Select, SelectItem, - Switch } from "@app/components/v2"; import { useOrganization } from "@app/context"; import { useTimedReset } from "@app/hooks"; @@ -62,7 +61,8 @@ const expirationUnitsAndActions = [ ]; const schema = yup.object({ - value: yup.string().max(1000).required().label("Shared Secret Value"), + value: yup.string().max(10000).required().label("Shared Secret Value"), + expiryOption: yup.string().optional().label("Expiration Option").default("Time"), expiresAfterViews: yup.number().min(1).optional().label("Expires After Views"), expiresInValue: yup.number().min(1).optional().label("Expiration Value"), expiresInUnit: yup.string().optional().label("Expiration Unit") @@ -90,7 +90,7 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => { const createSharedSecret = useCreateSharedSecret(); const { currentOrg } = useOrganization(); const [newSharedSecret, setnewSharedSecret] = useState(""); - const [expiryOption, setExpiryOption] = useState<"time" | "views">("time"); + const [expiryOption, setExpiryOption] = useState<"Time" | "Views">("Time"); const hasSharedSecret = Boolean(newSharedSecret); const [isUrlCopied, , setIsUrlCopied] = useTimedReset({ initialState: false @@ -134,8 +134,8 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => { iv, tag, hashedHex, - expiresAt: expiryOption === "time" ? expiresAt : undefined, - expiresAfterViews: expiryOption === "views" ? expiresAfterViews : undefined + expiresAt: expiryOption === "Time" ? expiresAt : undefined, + expiresAfterViews: expiryOption === "Views" ? expiresAfterViews : undefined }); setnewSharedSecret( `${window.location.origin}/shared/secret/${id}?key=${encodeURIComponent( @@ -197,88 +197,100 @@ export const AddShareSecretModal = ({ popUp, handlePopUpToggle }: Props) => { )} /> -
-

- Set Expiry Based On -

-
-

- Time -

- setExpiryOption(value ? "views" : "time")} - isChecked={expiryOption === "views"} - /> -

- Views -

-
-
-
- {expiryOption === "views" ? ( +
+
( + name="expiryOption" + defaultValue="Time" + render={({ field: { onChange, ...field }, fieldState: { error } }) => ( - + )} /> - ) : ( -
-
- ( - - - - )} - /> -
-
- ( - - + + )} + /> + ) : ( +
+
+ ( + - {expirationUnitsAndActions.map(({ unit }) => ( - - {unit} - - ))} - - - )} - /> + + + )} + /> +
+
+ ( + + + + )} + /> +
-
- )} + )} +