diff --git a/package.json b/package.json index eff1cef..c3eb549 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.12.0", + "version": "1.13.0", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/src/app/api/goal/route.ts b/src/app/api/goal/route.ts index 6f67efd..0223b7e 100644 --- a/src/app/api/goal/route.ts +++ b/src/app/api/goal/route.ts @@ -3,6 +3,7 @@ import { getServerSession } from 'next-auth'; import { authOptions } from '@/lib/auth'; import { prisma } from '@/lib/prisma'; import { getHolidayHint } from '@/lib/holidays'; +import { getRandomLocalQuote } from '@/lib/quotes'; export const dynamic = 'force-dynamic'; @@ -34,6 +35,7 @@ export async function GET(req: Request) { select: { goalFallbackType: true, goalDefaultSentence: true, + language: true, } }); @@ -90,17 +92,26 @@ export async function GET(req: Request) { return NextResponse.json({ goal: holidayHint, isHoliday: true }); } - // 4. Fallback to ZenQuotes motivational quote - try { - const res = await fetch('https://zenquotes.io/api/random', { signal: AbortSignal.timeout(3000) }); - if (res.ok) { - const data = await res.json(); - if (data && data[0] && data[0].q) { - return NextResponse.json({ goal: `${data[0].q} — ${data[0].a}`, isQuote: true }); + // 4. Fallback to ZenQuotes motivational quote (English only) + const userLang = user?.language || 'en'; + if (userLang === 'en') { + try { + const res = await fetch('https://zenquotes.io/api/random', { signal: AbortSignal.timeout(3000) }); + if (res.ok) { + const data = await res.json(); + if (data && data[0] && data[0].q) { + return NextResponse.json({ goal: `${data[0].q} — ${data[0].a}`, isQuote: true }); + } } + } catch (e) { + console.error('Failed to fetch from ZenQuotes:', e); } - } catch (e) { - console.error('Failed to fetch from ZenQuotes:', e); + } + + // 5. Fallback to local curated quotes (supports DE and EN) + const localQuote = getRandomLocalQuote(userLang); + if (localQuote) { + return NextResponse.json({ goal: `${localQuote.text} — ${localQuote.author}`, isQuote: true }); } // Final default fallback diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index f645173..d76311c 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -54,6 +54,7 @@ import SimpleDatePicker from "./SimpleDatePicker"; import RecurringTasksManager from "./RecurringTasksManager"; export interface RecurringTaskException { id: string; taskId: string; originalDate: string; newDate?: string | null; isCancelled: boolean; createdAt: Date; updatedAt: Date; } import { ImportListModal } from "./ImportListModal"; +import { getRandomLocalQuote } from "@/lib/quotes"; // Cookie helpers for per-device settings const DEVICE_SETTINGS_KEYS = ["viewDays", "cellDuration", "startHour", "endHour"]; @@ -1215,9 +1216,15 @@ export default function WeeklyView() { } } - // Final fallback if all failed - setMotivationalQuote("Stay focused and productive."); - }, [profile.goalFallbackType, profile.quoteSourceUrl, profile.quoteSourceUrls]); + // Final fallback: use local curated quotes + const lang = profile.language === "de" ? "de" : "en"; + const localQuote = getRandomLocalQuote(lang); + if (localQuote) { + setMotivationalQuote(`${localQuote.text} — ${localQuote.author}`); + } else { + setMotivationalQuote(lang === "de" ? "Bleib fokussiert und produktiv." : "Stay focused and productive."); + } + }, [profile.goalFallbackType, profile.quoteSourceUrl, profile.quoteSourceUrls, profile.language]); // Fetch tasks on mount useEffect(() => { @@ -10489,6 +10496,11 @@ function SettingsSidebar({
URL that returns a JSON list or object of quotes (e.g. {'[{"quote":"...","author":"..."}]'} or {'{"quote":"..."}'}).
++ {profile.language === "de" + ? "Wenn keine externe Quelle antwortet, werden lokale kuratierte Zitate in Ihrer Sprache verwendet." + : "If no external source responds, curated local quotes in your language are used as fallback."} +
)} {profile.goalFallbackType === "default" && ( diff --git a/src/lib/quotes.ts b/src/lib/quotes.ts index 2121df9..9debb09 100644 --- a/src/lib/quotes.ts +++ b/src/lib/quotes.ts @@ -343,6 +343,188 @@ export const LOCAL_QUOTES: LocalQuote[] = [ language: "en", tags: ["motivation", "success"], }, + // --- Additional German Quotes --- + { + text: "Das Geheimnis des Vorwartskommens besteht darin, den ersten Schritt zu tun.", + author: "Mark Twain", + language: "de", + tags: ["motivation", "work"], + }, + { + text: "Nicht der Wind, sondern das Segel bestimmt die Richtung.", + author: "Chinesisches Sprichwort", + language: "de", + tags: ["wisdom", "life", "motivation"], + }, + { + text: "Erfolg hat drei Buchstaben: T-U-N.", + author: "Johann Wolfgang von Goethe", + language: "de", + tags: ["motivation", "work", "success"], + }, + { + text: "Die Zukunft gehort denen, die an die Schonheit ihrer Traume glauben.", + author: "Eleanor Roosevelt", + language: "de", + tags: ["motivation", "life", "creativity"], + }, + { + text: "Sei du selbst die Veranderung, die du dir wunschst fur diese Welt.", + author: "Mahatma Gandhi", + language: "de", + tags: ["wisdom", "life", "motivation"], + }, + { + text: "Jeder Tag ist ein neuer Anfang.", + author: "T.S. Eliot", + language: "de", + tags: ["motivation", "life"], + }, + { + text: "Wer aufhort besser zu werden, hat aufgehort gut zu sein.", + author: "Philip Rosenthal", + language: "de", + tags: ["perseverance", "work", "success"], + }, + { + text: "Ordnung braucht nur der Dumme, das Genie beherrscht das Chaos.", + author: "Albert Einstein", + language: "de", + tags: ["humor", "creativity", "wisdom"], + }, + { + text: "In der Mitte von Schwierigkeiten liegen die Moglichkeiten.", + author: "Albert Einstein", + language: "de", + tags: ["perseverance", "motivation"], + }, + { + text: "Es gibt keine Abkurzung zu einem Ort, der es wert ist, erreicht zu werden.", + author: "Beverly Sills", + language: "de", + tags: ["perseverance", "success", "work"], + }, + { + text: "Wer das Ziel kennt, kann entscheiden; wer entscheidet, findet Ruhe.", + author: "Konfuzius", + language: "de", + tags: ["wisdom", "life"], + }, + { + text: "Kreativitat ist Intelligenz, die Spass hat.", + author: "Albert Einstein", + language: "de", + tags: ["creativity", "humor"], + }, + { + text: "Der beste Weg, die Zukunft vorherzusagen, ist sie zu gestalten.", + author: "Peter Drucker", + language: "de", + tags: ["motivation", "work", "success"], + }, + { + text: "Anfangen ist leicht, beharren eine Kunst.", + author: "Deutsches Sprichwort", + language: "de", + tags: ["perseverance", "work"], + }, + { + text: "Alles, was du dir vorstellen kannst, ist real.", + author: "Pablo Picasso", + language: "de", + tags: ["creativity", "motivation"], + }, + // --- Additional English Quotes --- + { + text: "Don't watch the clock; do what it does. Keep going.", + author: "Sam Levenson", + language: "en", + tags: ["motivation", "perseverance", "work"], + }, + { + text: "The only impossible journey is the one you never begin.", + author: "Tony Robbins", + language: "en", + tags: ["motivation", "perseverance"], + }, + { + text: "What you get by achieving your goals is not as important as what you become by achieving your goals.", + author: "Zig Ziglar", + language: "en", + tags: ["success", "wisdom", "motivation"], + }, + { + text: "Act as if what you do makes a difference. It does.", + author: "William James", + language: "en", + tags: ["motivation", "work"], + }, + { + text: "The future belongs to those who believe in the beauty of their dreams.", + author: "Eleanor Roosevelt", + language: "en", + tags: ["motivation", "life", "creativity"], + }, + { + text: "Be the change that you wish to see in the world.", + author: "Mahatma Gandhi", + language: "en", + tags: ["wisdom", "life", "motivation"], + }, + { + text: "Start where you are. Use what you have. Do what you can.", + author: "Arthur Ashe", + language: "en", + tags: ["motivation", "work", "perseverance"], + }, + { + text: "What lies behind us and what lies before us are tiny matters compared to what lies within us.", + author: "Ralph Waldo Emerson", + language: "en", + tags: ["wisdom", "motivation", "life"], + }, + { + text: "The best way to predict the future is to create it.", + author: "Peter Drucker", + language: "en", + tags: ["motivation", "work", "success"], + }, + { + text: "Small daily improvements over time lead to stunning results.", + author: "Robin Sharma", + language: "en", + tags: ["perseverance", "success", "work"], + }, + { + text: "Your limitation—it's only your imagination.", + author: "Unknown", + language: "en", + tags: ["motivation", "creativity"], + }, + { + text: "Great things never come from comfort zones.", + author: "Unknown", + language: "en", + tags: ["motivation", "perseverance", "success"], + }, + { + text: "Dream it. Wish it. Do it.", + author: "Unknown", + language: "en", + tags: ["motivation", "work"], + }, + { + text: "Don't stop when you are tired. Stop when you are done.", + author: "Unknown", + language: "en", + tags: ["perseverance", "motivation", "work"], + }, + { + text: "Hard work beats talent when talent doesn't work hard.", + author: "Tim Notke", + language: "en", + tags: ["work", "perseverance", "success"], + }, ]; /**