aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/pages/DashboardPage.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-03-06 02:18:40 +0900
committernsfisis <nsfisis@gmail.com>2026-03-06 02:18:40 +0900
commit46f9ba5d8c295454381655e6ec02ad3cf8bd79db (patch)
treec54719cb129ee05f96c4898219588062f71daa36 /frontend/app/pages/DashboardPage.tsx
parent27f509ccf4fbfeaa1bc2580ae2251461dc44ebfa (diff)
downloadphperkaigi-2026-albatross-46f9ba5d8c295454381655e6ec02ad3cf8bd79db.tar.gz
phperkaigi-2026-albatross-46f9ba5d8c295454381655e6ec02ad3cf8bd79db.tar.zst
phperkaigi-2026-albatross-46f9ba5d8c295454381655e6ec02ad3cf8bd79db.zip
style: switch from tab to space indentation in frontend and worker/php
Update biome.json indentStyle from "tab" to "space" and reformat all files in both workspaces. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontend/app/pages/DashboardPage.tsx')
-rw-r--r--frontend/app/pages/DashboardPage.tsx202
1 files changed, 101 insertions, 101 deletions
diff --git a/frontend/app/pages/DashboardPage.tsx b/frontend/app/pages/DashboardPage.tsx
index 54bfdd6..74be96e 100644
--- a/frontend/app/pages/DashboardPage.tsx
+++ b/frontend/app/pages/DashboardPage.tsx
@@ -12,111 +12,111 @@ import { usePageTitle } from "../hooks/usePageTitle";
type Game = components["schemas"]["Game"];
export default function DashboardPage() {
- usePageTitle(`Dashboard | ${APP_NAME}`);
+ usePageTitle(`Dashboard | ${APP_NAME}`);
- const { user, isLoggedIn, isLoading: authLoading, logout } = useAuth();
- const [, navigate] = useLocation();
+ const { user, isLoggedIn, isLoading: authLoading, logout } = useAuth();
+ const [, navigate] = useLocation();
- const [games, setGames] = useState<Game[]>([]);
- const [loading, setLoading] = useState(true);
+ const [games, setGames] = useState<Game[]>([]);
+ const [loading, setLoading] = useState(true);
- useEffect(() => {
- const apiClient = createApiClient();
- apiClient
- .getGames()
- .then(({ games }) => setGames(games))
- .finally(() => setLoading(false));
- }, []);
+ useEffect(() => {
+ const apiClient = createApiClient();
+ apiClient
+ .getGames()
+ .then(({ games }) => setGames(games))
+ .finally(() => setLoading(false));
+ }, []);
- async function handleLogout() {
- await logout();
- navigate("/");
- }
+ async function handleLogout() {
+ await logout();
+ navigate("/");
+ }
- if (loading || authLoading) {
- return (
- <div className="min-h-screen bg-gray-100 flex items-center justify-center">
- <p className="text-gray-500">Loading...</p>
- </div>
- );
- }
+ if (loading || authLoading) {
+ return (
+ <div className="min-h-screen bg-gray-100 flex items-center justify-center">
+ <p className="text-gray-500">Loading...</p>
+ </div>
+ );
+ }
- return (
- <div className="p-6 bg-gray-100 min-h-screen flex flex-col items-center gap-4">
- {isLoggedIn && user?.icon_path && (
- <UserIcon
- iconPath={user.icon_path}
- displayName={user.display_name}
- className="w-24 h-24"
- />
- )}
- {isLoggedIn ? (
- <h1 className="text-3xl font-bold text-gray-800">
- {user?.display_name}
- </h1>
- ) : (
- <h1 className="text-3xl font-bold text-gray-800">試合一覧</h1>
- )}
- <BorderedContainerWithCaption caption="試合一覧">
- <div className="px-4">
- {games.length === 0 ? (
- <p>試合はありません</p>
- ) : (
- <ul className="divide-y divide-gray-300">
- {games.map((game) => (
- <li
- key={game.game_id}
- className="flex justify-between items-center py-2 gap-4"
- >
- <div>
- <span className="font-medium text-gray-800">
- {game.display_name}
- </span>
- </div>
- <div className="flex gap-2">
- {isLoggedIn && game.started_at == null && (
- <NavigateLink to={`/golf/${game.game_id}/preview`}>
- 問題を見る
- </NavigateLink>
- )}
- {isLoggedIn && (
- <NavigateLink to={`/golf/${game.game_id}/play`}>
- 対戦
- </NavigateLink>
- )}
- <NavigateLink to={`/golf/${game.game_id}/watch`}>
- 観戦
- </NavigateLink>
- </div>
- </li>
- ))}
- </ul>
- )}
- </div>
- </BorderedContainerWithCaption>
- {isLoggedIn ? (
- <button
- type="button"
- onClick={handleLogout}
- className="px-4 py-2 bg-red-500 text-white rounded-sm transition duration-300 hover:bg-red-700 focus:ring-3 focus:ring-red-400 focus:outline-hidden"
- >
- ログアウト
- </button>
- ) : (
- <NavigateLink to="/login">ログイン</NavigateLink>
- )}
- {isLoggedIn && user?.is_admin && (
- <a
- href={
- import.meta.env.DEV
- ? `http://localhost:8007${BASE_PATH}admin/dashboard`
- : `${BASE_PATH}admin/dashboard`
- }
- className="text-lg text-white bg-brand-600 px-4 py-2 rounded-sm transition duration-300 hover:bg-brand-500 focus:ring-3 focus:ring-brand-400 focus:outline-hidden"
- >
- Admin Dashboard
- </a>
- )}
- </div>
- );
+ return (
+ <div className="p-6 bg-gray-100 min-h-screen flex flex-col items-center gap-4">
+ {isLoggedIn && user?.icon_path && (
+ <UserIcon
+ iconPath={user.icon_path}
+ displayName={user.display_name}
+ className="w-24 h-24"
+ />
+ )}
+ {isLoggedIn ? (
+ <h1 className="text-3xl font-bold text-gray-800">
+ {user?.display_name}
+ </h1>
+ ) : (
+ <h1 className="text-3xl font-bold text-gray-800">試合一覧</h1>
+ )}
+ <BorderedContainerWithCaption caption="試合一覧">
+ <div className="px-4">
+ {games.length === 0 ? (
+ <p>試合はありません</p>
+ ) : (
+ <ul className="divide-y divide-gray-300">
+ {games.map((game) => (
+ <li
+ key={game.game_id}
+ className="flex justify-between items-center py-2 gap-4"
+ >
+ <div>
+ <span className="font-medium text-gray-800">
+ {game.display_name}
+ </span>
+ </div>
+ <div className="flex gap-2">
+ {isLoggedIn && game.started_at == null && (
+ <NavigateLink to={`/golf/${game.game_id}/preview`}>
+ 問題を見る
+ </NavigateLink>
+ )}
+ {isLoggedIn && (
+ <NavigateLink to={`/golf/${game.game_id}/play`}>
+ 対戦
+ </NavigateLink>
+ )}
+ <NavigateLink to={`/golf/${game.game_id}/watch`}>
+ 観戦
+ </NavigateLink>
+ </div>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+ </BorderedContainerWithCaption>
+ {isLoggedIn ? (
+ <button
+ type="button"
+ onClick={handleLogout}
+ className="px-4 py-2 bg-red-500 text-white rounded-sm transition duration-300 hover:bg-red-700 focus:ring-3 focus:ring-red-400 focus:outline-hidden"
+ >
+ ログアウト
+ </button>
+ ) : (
+ <NavigateLink to="/login">ログイン</NavigateLink>
+ )}
+ {isLoggedIn && user?.is_admin && (
+ <a
+ href={
+ import.meta.env.DEV
+ ? `http://localhost:8007${BASE_PATH}admin/dashboard`
+ : `${BASE_PATH}admin/dashboard`
+ }
+ className="text-lg text-white bg-brand-600 px-4 py-2 rounded-sm transition duration-300 hover:bg-brand-500 focus:ring-3 focus:ring-brand-400 focus:outline-hidden"
+ >
+ Admin Dashboard
+ </a>
+ )}
+ </div>
+ );
}