diff --git a/ui/src/components/ProjectProperties.tsx b/ui/src/components/ProjectProperties.tsx
index 3f6f6e4..f829265 100644
--- a/ui/src/components/ProjectProperties.tsx
+++ b/ui/src/components/ProjectProperties.tsx
@@ -154,6 +154,71 @@ function ProjectStatusPicker({ status, onChange }: { status: string; onChange: (
);
}
+function ArchiveDangerZone({
+ project,
+ onArchive,
+ archivePending,
+}: {
+ project: Project;
+ onArchive: (archived: boolean) => void;
+ archivePending?: boolean;
+}) {
+ const [confirming, setConfirming] = useState(false);
+ const isArchive = !project.archivedAt;
+ const action = isArchive ? "Archive" : "Unarchive";
+
+ return (
+
+
+ {isArchive
+ ? "Archive this project to hide it from the sidebar and project selectors."
+ : "Unarchive this project to restore it in the sidebar and project selectors."}
+
+ {archivePending ? (
+
+
+ {isArchive ? "Archiving..." : "Unarchiving..."}
+
+ ) : confirming ? (
+
+
+ {action} “{project.name}”?
+
+ {
+ setConfirming(false);
+ onArchive(isArchive);
+ }}
+ >
+ Confirm
+
+ setConfirming(false)}
+ >
+ Cancel
+
+
+ ) : (
+
setConfirming(true)}
+ >
+ {isArchive ? (
+ <> {action} project>
+ ) : (
+ <> {action} project>
+ )}
+
+ )}
+
+ );
+}
+
export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSaveState, onArchive, archivePending }: ProjectPropertiesProps) {
const { selectedCompanyId } = useCompany();
const queryClient = useQueryClient();
@@ -962,34 +1027,11 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
Danger Zone
-
-
- {project.archivedAt
- ? "Unarchive this project to restore it in the sidebar and project selectors."
- : "Archive this project to hide it from the sidebar and project selectors."}
-
-
{
- const action = project.archivedAt ? "Unarchive" : "Archive";
- const confirmed = window.confirm(
- `${action} project "${project.name}"?`,
- );
- if (!confirmed) return;
- onArchive(!project.archivedAt);
- }}
- >
- {archivePending ? (
- <> {project.archivedAt ? "Unarchiving..." : "Archiving..."}>
- ) : project.archivedAt ? (
- <> Unarchive project>
- ) : (
- <> Archive project>
- )}
-
-
+
>
)}