forked from administration/panel
fix: optimise CSS
parent
373c66a251
commit
c54c690fe4
|
@ -56,77 +56,79 @@ export default function Classifications() {
|
|||
<TableRow>
|
||||
<TableHead>Domain</TableHead>
|
||||
<TableHead>Classification</TableHead>
|
||||
<TableHead>Action</TableHead>
|
||||
<TableHead className="text-end pr-2">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button disabled={!loaded}>Add</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Create classification</AlertDialogTitle>
|
||||
<AlertDialogDescription className="flex flex-row gap-1">
|
||||
<Input
|
||||
value={domainDraft}
|
||||
onChange={(e) => setDomainDraft(e.currentTarget.value)}
|
||||
placeholder="reddit.com"
|
||||
/>
|
||||
<Popover
|
||||
open={classificationOpen}
|
||||
onOpenChange={setClassificationOpen}
|
||||
<TableHead className="flex flex-row items-center justify-between gap-2 pr-1">
|
||||
<span>Action</span>
|
||||
<div className="text-end pr-2">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button disabled={!loaded}>Add</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Create classification</AlertDialogTitle>
|
||||
<AlertDialogDescription className="flex flex-row gap-1">
|
||||
<Input
|
||||
value={domainDraft}
|
||||
onChange={(e) => setDomainDraft(e.currentTarget.value)}
|
||||
placeholder="reddit.com"
|
||||
/>
|
||||
<Popover
|
||||
open={classificationOpen}
|
||||
onOpenChange={setClassificationOpen}
|
||||
>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={classificationOpen}
|
||||
>
|
||||
{classificationDraft || "Classification"}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent>
|
||||
<Command>
|
||||
{CLASSIFICATIONS.map((c) => (
|
||||
<CommandItem key={c} onSelect={() => {
|
||||
setClassificationDraft(c);
|
||||
setClassificationOpen(false);
|
||||
}}>
|
||||
{c}
|
||||
</CommandItem>
|
||||
))}
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
disabled={!domainDraft || !classificationDraft}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await createEmailClassification(domainDraft, classificationDraft);
|
||||
setDomains([...domains, { _id: domainDraft, classification: classificationDraft }]);
|
||||
setDomainDraft("");
|
||||
setClassificationDraft("");
|
||||
setClassificationOpen(false);
|
||||
toast({
|
||||
title: "Classification created",
|
||||
});
|
||||
} catch (e) {
|
||||
toast({
|
||||
title: "Failed to create classification",
|
||||
description: String(e),
|
||||
variant: "destructive",
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
role="combobox"
|
||||
aria-expanded={classificationOpen}
|
||||
>
|
||||
{classificationDraft || "Classification"}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent>
|
||||
<Command>
|
||||
{CLASSIFICATIONS.map((c) => (
|
||||
<CommandItem key={c} onSelect={() => {
|
||||
setClassificationDraft(c);
|
||||
setClassificationOpen(false);
|
||||
}}>
|
||||
{c}
|
||||
</CommandItem>
|
||||
))}
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
disabled={!domainDraft || !classificationDraft}
|
||||
onClick={async () => {
|
||||
try {
|
||||
await createEmailClassification(domainDraft, classificationDraft);
|
||||
setDomains([...domains, { _id: domainDraft, classification: classificationDraft }]);
|
||||
setDomainDraft("");
|
||||
setClassificationDraft("");
|
||||
setClassificationOpen(false);
|
||||
toast({
|
||||
title: "Classification created",
|
||||
});
|
||||
} catch (e) {
|
||||
toast({
|
||||
title: "Failed to create classification",
|
||||
description: String(e),
|
||||
variant: "destructive",
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
Create
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
Create
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
|
|
Loading…
Reference in New Issue