Add BMAD framework, authentication, and new features

This commit is contained in:
2026-01-08 21:23:23 +01:00
parent f07d28aefd
commit 15a95fb319
1298 changed files with 73308 additions and 154901 deletions

View File

@@ -0,0 +1,45 @@
'use client';
import { useState, useEffect } from 'react';
import { Note } from '@/lib/types';
import { useToast } from '@/components/ui/toast';
export function useReminderCheck(notes: Note[]) {
const [notifiedReminders, setNotifiedReminders] = useState<Set<string>>(new Set());
const { addToast } = useToast();
useEffect(() => {
const checkReminders = () => {
const now = new Date();
notes.forEach(note => {
if (!note.reminder) return;
const reminderDate = new Date(note.reminder);
// Check if reminder is due (within last minute or future)
// We only notify if it's due now or just passed, not old overdue ones (unless we want to catch up)
// Let's say: notify if reminder time is passed AND we haven't notified yet.
if (reminderDate <= now && !notifiedReminders.has(note.id)) {
// Play sound (optional)
// const audio = new Audio('/notification.mp3');
// audio.play().catch(e => console.log('Audio play failed', e));
addToast("🔔 Reminder: " + (note.title || "Untitled Note"), "info");
// Mark as notified in local state
setNotifiedReminders(prev => new Set(prev).add(note.id));
}
});
};
// Check immediately
checkReminders();
// Then check every 30 seconds
const interval = setInterval(checkReminders, 30000);
return () => clearInterval(interval);
}, [notes, notifiedReminders, addToast]);
}

View File

@@ -0,0 +1,33 @@
'use client';
import { useEffect, useRef } from 'react';
export function useResizeObserver(callback: (entry: ResizeObserverEntry) => void) {
const ref = useRef<HTMLElement>(null);
const frameId = useRef<number>(0);
useEffect(() => {
const element = ref.current;
if (!element) return;
const observer = new ResizeObserver((entries) => {
// Cancel previous frame to avoid stacking updates
if (frameId.current) cancelAnimationFrame(frameId.current);
frameId.current = requestAnimationFrame(() => {
for (const entry of entries) {
callback(entry);
}
});
});
observer.observe(element);
return () => {
observer.disconnect();
if (frameId.current) cancelAnimationFrame(frameId.current);
};
}, [callback]);
return ref;
}