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:
@ -34,7 +34,7 @@ export function AttachmentList({
|
||||
return (
|
||||
<li
|
||||
key={a.id}
|
||||
className="overflow-hidden rounded border bg-gray-50"
|
||||
className="overflow-hidden rounded border bg-gray-50 dark:bg-gray-900"
|
||||
data-testid={`attachment-${a.id}`}
|
||||
>
|
||||
{isImage ? (
|
||||
|
||||
@ -98,7 +98,7 @@ export const AttachmentPicker = forwardRef<
|
||||
|
||||
return (
|
||||
<div className="space-y-2" data-testid="attachment-picker">
|
||||
<label className="inline-flex cursor-pointer items-center gap-1 rounded border bg-white px-3 py-1 text-sm text-gray-600 hover:bg-gray-100">
|
||||
<label className="inline-flex cursor-pointer items-center gap-1 rounded border bg-white dark:bg-gray-800 px-3 py-1 text-sm text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
📎 添付
|
||||
<input
|
||||
ref={inputRef}
|
||||
@ -111,7 +111,10 @@ export const AttachmentPicker = forwardRef<
|
||||
/>
|
||||
</label>
|
||||
{loading && (
|
||||
<p className="text-xs text-gray-500" data-testid="attachment-loading">
|
||||
<p
|
||||
className="text-xs text-gray-500 dark:text-gray-400"
|
||||
data-testid="attachment-loading"
|
||||
>
|
||||
アップロード中...
|
||||
</p>
|
||||
)}
|
||||
@ -128,7 +131,7 @@ export const AttachmentPicker = forwardRef<
|
||||
return (
|
||||
<li
|
||||
key={f.fileId}
|
||||
className="relative overflow-hidden rounded border bg-gray-50"
|
||||
className="relative overflow-hidden rounded border bg-gray-50 dark:bg-gray-900"
|
||||
data-testid={`attachment-picked-${f.fileId}`}
|
||||
>
|
||||
{isImage ? (
|
||||
|
||||
@ -20,7 +20,11 @@ export function FileList({
|
||||
}
|
||||
|
||||
if (files.length === 0) {
|
||||
return <p className="text-sm text-gray-400">ファイルはありません。</p>;
|
||||
return (
|
||||
<p className="text-sm text-gray-400 dark:text-gray-500">
|
||||
ファイルはありません。
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@ -36,7 +40,7 @@ export function FileList({
|
||||
return (
|
||||
<li
|
||||
key={file.id}
|
||||
className="rounded-lg border bg-white p-3 shadow-sm"
|
||||
className="rounded-lg border bg-white dark:bg-gray-800 p-3 shadow-sm"
|
||||
data-testid={`file-item-${file.id}`}
|
||||
>
|
||||
{isImage ? (
|
||||
@ -56,25 +60,27 @@ export function FileList({
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="flex h-24 items-center justify-center rounded bg-gray-100 text-sm text-blue-600 hover:underline"
|
||||
className="flex h-24 items-center justify-center rounded bg-gray-100 dark:bg-gray-700 text-sm text-blue-600 hover:underline"
|
||||
>
|
||||
PDF を開く
|
||||
</a>
|
||||
) : (
|
||||
<a
|
||||
href={url}
|
||||
className="flex h-24 items-center justify-center rounded bg-gray-100 text-sm text-blue-600 hover:underline"
|
||||
className="flex h-24 items-center justify-center rounded bg-gray-100 dark:bg-gray-700 text-sm text-blue-600 hover:underline"
|
||||
>
|
||||
ダウンロード
|
||||
</a>
|
||||
)}
|
||||
<p
|
||||
className="mt-2 truncate text-xs text-gray-700"
|
||||
className="mt-2 truncate text-xs text-gray-700 dark:text-gray-200"
|
||||
title={file.originalName}
|
||||
>
|
||||
{file.originalName}
|
||||
</p>
|
||||
<p className="text-xs text-gray-400">{file.size} bytes</p>
|
||||
<p className="text-xs text-gray-400 dark:text-gray-500">
|
||||
{file.size} bytes
|
||||
</p>
|
||||
{canDelete && (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@ -33,7 +33,7 @@ export function Uploader({ projectId }: { projectId: number }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border bg-white p-4 shadow-sm">
|
||||
<div className="rounded-lg border bg-white dark:bg-gray-800 p-4 shadow-sm">
|
||||
<label className="block text-sm font-medium">
|
||||
ファイルをアップロード
|
||||
</label>
|
||||
@ -46,7 +46,9 @@ export function Uploader({ projectId }: { projectId: number }) {
|
||||
data-testid="file-input"
|
||||
/>
|
||||
{loading && (
|
||||
<p className="mt-1 text-sm text-gray-500">アップロード中...</p>
|
||||
<p className="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
アップロード中...
|
||||
</p>
|
||||
)}
|
||||
{error && (
|
||||
<p className="mt-1 text-sm text-red-600" role="alert">
|
||||
|
||||
Reference in New Issue
Block a user