diff --git a/memento-note/app/actions/notes.ts b/memento-note/app/actions/notes.ts index f7f2825..180e6ab 100644 --- a/memento-note/app/actions/notes.ts +++ b/memento-note/app/actions/notes.ts @@ -319,6 +319,31 @@ export async function toggleReminderDone(noteId: string, done: boolean) { } } +// Clear completed reminders (set reminder to null for done reminders) +export async function clearCompletedReminders() { + const session = await auth(); + if (!session?.user?.id) return { error: 'Unauthorized' } + + try { + await prisma.note.updateMany({ + where: { + userId: session.user.id, + isReminderDone: true, + reminder: { not: null }, + }, + data: { + reminder: null, + isReminderDone: false, + }, + }) + revalidatePath('/reminders') + return { success: true } + } catch (error) { + console.error('Error clearing completed reminders:', error) + return { error: 'Failed to clear reminders' } + } +} + // Get archived notes only export async function getArchivedNotes() { const session = await auth(); diff --git a/memento-note/components/note-actions.tsx b/memento-note/components/note-actions.tsx index c39f492..74d56dc 100644 --- a/memento-note/components/note-actions.tsx +++ b/memento-note/components/note-actions.tsx @@ -9,6 +9,7 @@ import { import { Archive, ArchiveRestore, + Bell, MoreVertical, Palette, Pin, @@ -22,6 +23,8 @@ import { import { cn } from "@/lib/utils" import { NOTE_COLORS } from "@/lib/types" import { useLanguage } from "@/lib/i18n" +import { ReminderDialog } from "@/components/reminder-dialog" +import { useState } from "react" interface NoteActionsProps { isPinned: boolean @@ -41,6 +44,9 @@ interface NoteActionsProps { onPermanentDelete?: () => void onOpenHistory?: () => void historyEnabled?: boolean + noteId?: string + currentReminder?: Date | null + onUpdateReminder?: (noteId: string, reminder: Date | null) => void className?: string } @@ -62,9 +68,13 @@ export function NoteActions({ onPermanentDelete, onOpenHistory, historyEnabled = false, + noteId, + currentReminder, + onUpdateReminder, className }: NoteActionsProps) { const { t } = useLanguage() + const [showReminder, setShowReminder] = useState(false) // Trash view: show only Restore and Permanent Delete if (isTrashView) { @@ -105,6 +115,36 @@ export function NoteActions({ className={cn("flex items-center justify-end gap-1", className)} onClick={(e) => e.stopPropagation()} > + {/* Reminder */} + {noteId && onUpdateReminder && ( + <> + +
{t('notification.noNotifications') || 'No new notifications'}
{note.title || t('notification.untitled')}
+{note.title || t('notification.untitled')}
+