Remove useless modal

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-31 15:31:00 +02:00
parent 5a7b0c8ec9
commit 915e5e9f8c

View File

@@ -13,14 +13,6 @@ import type { FrameworkListViewQuery as FrameworkListViewQueryType } from "./__g
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Plus, Upload } from "lucide-react"; import { Plus, Upload } from "lucide-react";
import { useToast } from "@/hooks/use-toast"; import { useToast } from "@/hooks/use-toast";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { FrameworkListViewImportFrameworkMutation as FrameworkListViewImportFrameworkMutationType } from "./__generated__/FrameworkListViewImportFrameworkMutation.graphql"; import { FrameworkListViewImportFrameworkMutation as FrameworkListViewImportFrameworkMutationType } from "./__generated__/FrameworkListViewImportFrameworkMutation.graphql";
import { PageTemplate } from "@/components/PageTemplate"; import { PageTemplate } from "@/components/PageTemplate";
@@ -77,11 +69,16 @@ function FrameworkListViewContent({
useMutation<FrameworkListViewImportFrameworkMutationType>( useMutation<FrameworkListViewImportFrameworkMutationType>(
FrameworkListViewImportFrameworkMutation FrameworkListViewImportFrameworkMutation
); );
const [isImportDialogOpen, setIsImportDialogOpen] = useState(false);
const [isUploading, setIsUploading] = useState(false); const [isUploading, setIsUploading] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null); const fileInputRef = useRef<HTMLInputElement>(null);
const { toast } = useToast(); const { toast } = useToast();
const handleImportClick = () => {
if (fileInputRef.current) {
fileInputRef.current.click();
}
};
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0]; const file = e.target.files?.[0];
if (!file) return; if (!file) return;
@@ -106,7 +103,6 @@ function FrameworkListViewContent({
}, },
onCompleted: () => { onCompleted: () => {
setIsUploading(false); setIsUploading(false);
setIsImportDialogOpen(false);
toast({ toast({
title: "Framework imported", title: "Framework imported",
description: "Framework has been imported successfully.", description: "Framework has been imported successfully.",
@@ -133,23 +129,6 @@ function FrameworkListViewContent({
description="Manage your compliance frameworks" description="Manage your compliance frameworks"
actions={ actions={
<div className="flex gap-4"> <div className="flex gap-4">
<Dialog
open={isImportDialogOpen}
onOpenChange={setIsImportDialogOpen}
>
<DialogTrigger asChild>
<Button variant="outline">
<Upload className="mr-2 h-4 w-4" />
Import Framework
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Import Framework</DialogTitle>
</DialogHeader>
<div className="space-y-4 py-4">
<div className="space-y-2">
<Label htmlFor="framework-file">Upload Framework File</Label>
<Input <Input
id="framework-file" id="framework-file"
type="file" type="file"
@@ -157,14 +136,16 @@ function FrameworkListViewContent({
onChange={handleFileChange} onChange={handleFileChange}
disabled={isUploading} disabled={isUploading}
accept=".json" accept=".json"
className="hidden"
/> />
<p className="text-sm text-muted-foreground"> <Button
Upload a JSON file containing your framework definition. variant="outline"
</p> onClick={handleImportClick}
</div> disabled={isUploading}
</div> >
</DialogContent> <Upload className="mr-2 h-4 w-4" />
</Dialog> Import Framework
</Button>
<Button asChild> <Button asChild>
<Link to={`/organizations/${organizationId}/frameworks/create`}> <Link to={`/organizations/${organizationId}/frameworks/create`}>
<Plus className="mr-2 h-4 w-4" /> <Plus className="mr-2 h-4 w-4" />