Implemented the new react version of the frontend
This commit is contained in:
1 parent
236e6e06fb
commit
ffe7e52527
65 files changed
+5228
-177
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { useUpdateEntry } from '@/hooks/useEntries';
|
||||
import type { Entry } from '@/types';
|
||||
|
||||
interface EntrySettingsDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
entry: Entry;
|
||||
}
|
||||
|
||||
export function EntrySettingsDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
entry,
|
||||
}: EntrySettingsDialogProps) {
|
||||
const updateEntry = useUpdateEntry();
|
||||
|
||||
const handleToggle = (field: keyof Entry, value: boolean) => {
|
||||
updateEntry.mutate({ id: entry.id, data: { [field]: value } });
|
||||
};
|
||||
|
||||
const settings = [
|
||||
{ field: 'favorit' as const, label: 'Favorite' },
|
||||
{ field: 'hidden' as const, label: 'Hidden' },
|
||||
{ field: 'watchlist' as const, label: 'Watchlist' },
|
||||
];
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Entry Settings</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4 py-4">
|
||||
{settings.map(({ field, label }) => (
|
||||
<div key={field} className="flex items-center justify-between">
|
||||
<Label htmlFor={field}>{label}</Label>
|
||||
<Switch
|
||||
id={field}
|
||||
checked={!!entry[field]}
|
||||
onCheckedChange={(checked) => handleToggle(field, checked)}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user