aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/components/DeleteNoteModal.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/components/DeleteNoteModal.tsx')
-rw-r--r--src/client/components/DeleteNoteModal.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/components/DeleteNoteModal.tsx b/src/client/components/DeleteNoteModal.tsx
index 5d81fdc..3ed22ec 100644
--- a/src/client/components/DeleteNoteModal.tsx
+++ b/src/client/components/DeleteNoteModal.tsx
@@ -1,5 +1,7 @@
+import { useAtomValue } from "jotai";
import { useState } from "react";
import { ApiClientError, apiClient } from "../api";
+import { isOnlineAtom } from "../atoms";
interface DeleteNoteModalProps {
isOpen: boolean;
@@ -18,6 +20,7 @@ export function DeleteNoteModal({
}: DeleteNoteModalProps) {
const [error, setError] = useState<string | null>(null);
const [isDeleting, setIsDeleting] = useState(false);
+ const isOnline = useAtomValue(isOnlineAtom);
const handleClose = () => {
setError(null);
@@ -127,7 +130,8 @@ export function DeleteNoteModal({
<button
type="button"
onClick={handleDelete}
- disabled={isDeleting}
+ disabled={isDeleting || !isOnline}
+ title={!isOnline ? "Reconnect to delete" : undefined}
className="px-4 py-2 bg-error hover:bg-error/90 text-white font-medium rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed min-w-[100px]"
>
{isDeleting ? "Deleting..." : "Delete"}