feat(ux): dark/light theme + en/ja i18n + user preferences
UX全体にテーマと言語設定を追加。 - lib/db/migrations/004_user_prefs.sql: users に theme/locale 列を追加(既定 dark/en) - lib/i18n/: dictionary(en/ja) + I18nProvider(クライアントcontext: locale/theme/t/setLocale/setTheme) + server.ts(SSR用 getLocale/getTheme/translate) + constants.ts - app/layout.tsx: theme/locale Cookie を読み <html class/lang> をSSR、I18nProvider でラップ(フラッシュなし) - tailwind darkMode:'class' + 全画面に dark: バリアントを一括付与(Nodeスクリプト lookbehind で安全に変換) - components/layout/ThemeToggle: 即時クラス切替+Cookie+永続化 - app/profile: テーマ/言語セレクタ、chrome翻訳(Header/ProjectNav/login/dashboard/profile) - PATCH /api/users/me: theme/locale を受理(バリデーション→400)、Cookieを設定 - E2E: locale=ja storageState で既存JAアサーションを維持、theme-i18n.spec で既定en/darkと切替を検証
This commit is contained in:
@ -4,6 +4,7 @@ import { createDashboardService } from '@/lib/api/services';
|
||||
import { Header } from '@/components/layout/Header';
|
||||
import { CreateProjectForm } from '@/components/project/CreateProjectForm';
|
||||
import { DashboardWidget } from '@/components/project/DashboardWidget';
|
||||
import { getLocale, translate } from '@/lib/i18n/server';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@ -15,20 +16,26 @@ export default async function DashboardPage() {
|
||||
|
||||
const service = createDashboardService();
|
||||
const dashboard = service.getPersonalDashboard(user.id);
|
||||
const locale = await getLocale();
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
|
||||
<Header user={toPublicUser(user)} />
|
||||
<main className="mx-auto max-w-4xl space-y-6 p-6">
|
||||
<h1 className="text-2xl font-bold">ダッシュボード</h1>
|
||||
<h1 className="text-2xl font-bold">
|
||||
{translate('page.dashboard', locale)}
|
||||
</h1>
|
||||
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<DashboardWidget title="参加プロジェクト" empty="ありません">
|
||||
<DashboardWidget
|
||||
title={translate('dash.projects', locale)}
|
||||
empty={translate('dash.empty', locale)}
|
||||
>
|
||||
{dashboard.projects.map((p) => (
|
||||
<a
|
||||
key={p.id}
|
||||
href={`/projects/${p.id}`}
|
||||
className="block rounded border px-3 py-2 text-sm hover:bg-gray-50"
|
||||
className="block rounded border px-3 py-2 text-sm hover:bg-gray-50 dark:border-gray-700 dark:hover:bg-gray-800"
|
||||
>
|
||||
{p.name}({p.status})
|
||||
</a>
|
||||
@ -36,35 +43,46 @@ export default async function DashboardPage() {
|
||||
</DashboardWidget>
|
||||
|
||||
<DashboardWidget
|
||||
title={`未読通知 (${dashboard.unreadNotificationCount})`}
|
||||
empty="未読はありません"
|
||||
title={`${translate('dash.unreadNotifications', locale)} (${dashboard.unreadNotificationCount})`}
|
||||
empty={translate('dash.noUnread', locale)}
|
||||
>
|
||||
<a
|
||||
href="/notifications"
|
||||
className="text-sm text-blue-600 hover:underline"
|
||||
className="text-sm text-blue-600 hover:underline dark:text-blue-400"
|
||||
>
|
||||
通知一覧を開く
|
||||
{translate('dash.openNotifications', locale)}
|
||||
</a>
|
||||
</DashboardWidget>
|
||||
|
||||
<DashboardWidget title="未完了ToDo" empty="ありません">
|
||||
<DashboardWidget
|
||||
title={translate('dash.incompleteTodos', locale)}
|
||||
empty={translate('dash.empty', locale)}
|
||||
>
|
||||
{dashboard.incompleteTodos.map((t) => (
|
||||
<p key={t.id} className="text-sm">
|
||||
{t.title}
|
||||
{t.dueDate ? `(期限: ${t.dueDate})` : ''}
|
||||
{t.dueDate
|
||||
? `(${translate('dash.due', locale)}: ${t.dueDate})`
|
||||
: ''}
|
||||
</p>
|
||||
))}
|
||||
</DashboardWidget>
|
||||
|
||||
<DashboardWidget title="期限切れタスク" empty="ありません">
|
||||
<DashboardWidget
|
||||
title={translate('dash.overdueTasks', locale)}
|
||||
empty={translate('dash.empty', locale)}
|
||||
>
|
||||
{dashboard.overdueTasks.map((t) => (
|
||||
<p key={t.id} className="text-sm text-red-600">
|
||||
{t.title}(期限: {t.dueDate})
|
||||
{t.title}({translate('dash.due', locale)}: {t.dueDate})
|
||||
</p>
|
||||
))}
|
||||
</DashboardWidget>
|
||||
|
||||
<DashboardWidget title="近日中のミーティング" empty="ありません">
|
||||
<DashboardWidget
|
||||
title={translate('dash.upcomingMeetings', locale)}
|
||||
empty={translate('dash.empty', locale)}
|
||||
>
|
||||
{dashboard.upcomingMeetings.map((m) => (
|
||||
<p key={m.id} className="text-sm">
|
||||
{m.title}({m.startAt})
|
||||
@ -72,7 +90,10 @@ export default async function DashboardPage() {
|
||||
))}
|
||||
</DashboardWidget>
|
||||
|
||||
<DashboardWidget title="最近のアクティビティ" empty="ありません">
|
||||
<DashboardWidget
|
||||
title={translate('dash.recentActivity', locale)}
|
||||
empty={translate('dash.empty', locale)}
|
||||
>
|
||||
{dashboard.recentActivity.map((l) => (
|
||||
<p key={l.id} className="text-sm">
|
||||
{l.action}({l.targetType})
|
||||
|
||||
Reference in New Issue
Block a user