Skip to content

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

wip: update view shared secret error display

Scott Wilson0385c98c6eb0
diff --git a/frontend/src/components/v3/generic/Alert/Alert.tsx b/frontend/src/components/v3/generic/Alert/Alert.tsx
index 387ab4bb45..491ae17b88 100644
--- a/frontend/src/components/v3/generic/Alert/Alert.tsx
+++ b/frontend/src/components/v3/generic/Alert/Alert.tsx
@@ -13,6 +13,7 @@ const alertVariants = cva(
default: "bg-container text-card-foreground",
info: "bg-info/5 text-info border-info/20",
warning: "bg-warning/5 text-warning border-warning/20",
+ danger: "bg-danger/5 text-danger border-danger/20",
org: "bg-org/5 text-org border-org/20",
"sub-org": "bg-sub-org/5 text-sub-org border-sub-org/20"
}
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
index 110a0603a1..12e644cb44 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/ViewSharedSecretByIDPage.tsx
@@ -1,6 +1,5 @@
import { useEffect, useMemo, useRef } from "react";
import { Helmet } from "react-helmet";
-import { DiVim } from "react-icons/di";
import { useNavigate, useParams } from "@tanstack/react-router";
import { AxiosError } from "axios";
import { addSeconds, formatISO } from "date-fns";
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
index 3a39218e01..bcc4197862 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/PasswordContainer.tsx
@@ -3,7 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { twMerge } from "tailwind-merge";
import { z } from "zod";
-import { Button, Field, FieldError, FieldLabel, Input } from "@app/components/v3";
+import { Button, Field, FieldError, FieldLabel, Input } from "@app/components/v3";
import { BrandingTheme } from "../ViewSharedSecretByIDPage";
@@ -26,10 +26,12 @@ export const PasswordContainer = ({
isInvalidCredential,
brandingTheme
}: Props) => {
- const { control, handleSubmit } = useForm<FormData>({
+ const { control, handleSubmit, watch } = useForm<FormData>({
resolver: zodResolver(formSchema)
});
+ const currentPassword = watch("password");
+
const onFormSubmit = async ({ password }: FormData) => {
onPasswordSubmit(password);
};
@@ -101,6 +103,7 @@ export const PasswordContainer = ({
onClick={handleSubmit(onFormSubmit)}
style={inputStyle}
isPending={isSubmitting}
+ isDisabled={!currentPassword}
>
View Secret
</Button>
diff --git a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx
index 3413a446a8..0404b6677d 100644
--- a/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx
+++ b/frontend/src/pages/public/ViewSharedSecretByIDPage/components/SecretErrorContainer.tsx
@@ -1,5 +1,6 @@
import { TriangleAlertIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
+
+import { Alert, AlertTitle } from "@app/components/v3";
import { BrandingTheme } from "../ViewSharedSecretByIDPage";
@@ -18,20 +19,11 @@ export const SecretErrorContainer = ({ error, brandingTheme }: Props) => {
: undefined;
return (
- <div
- className={twMerge(
- "rounded-lg border p-6",
- !brandingTheme && "border-border bg-card"
- )}
- style={panelStyle}
- >
- <div className="flex items-center gap-4">
- <TriangleAlertIcon
- className="shrink-0"
- style={{ color: brandingTheme?.textMutedColor || "orangered" }}
- />
- <span>{error || "The secret you are looking for is missing or has expired"}</span>
- </div>
- </div>
+ <Alert variant={brandingTheme ? "default" : "danger"} style={panelStyle}>
+ <TriangleAlertIcon
+ style={brandingTheme ? { color: brandingTheme.textMutedColor } : undefined}
+ />
+ <AlertTitle>{error || "The secret you are looking for is missing or has expired"}</AlertTitle>
+ </Alert>
);
};