From 8fbb048a14080868011aa289c688e336a02346ce Mon Sep 17 00:00:00 2001 From: Rachid Flih Date: Sun, 22 Dec 2024 20:41:51 -0300 Subject: [PATCH] fix: frontend UI improvements --- .../app/(Dashboard)/configuration/page.tsx | 60 +++- apps/webapp/src/app/b2c/login/page.tsx | 68 +++- apps/webapp/src/app/layout.tsx | 14 +- .../Configuration/Catalog/CopySnippet.tsx | 225 ++++++------- .../src/components/Connection/columns.tsx | 302 ++++++++++++++---- .../src/components/Events/EventsTable.tsx | 2 +- apps/webapp/src/components/Events/columns.tsx | 106 ++++-- 7 files changed, 550 insertions(+), 227 deletions(-) diff --git a/apps/webapp/src/app/(Dashboard)/configuration/page.tsx b/apps/webapp/src/app/(Dashboard)/configuration/page.tsx index 66aac6bae..f3d3b1f66 100644 --- a/apps/webapp/src/app/(Dashboard)/configuration/page.tsx +++ b/apps/webapp/src/app/(Dashboard)/configuration/page.tsx @@ -39,6 +39,8 @@ import useUpdatePullFrequency from "@/hooks/create/useCreatePullFrequency"; import { toast } from "sonner"; import { useQueryClient } from "@tanstack/react-query"; import { Loader2 } from "lucide-react"; +import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; const frequencyOptions = [ { label: '5 min', value: 300 }, @@ -63,7 +65,9 @@ export default function Page() { const [open, setOpen] = useState(false); const [localFrequencies, setLocalFrequencies] = useState>({}); const [loadingStates, setLoadingStates] = useState>({}); - + const [dialogOpen, setDialogOpen] = useState(false); + const [confirmText, setConfirmText] = useState(''); + const [selectedVertical, setSelectedVertical] = useState(null); const queryClient = useQueryClient(); @@ -160,11 +164,54 @@ export default function Page() { } }; - - + const handleConfirmSuspend = async () => { + try { + await saveFrequency(selectedVertical, '0'); + setDialogOpen(false); + } catch (error) { + console.error('Error suspending sync:', error); + } + }; + + const handleSuspendClick = (vertical: string) => { + setSelectedVertical(vertical); + setConfirmText(''); + setDialogOpen(true); + }; + return (
+ + + + Confirm Sync Suspension + + This will stop all automatic syncs for {selectedVertical?.toUpperCase()}. To confirm, please type "suspend" below. + + + setConfirmText(e.target.value)} + placeholder="Type 'suspend' to confirm" + /> + + + + + +
{VERTICALS.map(vertical => (
-