mirror of
https://github.com/Tony0410/quietthanks.git
synced 2026-05-25 05:41:38 +08:00
Add user authentication with login/register
- Add users and sessions tables to database schema - Add bcryptjs for password hashing - Create auth API routes (login, register, logout, me) - Add AuthProvider context for client-side auth state - Update all API routes to require authentication and filter by userId - Create login and register pages - Add AppShell component for authenticated layout - Update all pages to use AppShell and show user info - Each user now has their own private entries and tags Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import { AppShell } from "@/components/AppShell";
|
||||
import { useAuth } from "@/components/AuthProvider";
|
||||
import { APP_NAME } from "@/lib/constants";
|
||||
import { LogOut } from "lucide-react";
|
||||
|
||||
export default function SettingsPage() {
|
||||
const { user, logout } = useAuth();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<AppShell>
|
||||
<header className="mb-8">
|
||||
<h1 className="text-2xl font-light">{APP_NAME}</h1>
|
||||
<p className="text-sm text-muted">Settings</p>
|
||||
</header>
|
||||
|
||||
<div className="space-y-6">
|
||||
{/* Account info */}
|
||||
{user && (
|
||||
<div className="p-4 bg-surface border border-border rounded-xl">
|
||||
<h3 className="font-medium mb-1">Account</h3>
|
||||
<p className="text-sm text-muted">{user.email}</p>
|
||||
{user.name && <p className="text-sm text-muted">{user.name}</p>}
|
||||
<button
|
||||
onClick={logout}
|
||||
className="mt-3 flex items-center gap-2 text-sm text-red-400 hover:text-red-300"
|
||||
>
|
||||
<LogOut size={16} />
|
||||
Sign out
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Notifications - disabled in MVP */}
|
||||
<div className="p-4 bg-surface border border-border rounded-xl opacity-50">
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -68,6 +91,6 @@ export default function SettingsPage() {
|
||||
<p className="mt-1">A calm, private gratitude log.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user