diff --git a/app/globals.css b/app/globals.css index e0a7f85..1432f18 100644 --- a/app/globals.css +++ b/app/globals.css @@ -55,4 +55,4 @@ body { @apply bg-background text-foreground; } -} \ No newline at end of file +} diff --git a/app/journal/page.tsx b/app/journal/page.tsx index 4e2135e..661ae89 100644 --- a/app/journal/page.tsx +++ b/app/journal/page.tsx @@ -5,7 +5,14 @@ import { v4 as uuidv4 } from "uuid"; import { useLiveQuery } from "dexie-react-hooks"; import { db } from "@/lib/db"; import { analyzeJournalWithLocalAI } from "@/lib/ai"; -import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"; +import { + Card, + CardContent, + CardHeader, + CardTitle, + CardDescription, + CardFooter, +} from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; @@ -25,8 +32,8 @@ export default function JournalPage() { const [isSubmitting, setIsSubmitting] = useState(false); // Dexie.js üzerinden günlükleri tarih sırasına göre çekiyoruz (en yeni en üstte) - const journals = useLiveQuery( - () => db.journals.orderBy("date").reverse().toArray() + const journals = useLiveQuery(() => + db.journals.orderBy("date").reverse().toArray(), ); const handleSubmit = async (e: React.FormEvent) => { @@ -83,7 +90,6 @@ export default function JournalPage() { } catch (aiErr) { console.error("Arka plan AI analizi hatası:", aiErr); } - } catch (error) { console.error("Günlük kaydedilemedi:", error); } finally { @@ -92,7 +98,7 @@ export default function JournalPage() { }; const handleDelete = async (id: string) => { - if(confirm("Bu günlüğü silmek istediğinden emin misin?")) { + if (confirm("Bu günlüğü silmek istediğinden emin misin?")) { await db.journals.delete(id); } }; @@ -101,7 +107,9 @@ export default function JournalPage() {

Günlük

-

Zihnini boşalt, hislerini kaydet. Verilerin sadece cihazında kalır.

+

+ Zihnini boşalt, hislerini kaydet. Verilerin sadece cihazında kalır. +

