diff --git a/resources/js/components/pending-operations-dialog.tsx b/resources/js/components/pending-operations-dialog.tsx index c791265e..50965be8 100644 --- a/resources/js/components/pending-operations-dialog.tsx +++ b/resources/js/components/pending-operations-dialog.tsx @@ -1,3 +1,4 @@ +import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, @@ -13,13 +14,18 @@ import { TableHeader, TableRow, } from '@/components/ui/table'; +import type { SyncStatus } from '@/contexts/sync-context'; import type { PendingChange } from '@/lib/dexie-db'; import { formatDistanceToNow } from 'date-fns'; +import { RefreshCw } from 'lucide-react'; interface PendingOperationsDialogProps { open: boolean; onOpenChange: (open: boolean) => void; operations: PendingChange[]; + onSyncNow: () => void; + syncStatus: SyncStatus; + isOnline: boolean; } function getOperationBadgeClass(operation: PendingChange['operation']): string { @@ -53,10 +59,15 @@ export function PendingOperationsDialog({ open, onOpenChange, operations, + onSyncNow, + syncStatus, + isOnline, }: PendingOperationsDialogProps) { + const isSyncing = syncStatus === 'syncing'; + const canSync = isOnline && !isSyncing; return ( - + Pending Operations @@ -107,6 +118,18 @@ export function PendingOperationsDialog({ )} +
+ +
); diff --git a/resources/js/components/sync-status-button.tsx b/resources/js/components/sync-status-button.tsx index 2a98bded..c2d8b4c1 100644 --- a/resources/js/components/sync-status-button.tsx +++ b/resources/js/components/sync-status-button.tsx @@ -131,6 +131,9 @@ export function SyncStatusButton() { open={showPendingDialog} onOpenChange={setShowPendingDialog} operations={pendingOperations} + onSyncNow={handleSyncNow} + syncStatus={syncStatus} + isOnline={isOnline} /> ); diff --git a/resources/js/components/ui/dialog.tsx b/resources/js/components/ui/dialog.tsx index 85205892..6885a1df 100644 --- a/resources/js/components/ui/dialog.tsx +++ b/resources/js/components/ui/dialog.tsx @@ -7,137 +7,137 @@ import { XIcon } from "lucide-react" import { cn } from "@/lib/utils" function Dialog({ - ...props + ...props }: React.ComponentProps) { - return + return } function DialogTrigger({ - ...props + ...props }: React.ComponentProps) { - return + return } function DialogPortal({ - ...props + ...props }: React.ComponentProps) { - return + return } function DialogClose({ - ...props + ...props }: React.ComponentProps) { - return + return } function DialogOverlay({ - className, - ...props + className, + ...props }: React.ComponentProps) { - return ( - - ) + return ( + + ) } function DialogContent({ - className, - children, - showCloseButton = true, - ...props + className, + children, + showCloseButton = true, + ...props }: React.ComponentProps & { - showCloseButton?: boolean + showCloseButton?: boolean }) { - return ( - - - - {children} - {showCloseButton && ( - - - Close - - )} - - - ) + return ( + + + + {children} + {showCloseButton && ( + + + Close + + )} + + + ) } function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) + return ( +
+ ) } function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) + return ( +
+ ) } function DialogTitle({ - className, - ...props + className, + ...props }: React.ComponentProps) { - return ( - - ) + return ( + + ) } function DialogDescription({ - className, - ...props + className, + ...props }: React.ComponentProps) { - return ( - - ) + return ( + + ) } export { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogOverlay, - DialogPortal, - DialogTitle, - DialogTrigger, + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, }