Skip to content

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

nits from scott

Matheus Nogueira4fcbefa8b1cc
diff --git a/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
index c253a0e162..2b790cb854 100644
--- a/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
+++ b/frontend/src/components/honey-tokens/HoneyTokenDetailsDrawer.tsx
@@ -1,13 +1,10 @@
-import { useEffect, useReducer, useState } from "react";
+import { useEffect, useState } from "react";
import { format, formatDistanceToNow } from "date-fns";
import {
AlertTriangle,
BanIcon,
CalendarIcon,
- Check,
- ClipboardCopy,
ClockIcon,
- EyeOff,
HexagonIcon,
KeyIcon,
MapPinIcon,
@@ -31,7 +28,6 @@ import {
Field,
FieldContent,
FieldLabel,
- IconButton,
Input,
PageLoader,
Sheet,
@@ -46,7 +42,6 @@ import {
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSecretActions } from "@app/context/ProjectPermissionContext/types";
import { HONEY_TOKEN_CREDENTIAL_FIELDS, HONEY_TOKEN_MAP } from "@app/helpers/honeyTokens";
-import { useTimedReset } from "@app/hooks";
import { HoneyTokenStatus, HoneyTokenType } from "@app/hooks/api/honeyTokens/enums";
import { useResetHoneyToken, useRevokeHoneyToken } from "@app/hooks/api/honeyTokens/mutations";
import {
@@ -55,6 +50,7 @@ import {
} from "@app/hooks/api/honeyTokens/queries";
import { HoneyTokenEventsSection } from "./HoneyTokenEventsSection";
+import { CredentialField } from "./ViewHoneyTokenCredentials/CredentialField";
type Props = {
projectId: string;
@@ -62,60 +58,6 @@ type Props = {
onClose: () => void;
};
-const CredentialField = ({ label, value }: { label: string; value?: string }) => {
- const [showCredential, toggleShowCredential] = useReducer((prev) => !prev, false);
- const [, isCopied, setCopied] = useTimedReset<string>({ initialState: "" });
-
- if (!value) return null;
-
- return (
- <Field>
- <FieldLabel>{label}</FieldLabel>
- <FieldContent>
- <div className="flex w-full min-w-0 items-center gap-1">
- <span
- className="min-w-0 flex-1 truncate font-mono text-sm"
- title={showCredential ? value : undefined}
- >
- {showCredential ? value : "****************************"}
- </span>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- setCopied(value);
- navigator.clipboard.writeText(value);
- }}
- aria-label={`Copy ${label}`}
- >
- {isCopied ? <Check className="size-3.5" /> : <ClipboardCopy className="size-3.5" />}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>Copy {label}</TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={toggleShowCredential}
- aria-label={`${showCredential ? "Hide" : "Show"} ${label}`}
- >
- <EyeOff className="size-3.5" />
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>
- {showCredential ? "Hide" : "Show"} {label}
- </TooltipContent>
- </Tooltip>
- </div>
- </FieldContent>
- </Field>
- );
-};
-
const DrawerContent = ({
honeyTokenId,
projectId
diff --git a/frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx b/frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx
index 747aa9208d..cd0ce67dbc 100644
--- a/frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx
+++ b/frontend/src/components/honey-tokens/HoneyTokenEventsSection.tsx
@@ -85,7 +85,7 @@ export const HoneyTokenEventsSection = ({ honeyTokenId, projectId }: Props) => {
{isPending && <PageLoader />}
{!isPending && (!events || events.length === 0) && (
- <Empty>
+ <Empty className="border">
<EmptyHeader>
<EmptyTitle>No events recorded yet</EmptyTitle>
</EmptyHeader>
diff --git a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx
index f5e4296bb9..56ed94256b 100644
--- a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx
+++ b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/AwsHoneyTokenCredentials.tsx
@@ -1,18 +1,7 @@
-import { useReducer } from "react";
-import { Check, ClipboardCopy, EyeOff } from "lucide-react";
-
-import {
- Field,
- FieldContent,
- FieldLabel,
- IconButton,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { useTimedReset } from "@app/hooks";
import { TAwsHoneyToken } from "@app/hooks/api/honeyTokens/types";
+import { CredentialField } from "./CredentialField";
+
type Props = {
secretsMapping: TAwsHoneyToken["secretsMapping"];
credentials: Record<string, string>;
@@ -23,62 +12,6 @@ const CREDENTIAL_FIELDS: { key: keyof TAwsHoneyToken["secretsMapping"]; label: s
{ key: "secretAccessKey", label: "Secret Access Key" }
];
-const CredentialField = ({ label, value }: { label: string; value?: string }) => {
- const [showCredential, toggleShowCredential] = useReducer((prev) => !prev, false);
- const [, isCopied, setCopied] = useTimedReset<string>({
- initialState: ""
- });
-
- if (!value) return null;
-
- return (
- <Field>
- <FieldLabel>{label}</FieldLabel>
- <FieldContent>
- <div className="flex w-full min-w-0 items-center gap-1">
- <span
- className="min-w-0 flex-1 truncate font-mono text-sm"
- title={showCredential ? value : undefined}
- >
- {showCredential ? value : "****************************"}
- </span>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- setCopied(value);
- navigator.clipboard.writeText(value);
- }}
- aria-label={`Copy ${label}`}
- >
- {isCopied ? <Check className="size-3.5" /> : <ClipboardCopy className="size-3.5" />}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>Copy {label}</TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- onClick={toggleShowCredential}
- aria-label={`${showCredential ? "Hide" : "Show"} ${label}`}
- >
- <EyeOff className="size-3.5" />
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>
- {showCredential ? "Hide" : "Show"} {label}
- </TooltipContent>
- </Tooltip>
- </div>
- </FieldContent>
- </Field>
- );
-};
-
export const AwsHoneyTokenCredentials = ({ secretsMapping, credentials }: Props) => {
return (
<div className="flex flex-col gap-4">
diff --git a/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/CredentialField.tsx b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/CredentialField.tsx
new file mode 100644
index 0000000000..f5b01bdfec
--- /dev/null
+++ b/frontend/src/components/honey-tokens/ViewHoneyTokenCredentials/CredentialField.tsx
@@ -0,0 +1,53 @@
+import { useReducer } from "react";
+import { faCopy, faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { Field, FieldContent, FieldLabel, IconButton, Input } from "@app/components/v3";
+import { useTimedReset } from "@app/hooks";
+
+type Props = {
+ label: string;
+ value?: string;
+};
+
+export const CredentialField = ({ label, value }: Props) => {
+ const [showCredential, toggleShowCredential] = useReducer((prev) => !prev, false);
+ const [, isCopied, setCopied] = useTimedReset<boolean>({ initialState: false });
+
+ if (!value) return null;
+
+ return (
+ <Field>
+ <FieldLabel>{label}</FieldLabel>
+ <FieldContent>
+ <div className="flex items-center gap-2">
+ <Input
+ value={value}
+ type={showCredential ? "text" : "password"}
+ readOnly
+ className="flex-1 font-mono"
+ />
+ <IconButton
+ aria-label={`${showCredential ? "Hide" : "Show"} ${label}`}
+ variant="outline"
+ size="md"
+ onClick={toggleShowCredential}
+ >
+ <FontAwesomeIcon icon={showCredential ? faEyeSlash : faEye} />
+ </IconButton>
+ <IconButton
+ aria-label={`Copy ${label}`}
+ variant="outline"
+ size="md"
+ onClick={() => {
+ navigator.clipboard.writeText(value);
+ setCopied(true);
+ }}
+ >
+ <FontAwesomeIcon icon={faCopy} className={isCopied ? "text-green-500" : ""} />
+ </IconButton>
+ </div>
+ </FieldContent>
+ </Field>
+ );
+};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
index afb4201d65..b500d28903 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProductSettingsTab/HoneyTokenModal.tsx
@@ -266,7 +266,7 @@ export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {
</div>
{isConfigured && (
- <div className="mb-4 rounded-md border border-mineshaft-600 bg-mineshaft-900 p-4">
+ <div className="mb-4 rounded-md border border-border bg-container p-4">
<div className="mb-3 flex items-center gap-2 text-sm text-mineshaft-300">
<FontAwesomeIcon icon={faTerminal} className="text-mineshaft-400" />
<span className="font-medium tracking-wide uppercase">
@@ -278,7 +278,7 @@ export const HoneyTokenModal = ({ isOpen, onOpenChange }: Props) => {
user and wires CloudTrail alerts back to Infisical.
</p>
<div className="relative">
- <pre className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4 pr-12 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap text-mineshaft-300">
+ <pre className="rounded-md border border-border bg-card p-4 pr-12 font-mono text-xs leading-relaxed break-all whitespace-pre-wrap text-mineshaft-300">
<span className="text-mineshaft-400 select-none">$ </span>
{cfCommand}
</pre>