@@ -121,7 +129,9 @@ export default function JournalPage() { type="button" onClick={() => setMood(m.id)} className={`flex-1 py-2 px-1 rounded-md border text-xl flex items-center justify-center transition-colors ${ - mood === m.id ? "bg-primary/20 border-primary" : "bg-card border-border hover:bg-muted" + mood === m.id + ? "bg-primary/20 border-primary" + : "bg-card border-border hover:bg-muted" }`} title={m.label} > @@ -155,7 +165,11 @@ export default function JournalPage() { />
- @@ -167,7 +181,9 @@ export default function JournalPage() { {!journals ? (

Yükleniyor...

) : journals.length === 0 ? ( -

Henüz kayıt bulunmuyor.

+

+ Henüz kayıt bulunmuyor. +

) : (
{journals.map((journal) => ( @@ -175,7 +191,9 @@ export default function JournalPage() {
- {moods.find(m => m.id === journal.mood)?.emoji} + + {moods.find((m) => m.id === journal.mood)?.emoji} + {journal.date} @@ -184,13 +202,18 @@ export default function JournalPage() {
-

{journal.content}

- +

+ {journal.content} +

+ {/* AI Sonuçlarını Göster */} {journal.ai_tags && (
- {journal.ai_tags.map(tag => ( - + {journal.ai_tags.map((tag) => ( + {tag} ))} @@ -203,7 +226,14 @@ export default function JournalPage() { )}
- +
diff --git a/app/layout.tsx b/app/layout.tsx index 949e486..90c1587 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -6,7 +6,7 @@ import { ThemeProvider } from "@/components/theme-provider"; import { Sidebar } from "@/components/layout/sidebar"; import { Header } from "@/components/layout/header"; -const geist = Geist({subsets:['latin'],variable:'--font-sans'}); +const geist = Geist({ subsets: ["latin"], variable: "--font-sans" }); export const metadata: Metadata = { title: "MindSpace", @@ -19,13 +19,17 @@ export default function RootLayout({ children: React.ReactNode; }>) { return ( - +
diff --git a/app/page.tsx b/app/page.tsx index c2b37c6..c254a4d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,27 +15,36 @@ import { ResponsiveContainer, BarChart, Bar, - Legend + Legend, } from "recharts"; -const moodScores: Record = { happy: 4, neutral: 3, sad: 2, angry: 1 }; +const moodScores: Record = { + happy: 4, + neutral: 3, + sad: 2, + angry: 1, +}; export default function DashboardPage() { - const journals = useLiveQuery(() => db.journals.orderBy("date").toArray()) || []; + const journals = + useLiveQuery(() => db.journals.orderBy("date").toArray()) || []; const tasks = useLiveQuery(() => db.tasks.toArray()) || []; - - const pendingTasksCount = tasks.filter(t => t.status === "todo").length; - + + const pendingTasksCount = tasks.filter((t) => t.status === "todo").length; + // Bugüne ait enerji seviyesi const today = new Date().toISOString().split("T")[0]; - const todaysJournal = journals.find(j => j.date === today); + const todaysJournal = journals.find((j) => j.date === today); const todaysEnergy = todaysJournal ? todaysJournal.energy : "--"; // 1. Grafik: Son 7 günün Ruh Hali ve Enerji trendi const trendData = useMemo(() => { - const dataMap: Record = {}; - - journals.forEach(j => { + const dataMap: Record< + string, + { date: string; moodSum: number; energySum: number; count: number } + > = {}; + + journals.forEach((j) => { if (!dataMap[j.date]) { dataMap[j.date] = { date: j.date, moodSum: 0, energySum: 0, count: 0 }; } @@ -45,7 +54,7 @@ export default function DashboardPage() { }); return Object.values(dataMap) - .map(d => ({ + .map((d) => ({ date: d.date.slice(5), // Sadece MM-DD formatı alalım Mood: Number((d.moodSum / d.count).toFixed(1)), Enerji: Number((d.energySum / d.count).toFixed(1)), @@ -56,9 +65,9 @@ export default function DashboardPage() { // 2. Grafik: En çok kullanılan AI etiketleri const tagData = useMemo(() => { const counts: Record = {}; - journals.forEach(j => { + journals.forEach((j) => { if (j.ai_tags) { - j.ai_tags.forEach(tag => { + j.ai_tags.forEach((tag) => { counts[tag] = (counts[tag] || 0) + 1; }); } @@ -70,45 +79,55 @@ export default function DashboardPage() { }, [journals]); // Son günlüğe ait AI Summary - const lastInsight = [...journals].reverse().find(j => j.ai_summary)?.ai_summary; + const lastInsight = [...journals] + .reverse() + .find((j) => j.ai_summary)?.ai_summary; return (

Bugün Nasılsın?

-

Kişisel özetin ve yapay zeka analizlerin burada görünecek.

+

+ Kişisel özetin ve yapay zeka analizlerin burada görünecek. +

- Günlük Kayıtları + + Günlük Kayıtları +
{journals.length}

- {journals.length === 0 ? "Henüz kayıt girilmedi" : "Toplam kayıt eklendi"} + {journals.length === 0 + ? "Henüz kayıt girilmedi" + : "Toplam kayıt eklendi"}

- + - Aktif Görevler + + Aktif Görevler +
{pendingTasksCount}
-

- Bekleyen görev -

+

Bekleyen görev

- + - Bugünkü Enerji + + Bugünkü Enerji + @@ -121,7 +140,9 @@ export default function DashboardPage() { - Local AI Durumu + + Local AI Durumu + @@ -137,57 +158,128 @@ export default function DashboardPage() { {/* Line Chart */}
-

Ruh Hali & Enerji Trendi

-

Son 7 günlük ortalamalar (1-5 Arası Puanlama)

+

+ Ruh Hali & Enerji Trendi +

+

+ Son 7 günlük ortalamalar (1-5 Arası Puanlama) +

{trendData.length > 0 ? ( - - - - + + + - - - + + + ) : (
-

Veri bekleniyor...

+

+ Veri bekleniyor... +

)}
- + {/* Bar Chart & Insight */}

AI Konu Dağılımı

-

Günlüklerinden çıkarılan en sık 5 etiket

+

+ Günlüklerinden çıkarılan en sık 5 etiket +

{tagData.length > 0 ? ( - - + + - - + + - ) : (
-

Yeterli etiket yok.

+

+ Yeterli etiket yok. +

)}
@@ -198,7 +290,9 @@ export default function DashboardPage() { Son AI İçgörüsü

- {lastInsight ? `"${lastInsight}"` : "Henüz bir içgörü oluşmadı. Biraz günlük yaz, AI analiz yapsın."} + {lastInsight + ? `"${lastInsight}"` + : "Henüz bir içgörü oluşmadı. Biraz günlük yaz, AI analiz yapsın."}

diff --git a/app/tasks/page.tsx b/app/tasks/page.tsx index e48c603..8921c91 100644 --- a/app/tasks/page.tsx +++ b/app/tasks/page.tsx @@ -4,7 +4,13 @@ import { useState } from "react"; import { v4 as uuidv4 } from "uuid"; import { useLiveQuery } from "dexie-react-hooks"; import { db } from "@/lib/db"; -import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; +import { + Card, + CardContent, + CardHeader, + CardTitle, + CardDescription, +} from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Checkbox } from "@/components/ui/checkbox"; @@ -14,7 +20,7 @@ export default function TasksPage() { const [title, setTitle] = useState(""); const tasks = useLiveQuery( - () => db.tasks.toArray() // Şimdilik hepsini çekiyoruz, sıralama yapılabilir + () => db.tasks.toArray(), // Şimdilik hepsini çekiyoruz, sıralama yapılabilir ); const handleAddTask = async (e: React.FormEvent) => { @@ -48,14 +54,18 @@ export default function TasksPage() { await db.tasks.delete(id); }; - const pendingTasks = tasks?.filter(t => t.status === "todo") || []; - const completedTasks = tasks?.filter(t => t.status === "completed") || []; + const pendingTasks = tasks?.filter((t) => t.status === "todo") || []; + const completedTasks = tasks?.filter((t) => t.status === "completed") || []; return (
-

Görevler & Planlar

-

Kişisel hedeflerin ve YZ tarafından önerilen aksiyonlar.

+

+ Görevler & Planlar +

+

+ Kişisel hedeflerin ve YZ tarafından önerilen aksiyonlar. +

@@ -65,8 +75,8 @@ export default function TasksPage() {
- setTitle(e.target.value)} className="flex-1" @@ -80,21 +90,36 @@ export default function TasksPage() { {/* Yapılacaklar */}

- Yapılacaklar {pendingTasks.length} + Yapılacaklar{" "} + + {pendingTasks.length} +

{pendingTasks.length === 0 ? ( -

Bekleyen görev yok.

+

+ Bekleyen görev yok. +

) : ( - pendingTasks.map(task => ( -
- toggleTaskStatus(task.id, task.status)} + pendingTasks.map((task) => ( +
+ + toggleTaskStatus(task.id, task.status) + } className="w-5 h-5" /> - {task.title} -
@@ -106,21 +131,36 @@ export default function TasksPage() { {/* Tamamlananlar */}

- Tamamlananlar {completedTasks.length} + Tamamlananlar{" "} + + {completedTasks.length} +

{completedTasks.length === 0 ? ( -

Hiç görev tamamlanmadı.

+

+ Hiç görev tamamlanmadı. +

) : ( - completedTasks.map(task => ( -
- toggleTaskStatus(task.id, task.status)} + completedTasks.map((task) => ( +
+ + toggleTaskStatus(task.id, task.status) + } className="w-5 h-5 data-[state=checked]:bg-muted-foreground data-[state=checked]:border-muted-foreground" /> - {task.title} -
diff --git a/components/layout/sidebar.tsx b/components/layout/sidebar.tsx index c6b38a0..83902b2 100644 --- a/components/layout/sidebar.tsx +++ b/components/layout/sidebar.tsx @@ -2,7 +2,14 @@ import Link from "next/link"; import { usePathname } from "next/navigation"; -import { LayoutDashboard, Book, CheckSquare, MessageCircle, Settings, BrainCircuit } from "lucide-react"; +import { + LayoutDashboard, + Book, + CheckSquare, + MessageCircle, + Settings, + BrainCircuit, +} from "lucide-react"; import { cn } from "@/lib/utils"; const routes = [ @@ -24,10 +31,12 @@ export function Sidebar() {