Skip to content

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

improvement(secret-manager): migrate project settings to v3 components (#7577)

Andrew Huangdb6cfb06228c
diff --git a/frontend/src/components/project/ProjectOverviewChangeSection.tsx b/frontend/src/components/project/ProjectOverviewChangeSection.tsx
index 130a108975..c0173c0781 100644
--- a/frontend/src/components/project/ProjectOverviewChangeSection.tsx
+++ b/frontend/src/components/project/ProjectOverviewChangeSection.tsx
@@ -5,7 +5,20 @@ import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, FormControl, Input, TextArea } from "@app/components/v2";
+import {
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+ Input,
+ TextArea
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
@@ -75,12 +88,12 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="justify-betweens mb-8 flex flex-wrap gap-2">
- <h2 className="flex-1 text-xl font-medium text-mineshaft-100">Project Overview</h2>
- <div className="space-x-2">
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Project Overview</CardTitle>
+ <CardAction className="flex flex-wrap gap-2">
<Button
- variant="outline_bg"
+ variant="outline"
size="sm"
onClick={() => {
navigator.clipboard.writeText(currentSlug || "");
@@ -94,7 +107,7 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
Copy Project Slug
</Button>
<Button
- variant="outline_bg"
+ variant="outline"
size="sm"
onClick={() => {
navigator.clipboard.writeText(currentProject?.id || "");
@@ -107,74 +120,37 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
>
Copy Project ID
</Button>
- </div>
- </div>
- <div>
- <form onSubmit={handleSubmit(onFormSubmit)} className="flex w-full flex-col gap-0">
- <div className="flex w-full flex-row items-end gap-4">
- <div className="w-full max-w-md">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.Project}
- >
- {(isAllowed) => (
- <Controller
- defaultValue=""
- render={({ field, fieldState: { error } }) => (
- <FormControl
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex max-w-md flex-col gap-4">
+ <FieldGroup>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.Project}
+ >
+ {(isAllowed) => (
+ <Controller
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="project-name">Project name</FieldLabel>
+ <Input
+ id="project-name"
+ placeholder="Project name"
+ {...field}
+ disabled={!isAllowed}
isError={Boolean(error)}
- errorText={error?.message}
- label="Project name"
- >
- <Input
- placeholder="Project name"
- {...field}
- className="bg-mineshaft-800"
- isDisabled={!isAllowed}
- />
- </FormControl>
- )}
- control={control}
- name="name"
- />
- )}
- </ProjectPermissionCan>
- </div>
- </div>
- {showSlugField && (
- <div className="flex w-full flex-row items-end gap-4">
- <div className="w-full max-w-md">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.Project}
- >
- {(isAllowed) => (
- <Controller
- defaultValue=""
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Project slug"
- >
- <Input
- placeholder="Project slug"
- {...field}
- className="bg-mineshaft-800"
- isDisabled={!isAllowed}
- />
- </FormControl>
- )}
- control={control}
- name="slug"
- />
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
- </ProjectPermissionCan>
- </div>
- </div>
- )}
- <div className="flex w-full flex-row items-end gap-4">
- <div className="w-full max-w-md">
+ control={control}
+ name="name"
+ />
+ )}
+ </ProjectPermissionCan>
+ {showSlugField && (
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Project}
@@ -183,46 +159,61 @@ export const ProjectOverviewChangeSection = ({ showSlugField = false }: Props) =
<Controller
defaultValue=""
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Project description"
- >
- <TextArea
- placeholder="Project description"
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="project-slug">Project slug</FieldLabel>
+ <Input
+ id="project-slug"
+ placeholder="Project slug"
{...field}
- rows={3}
- className="thin-scrollbar max-w-md resize-none! bg-mineshaft-800"
- isDisabled={!isAllowed}
+ disabled={!isAllowed}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
- name="description"
+ name="slug"
/>
)}
</ProjectPermissionCan>
- </div>
- </div>
- <div>
+ )}
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Project}
>
{(isAllowed) => (
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isPending}
- isDisabled={isPending || !isAllowed}
- >
- Save
- </Button>
+ <Controller
+ defaultValue=""
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="project-description">Project description</FieldLabel>
+ <TextArea
+ id="project-description"
+ placeholder="Project description"
+ {...field}
+ rows={3}
+ className="resize-none"
+ disabled={!isAllowed}
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ control={control}
+ name="description"
+ />
)}
</ProjectPermissionCan>
- </div>
+ </FieldGroup>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Project}>
+ {(isAllowed) => (
+ <Button variant="project" type="submit" isPending={isPending} isDisabled={!isAllowed}>
+ Save
+ </Button>
+ )}
+ </ProjectPermissionCan>
</form>
- </div>
- </div>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/components/v2/LeaveProjectModal/LeaveProjectModal.tsx b/frontend/src/components/v2/LeaveProjectModal/LeaveProjectModal.tsx
deleted file mode 100644
index 7b60730531..0000000000
--- a/frontend/src/components/v2/LeaveProjectModal/LeaveProjectModal.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import { useEffect, useState } from "react";
-
-import { useToggle } from "@app/hooks";
-
-import { Button } from "../Button";
-import { FormControl } from "../FormControl";
-import { Input } from "../Input";
-import { Modal, ModalClose, ModalContent } from "../Modal";
-
-type Props = {
- deleteKey: string;
- title: string;
- onLeaveApproved: () => Promise<void>;
- onClose?: () => void;
- onChange?: (isOpen: boolean) => void;
- isOpen?: boolean;
- subTitle?: string;
- buttonText?: string;
-};
-
-export const LeaveProjectModal = ({
- isOpen,
- onClose,
- onChange,
- deleteKey,
- onLeaveApproved,
- title,
- subTitle,
- buttonText = "Leave Project"
-}: Props): JSX.Element => {
- const [inputData, setInputData] = useState("");
- const [isLoading, setIsLoading] = useToggle();
-
- useEffect(() => {
- setInputData("");
- }, [isOpen]);
-
- const onDelete = async () => {
- setIsLoading.on();
- try {
- await onLeaveApproved();
- } catch {
- setIsLoading.off();
- } finally {
- setIsLoading.off();
- }
- };
-
- return (
- <Modal
- isOpen={isOpen}
- onOpenChange={(isOpenState) => {
- setInputData("");
- if (onChange) onChange(isOpenState);
- }}
- >
- <ModalContent
- title={title}
- subTitle={subTitle}
- footerContent={
- <div className="mx-2 flex items-center">
- <Button
- className="mr-4"
- colorSchema="danger"
- isDisabled={!(deleteKey === inputData) || isLoading}
- onClick={onDelete}
- isLoading={isLoading}
- >
- {buttonText}
- </Button>
- <ModalClose asChild>
- <Button variant="plain" colorSchema="secondary" onClick={onClose}>
- Cancel
- </Button>
- </ModalClose>{" "}
- </div>
- }
- onClose={onClose}
- >
- <form
- onSubmit={(evt) => {
- evt.preventDefault();
- if (deleteKey === inputData) onDelete();
- }}
- >
- <FormControl
- label={
- <div className="pb-2 text-sm break-words">
- Type <span className="font-bold">{deleteKey}</span> to leave the project
- </div>
- }
- className="mb-0"
- >
- <Input
- value={inputData}
- onChange={(e) => setInputData(e.target.value)}
- placeholder="Type to confirm..."
- />
- </FormControl>
- </form>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/components/v2/LeaveProjectModal/index.tsx b/frontend/src/components/v2/LeaveProjectModal/index.tsx
deleted file mode 100644
index 5d33aa1083..0000000000
--- a/frontend/src/components/v2/LeaveProjectModal/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { LeaveProjectModal } from "./LeaveProjectModal";
diff --git a/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
index 8a2e02c594..8c524b9608 100644
--- a/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
@@ -4,7 +4,18 @@ import { z } from "zod";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input } from "@app/components/v2";
+import {
+ Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
import { useProject, useProjectPermission, useSubscription } from "@app/context";
import { usePopUp } from "@app/hooks";
import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/projects/queries";
@@ -77,40 +88,48 @@ export const AuditLogsRetentionSection = () => {
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
return (
<>
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex w-full items-center justify-between">
- <p className="text-xl font-medium">Audit Logs Retention</p>
- </div>
- <p className="mt-2 mb-4 max-w-2xl text-sm text-gray-400">
- Set the number of days to keep your project audit logs.
- </p>
- <form onSubmit={handleSubmit(handleAuditLogsRetentionSubmit)} autoComplete="off">
- <div className="max-w-xs">
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Audit Logs Retention</CardTitle>
+ <CardDescription>Set the number of days to keep your project audit logs.</CardDescription>
+ </CardHeader>
+ <CardContent>
+ <form
+ onSubmit={handleSubmit(handleAuditLogsRetentionSubmit)}
+ autoComplete="off"
+ className="flex flex-col items-start gap-4"
+ >
<Controller
control={control}
defaultValue={0}
name="auditLogsRetentionDays"
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Number of days"
- >
- <Input {...field} type="number" min={1} step={1} isDisabled={!isAdmin} />
- </FormControl>
+ <Field className="max-w-xs" data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="audit-logs-retention-days">Number of days</FieldLabel>
+ <Input
+ id="audit-logs-retention-days"
+ {...field}
+ type="number"
+ min={1}
+ step={1}
+ disabled={!isAdmin}
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
+ <Button
+ variant="project"
+ type="submit"
+ isPending={isSubmitting}
+ isDisabled={!isAdmin || !isDirty}
+ >
+ Save
+ </Button>
+ </form>
+ </CardContent>
+ </Card>
<UpgradePlanModal
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
diff --git a/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
index 3cb0c93719..65ec472008 100644
--- a/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/DeleteProjectProtection/DeleteProjectProtection.tsx
@@ -1,13 +1,22 @@
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Checkbox,
+ Field,
+ FieldContent,
+ FieldLabel
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
export const DeleteProjectProtection = () => {
const { projectId, currentProject } = useProject();
- const { mutateAsync } = useUpdateProject();
+ const { mutateAsync, isPending } = useUpdateProject();
const handleToggleDeleteProjectProtection = async (state: boolean) => {
await mutateAsync({
@@ -23,26 +32,39 @@ export const DeleteProjectProtection = () => {
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">Delete Protection</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
- {(isAllowed) => (
- <div>
- <Checkbox
- id="hasDeleteProtection"
- isDisabled={!isAllowed}
- isChecked={currentProject?.hasDeleteProtection ?? false}
- onCheckedChange={(state) => {
- handleToggleDeleteProjectProtection(state as boolean);
- }}
- allowMultilineLabel
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Delete Protection</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <Field
+ orientation="horizontal"
+ data-disabled={!isAllowed || isPending}
+ className="items-start"
>
- Protects the project from being deleted accidentally. While this option is enabled,
- you can&apos;t delete the project.
- </Checkbox>
- </div>
- )}
- </ProjectPermissionCan>
- </div>
+ <Checkbox
+ id="hasDeleteProtection"
+ variant="project"
+ isDisabled={!isAllowed || isPending}
+ isChecked={currentProject?.hasDeleteProtection ?? false}
+ onCheckedChange={(state) => {
+ if (state !== "indeterminate") {
+ handleToggleDeleteProjectProtection(state);
+ }
+ }}
+ />
+ <FieldContent>
+ <FieldLabel htmlFor="hasDeleteProtection" size="sm">
+ Protects the project from being deleted accidentally. While this option is
+ enabled, you can&apos;t delete the project.
+ </FieldLabel>
+ </FieldContent>
+ </Field>
+ )}
+ </ProjectPermissionCan>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
index 8756a885a1..86b061d702 100644
--- a/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
@@ -1,9 +1,32 @@
+import { useState } from "react";
import { useNavigate } from "@tanstack/react-router";
+import { TriangleAlert } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal, Tooltip } from "@app/components/v2";
-import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogConfirmationField,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ Button,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldLabel,
+ Input,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
ProjectPermissionActions,
ProjectPermissionSub,
@@ -15,6 +38,8 @@ import { useToggle } from "@app/hooks";
import { useDeleteWorkspace, useLeaveProject } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
+const CONFIRM_KEYWORD = "confirm";
+
export const DeleteProjectSection = () => {
const navigate = useNavigate();
@@ -29,6 +54,8 @@ export const DeleteProjectSection = () => {
const isDirectMember = Boolean(memberships?.some((membership) => !membership.actorGroupId));
const [isDeleting, setIsDeleting] = useToggle();
const [isLeaving, setIsLeaving] = useToggle();
+ const [deleteConfirmInput, setDeleteConfirmInput] = useState("");
+ const [leaveConfirmInput, setLeaveConfirmInput] = useState("");
const deleteWorkspace = useDeleteWorkspace();
const leaveProject = useLeaveProject();
@@ -70,67 +97,178 @@ export const DeleteProjectSection = () => {
to: "/organizations/$orgId/projects",
params: { orgId: currentOrg.id }
});
+ handlePopUpClose("leaveWorkspace");
} finally {
setIsLeaving.off();
}
};
+ const leaveButton = (
+ <Button
+ isPending={isLeaving}
+ isDisabled={!isDirectMember}
+ variant="danger"
+ onClick={() => handlePopUpOpen("leaveWorkspace")}
+ >
+ {`Leave ${currentProject?.name}`}
+ </Button>
+ );
+
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-4 text-xl font-medium text-mineshaft-100">Danger Zone</p>
- <div className="space-x-4">
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>
+ <TriangleAlert className="size-4 text-danger" />
+ Danger Zone
+ </CardTitle>
+ </CardHeader>
+ <CardContent className="flex flex-wrap gap-4">
<ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}>
{(isAllowed) => (
<Button
- isLoading={isDeleting}
- isDisabled={!isAllowed || isDeleting}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
+ isPending={isDeleting}
+ isDisabled={!isAllowed}
+ variant="danger"
onClick={() => handlePopUpOpen("deleteWorkspace")}
>
{`Delete ${currentProject?.name}`}
</Button>
)}
</ProjectPermissionCan>
- <Tooltip
- content="You're a member through a group. Leave the group to remove access."
- isDisabled={isDirectMember}
- >
- <span>
- <Button
- isLoading={isLeaving}
- isDisabled={!isDirectMember}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("leaveWorkspace")}
+ {isDirectMember ? (
+ leaveButton
+ ) : (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- focusable wrapper required so the tooltip explains why the inner button is disabled */}
+ <span tabIndex={0}>{leaveButton}</span>
+ </TooltipTrigger>
+ <TooltipContent>
+ You&apos;re a member through a group. Leave the group to remove access.
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </CardContent>
+
+ <AlertDialog
+ open={popUp.deleteWorkspace.isOpen}
+ onOpenChange={(isOpen) => {
+ handlePopUpToggle("deleteWorkspace", isOpen);
+ setDeleteConfirmInput("");
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <TriangleAlert className="text-danger" />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Are you sure you want to delete this project?</AlertDialogTitle>
+ <AlertDialogDescription>
+ Permanently delete {currentProject?.name} and all of its data. This action is not
+ reversible, so please be careful.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogConfirmationField>
+ <Field>
+ <FieldLabel htmlFor="delete-project-confirmation">
+ Type <span className="font-bold text-foreground">{CONFIRM_KEYWORD}</span> to perform
+ this action
+ </FieldLabel>
+ <Input
+ id="delete-project-confirmation"
+ value={deleteConfirmInput}
+ onChange={(event) => setDeleteConfirmInput(event.target.value)}
+ onKeyDown={(event) => {
+ if (
+ event.key === "Enter" &&
+ deleteConfirmInput === CONFIRM_KEYWORD &&
+ !isDeleting
+ ) {
+ event.preventDefault();
+ handleDeleteWorkspaceSubmit();
+ }
+ }}
+ autoComplete="off"
+ placeholder={`Type ${CONFIRM_KEYWORD} here`}
+ />
+ </Field>
+ </AlertDialogConfirmationField>
+ <AlertDialogFooter>
+ <AlertDialogCancel isDisabled={isDeleting}>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ isPending={isDeleting}
+ isDisabled={deleteConfirmInput !== CONFIRM_KEYWORD}
+ onClick={(event) => {
+ event.preventDefault();
+ handleDeleteWorkspaceSubmit();
+ }}
>
- {`Leave ${currentProject?.name}`}
- </Button>
- </span>
- </Tooltip>
- </div>
-
- <DeleteActionModal
- isOpen={popUp.deleteWorkspace.isOpen}
- title="Are you sure you want to delete this project?"
- subTitle={`Permanently delete ${currentProject?.name} and all of its data. This action is not reversible, so please be careful.`}
- onChange={(isOpen) => handlePopUpToggle("deleteWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Delete Project"
- onDeleteApproved={handleDeleteWorkspaceSubmit}
- />
-
- <LeaveProjectModal
- isOpen={popUp.leaveWorkspace.isOpen}
- title="Are you sure you want to leave this project?"
- subTitle={`If you leave ${currentProject?.name} you will lose access to the project and its contents.`}
- onChange={(isOpen) => handlePopUpToggle("leaveWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Leave Project"
- onLeaveApproved={handleLeaveWorkspaceSubmit}
- />
- </div>
+ Delete Project
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+
+ <AlertDialog
+ open={popUp.leaveWorkspace.isOpen}
+ onOpenChange={(isOpen) => {
+ handlePopUpToggle("leaveWorkspace", isOpen);
+ setLeaveConfirmInput("");
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <TriangleAlert className="text-danger" />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Are you sure you want to leave this project?</AlertDialogTitle>
+ <AlertDialogDescription>
+ If you leave {currentProject?.name} you will lose access to the project and its
+ contents.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogConfirmationField>
+ <Field>
+ <FieldLabel htmlFor="leave-project-confirmation">
+ Type <span className="font-bold text-foreground">{CONFIRM_KEYWORD}</span> to leave
+ the project
+ </FieldLabel>
+ <Input
+ id="leave-project-confirmation"
+ value={leaveConfirmInput}
+ onChange={(event) => setLeaveConfirmInput(event.target.value)}
+ onKeyDown={(event) => {
+ if (
+ event.key === "Enter" &&
+ leaveConfirmInput === CONFIRM_KEYWORD &&
+ !isLeaving
+ ) {
+ event.preventDefault();
+ handleLeaveWorkspaceSubmit();
+ }
+ }}
+ autoComplete="off"
+ placeholder={`Type ${CONFIRM_KEYWORD} here`}
+ />
+ </Field>
+ </AlertDialogConfirmationField>
+ <AlertDialogFooter>
+ <AlertDialogCancel isDisabled={isLeaving}>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ isPending={isLeaving}
+ isDisabled={leaveConfirmInput !== CONFIRM_KEYWORD}
+ onClick={(event) => {
+ event.preventDefault();
+ handleLeaveWorkspaceSubmit();
+ }}
+ >
+ Leave Project
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
index da2690a232..172cdc8ca4 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { Link, useSearch } from "@tanstack/react-router";
import { InfoIcon } from "lucide-react";
-import { PageHeader, TabPanel, Tabs } from "@app/components/v2";
+import { PageHeader } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
import { useOrganization, useProject } from "@app/context";
import { ProjectType, ProjectVersion } from "@app/hooks/api/projects/types";
@@ -80,6 +80,7 @@ export const SettingsPage = () => {
visibleTabs[0];
const baseTitle = t("settings.project.title");
const pageTitle = activeTab ? `${activeTab.name} - ${baseTitle}` : baseTitle;
+ const ActiveTabComponent = activeTab?.Component;
return (
<div className="flex h-full w-full justify-center bg-bunker-800 text-white">
@@ -103,13 +104,9 @@ export const SettingsPage = () => {
settings?
</Link>
</PageHeader>
- <Tabs orientation="vertical" value={activeTab?.key}>
- {visibleTabs.map(({ key, Component }) => (
- <TabPanel value={key} key={key}>
- <Component />
- </TabPanel>
- ))}
- </Tabs>
+ <div className="grow rounded-br-md rounded-bl-md py-5 outline-hidden xl:overflow-x-hidden xl:py-0">
+ {ActiveTabComponent ? <ActiveTabComponent /> : null}
+ </div>
</div>
</div>
);