From 8f2cceacc8fde328033de7f05bb12e7b1246dd86 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 1 Aug 2024 22:22:12 +0900 Subject: chore(frontend): [biome] format --- frontend/app/routes/_index.tsx | 36 +++--- frontend/app/routes/admin.dashboard.tsx | 38 +++--- frontend/app/routes/admin.games.tsx | 52 ++++---- frontend/app/routes/admin.games_.$gameId.tsx | 172 +++++++++++++-------------- frontend/app/routes/admin.users.tsx | 50 ++++---- frontend/app/routes/dashboard.tsx | 122 +++++++++---------- frontend/app/routes/golf.$gameId.play.tsx | 54 ++++----- frontend/app/routes/golf.$gameId.watch.tsx | 54 ++++----- frontend/app/routes/login.tsx | 116 +++++++++--------- frontend/app/routes/logout.tsx | 4 +- 10 files changed, 349 insertions(+), 349 deletions(-) (limited to 'frontend/app/routes') diff --git a/frontend/app/routes/_index.tsx b/frontend/app/routes/_index.tsx index b5951ab..c56d4b2 100644 --- a/frontend/app/routes/_index.tsx +++ b/frontend/app/routes/_index.tsx @@ -2,25 +2,25 @@ import type { MetaFunction } from "@remix-run/node"; import { Link } from "@remix-run/react"; export const meta: MetaFunction = () => { - return [{ title: "iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "iOSDC Japan 2024 Albatross.swift" }]; }; export default function Index() { - return ( -
-
-

- iOSDC Japan 2024 Albatross.swift -

-

- - Login - -

-
-
- ); + return ( +
+
+

+ iOSDC Japan 2024 Albatross.swift +

+

+ + Login + +

+
+
+ ); } diff --git a/frontend/app/routes/admin.dashboard.tsx b/frontend/app/routes/admin.dashboard.tsx index 1d172af..ce3e910 100644 --- a/frontend/app/routes/admin.dashboard.tsx +++ b/frontend/app/routes/admin.dashboard.tsx @@ -3,29 +3,29 @@ import { Link } from "@remix-run/react"; import { isAuthenticated } from "../.server/auth"; export const meta: MetaFunction = () => { - return [{ title: "[Admin] Dashboard | iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "[Admin] Dashboard | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } - return null; + const { user } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + return null; } export default function AdminDashboard() { - return ( -
-

[Admin] Dashboard

-

- Users -

-

- Games -

-
- ); + return ( +
+

[Admin] Dashboard

+

+ Users +

+

+ Games +

+
+ ); } diff --git a/frontend/app/routes/admin.games.tsx b/frontend/app/routes/admin.games.tsx index adba7f5..af3554e 100644 --- a/frontend/app/routes/admin.games.tsx +++ b/frontend/app/routes/admin.games.tsx @@ -4,37 +4,37 @@ import { adminApiGetGames } from "../.server/api/client"; import { isAuthenticated } from "../.server/auth"; export const meta: MetaFunction = () => { - return [{ title: "[Admin] Games | iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "[Admin] Games | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } - const { games } = await adminApiGetGames(token); - return { games }; + const { user, token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + const { games } = await adminApiGetGames(token); + return { games }; } export default function AdminGames() { - const { games } = useLoaderData()!; + const { games } = useLoaderData()!; - return ( -
-
-

[Admin] Games

-
    - {games.map((game) => ( -
  • - - {game.display_name} (id={game.game_id}) - -
  • - ))} -
-
-
- ); + return ( +
+
+

[Admin] Games

+
    + {games.map((game) => ( +
  • + + {game.display_name} (id={game.game_id}) + +
  • + ))} +
+
+
+ ); } diff --git a/frontend/app/routes/admin.games_.$gameId.tsx b/frontend/app/routes/admin.games_.$gameId.tsx index a7bd651..34860ab 100644 --- a/frontend/app/routes/admin.games_.$gameId.tsx +++ b/frontend/app/routes/admin.games_.$gameId.tsx @@ -1,107 +1,107 @@ import type { - ActionFunctionArgs, - LoaderFunctionArgs, - MetaFunction, + ActionFunctionArgs, + LoaderFunctionArgs, + MetaFunction, } from "@remix-run/node"; import { Form, useLoaderData } from "@remix-run/react"; import { adminApiGetGame, adminApiPutGame } from "../.server/api/client"; import { isAuthenticated } from "../.server/auth"; export const meta: MetaFunction = ({ data }) => { - return [ - { - title: data - ? `[Admin] Game Edit ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` - : "[Admin] Game Edit | iOSDC Japan 2024 Albatross.swift", - }, - ]; + return [ + { + title: data + ? `[Admin] Game Edit ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` + : "[Admin] Game Edit | iOSDC Japan 2024 Albatross.swift", + }, + ]; }; export async function loader({ request, params }: LoaderFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } - const { gameId } = params; - const { game } = await adminApiGetGame(token, Number(gameId)); - return { game }; + const { user, token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + const { gameId } = params; + const { game } = await adminApiGetGame(token, Number(gameId)); + return { game }; } export async function action({ request, params }: ActionFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } - const { gameId } = params; + const { user, token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + const { gameId } = params; - const formData = await request.formData(); - const action = formData.get("action"); + const formData = await request.formData(); + const action = formData.get("action"); - const nextState = - action === "open" - ? "waiting_entries" - : action === "start" - ? "prepare" - : null; - if (!nextState) { - throw new Error("Invalid action"); - } + const nextState = + action === "open" + ? "waiting_entries" + : action === "start" + ? "prepare" + : null; + if (!nextState) { + throw new Error("Invalid action"); + } - await adminApiPutGame(token, Number(gameId), { - state: nextState, - }); - return null; + await adminApiPutGame(token, Number(gameId), { + state: nextState, + }); + return null; } export default function AdminGameEdit() { - const { game } = useLoaderData()!; + const { game } = useLoaderData()!; - return ( -
-
-

[Admin] Game Edit {game.display_name}

-
    -
  • ID: {game.game_id}
  • -
  • State: {game.state}
  • -
  • Display Name: {game.display_name}
  • -
  • Duration Seconds: {game.duration_seconds}
  • -
  • - Started At:{" "} - {game.started_at - ? new Date(game.started_at * 1000).toString() - : "-"} -
  • -
  • Problem ID: {game.problem ? game.problem.problem_id : "-"}
  • -
-
-
-
- -
-
- -
-
-
-
-
- ); + return ( +
+
+

[Admin] Game Edit {game.display_name}

+
    +
  • ID: {game.game_id}
  • +
  • State: {game.state}
  • +
  • Display Name: {game.display_name}
  • +
  • Duration Seconds: {game.duration_seconds}
  • +
  • + Started At:{" "} + {game.started_at + ? new Date(game.started_at * 1000).toString() + : "-"} +
  • +
  • Problem ID: {game.problem ? game.problem.problem_id : "-"}
  • +
+
+
+
+ +
+
+ +
+
+
+
+
+ ); } diff --git a/frontend/app/routes/admin.users.tsx b/frontend/app/routes/admin.users.tsx index 8d9a8f2..9eed263 100644 --- a/frontend/app/routes/admin.users.tsx +++ b/frontend/app/routes/admin.users.tsx @@ -4,36 +4,36 @@ import { adminApiGetUsers } from "../.server/api/client"; import { isAuthenticated } from "../.server/auth"; export const meta: MetaFunction = () => { - return [{ title: "[Admin] Users | iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "[Admin] Users | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (!user.is_admin) { - throw new Error("Unauthorized"); - } - const { users } = await adminApiGetUsers(token); - return { users }; + const { user, token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + const { users } = await adminApiGetUsers(token); + return { users }; } export default function AdminUsers() { - const { users } = useLoaderData()!; + const { users } = useLoaderData()!; - return ( -
-
-

[Admin] Users

-
    - {users.map((user) => ( -
  • - {user.display_name} (id={user.user_id} username={user.username}) - {user.is_admin && admin} -
  • - ))} -
-
-
- ); + return ( +
+
+

[Admin] Users

+
    + {users.map((user) => ( +
  • + {user.display_name} (id={user.user_id} username={user.username}) + {user.is_admin && admin} +
  • + ))} +
+
+
+ ); } diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx index 1f80634..1c2137d 100644 --- a/frontend/app/routes/dashboard.tsx +++ b/frontend/app/routes/dashboard.tsx @@ -5,72 +5,72 @@ import { apiGetGames } from "../.server/api/client"; import { isAuthenticated } from "../.server/auth"; export const meta: MetaFunction = () => { - return [{ title: "Dashboard | iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "Dashboard | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - const { user, token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); - if (user.is_admin) { - return redirect("/admin/dashboard"); - } - const { games } = await apiGetGames(token); - return { - user, - games, - }; + const { user, token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (user.is_admin) { + return redirect("/admin/dashboard"); + } + const { games } = await apiGetGames(token); + return { + user, + games, + }; } export default function Dashboard() { - const { user, games } = useLoaderData()!; + const { user, games } = useLoaderData()!; - return ( -
-
-

- {user.username}{" "} - {user.is_admin && admin} -

-

User

-
-
    -
  • Name: {user.display_name}
  • -
-
-

Games

-
-
    - {games.map((game) => ( -
  • - {game.display_name}{" "} - {game.state === "closed" || game.state === "finished" ? ( - - Entry - - ) : ( - - Entry - - )} -
  • - ))} -
-
-
-
- -
-
-
-
- ); + return ( +
+
+

+ {user.username}{" "} + {user.is_admin && admin} +

+

User

+
+
    +
  • Name: {user.display_name}
  • +
+
+

Games

+
+
    + {games.map((game) => ( +
  • + {game.display_name}{" "} + {game.state === "closed" || game.state === "finished" ? ( + + Entry + + ) : ( + + Entry + + )} +
  • + ))} +
+
+
+
+ +
+
+
+
+ ); } diff --git a/frontend/app/routes/golf.$gameId.play.tsx b/frontend/app/routes/golf.$gameId.play.tsx index 0ce3353..d498200 100644 --- a/frontend/app/routes/golf.$gameId.play.tsx +++ b/frontend/app/routes/golf.$gameId.play.tsx @@ -7,40 +7,40 @@ import GolfPlayApp from "../components/GolfPlayApp.client"; import GolfPlayAppConnecting from "../components/GolfPlayApps/GolfPlayAppConnecting"; export const meta: MetaFunction = ({ data }) => { - return [ - { - title: data - ? `Golf Playing ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` - : "Golf Playing | iOSDC Japan 2024 Albatross.swift", - }, - ]; + return [ + { + title: data + ? `Golf Playing ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` + : "Golf Playing | iOSDC Japan 2024 Albatross.swift", + }, + ]; }; export async function loader({ params, request }: LoaderFunctionArgs) { - const { token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); + const { token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); - const fetchGame = async () => { - return (await apiGetGame(token, Number(params.gameId))).game; - }; - const fetchSockToken = async () => { - return (await apiGetToken(token)).token; - }; + const fetchGame = async () => { + return (await apiGetGame(token, Number(params.gameId))).game; + }; + const fetchSockToken = async () => { + return (await apiGetToken(token)).token; + }; - const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]); - return { - game, - sockToken, - }; + const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]); + return { + game, + sockToken, + }; } export default function GolfPlay() { - const { game, sockToken } = useLoaderData(); + const { game, sockToken } = useLoaderData(); - return ( - }> - {() => } - - ); + return ( + }> + {() => } + + ); } diff --git a/frontend/app/routes/golf.$gameId.watch.tsx b/frontend/app/routes/golf.$gameId.watch.tsx index 0f0e085..0203e27 100644 --- a/frontend/app/routes/golf.$gameId.watch.tsx +++ b/frontend/app/routes/golf.$gameId.watch.tsx @@ -7,40 +7,40 @@ import GolfWatchApp from "../components/GolfWatchApp.client"; import GolfWatchAppConnecting from "../components/GolfWatchApps/GolfWatchAppConnecting"; export const meta: MetaFunction = ({ data }) => { - return [ - { - title: data - ? `Golf Watching ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` - : "Golf Watching | iOSDC Japan 2024 Albatross.swift", - }, - ]; + return [ + { + title: data + ? `Golf Watching ${data.game.display_name} | iOSDC Japan 2024 Albatross.swift` + : "Golf Watching | iOSDC Japan 2024 Albatross.swift", + }, + ]; }; export async function loader({ params, request }: LoaderFunctionArgs) { - const { token } = await isAuthenticated(request, { - failureRedirect: "/login", - }); + const { token } = await isAuthenticated(request, { + failureRedirect: "/login", + }); - const fetchGame = async () => { - return (await apiGetGame(token, Number(params.gameId))).game; - }; - const fetchSockToken = async () => { - return (await apiGetToken(token)).token; - }; + const fetchGame = async () => { + return (await apiGetGame(token, Number(params.gameId))).game; + }; + const fetchSockToken = async () => { + return (await apiGetToken(token)).token; + }; - const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]); - return { - game, - sockToken, - }; + const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]); + return { + game, + sockToken, + }; } export default function GolfWatch() { - const { game, sockToken } = useLoaderData(); + const { game, sockToken } = useLoaderData(); - return ( - }> - {() => } - - ); + return ( + }> + {() => } + + ); } diff --git a/frontend/app/routes/login.tsx b/frontend/app/routes/login.tsx index f63df08..95effaa 100644 --- a/frontend/app/routes/login.tsx +++ b/frontend/app/routes/login.tsx @@ -1,74 +1,74 @@ import type { - ActionFunctionArgs, - LoaderFunctionArgs, - MetaFunction, + ActionFunctionArgs, + LoaderFunctionArgs, + MetaFunction, } from "@remix-run/node"; import { Form } from "@remix-run/react"; import { authenticator } from "../.server/auth"; export const meta: MetaFunction = () => { - return [{ title: "Login | iOSDC Japan 2024 Albatross.swift" }]; + return [{ title: "Login | iOSDC Japan 2024 Albatross.swift" }]; }; export async function loader({ request }: LoaderFunctionArgs) { - return await authenticator.isAuthenticated(request, { - successRedirect: "/dashboard", - }); + return await authenticator.isAuthenticated(request, { + successRedirect: "/dashboard", + }); } export async function action({ request }: ActionFunctionArgs) { - return await authenticator.authenticate("default", request, { - successRedirect: "/dashboard", - failureRedirect: "/login", - }); + return await authenticator.authenticate("default", request, { + successRedirect: "/dashboard", + failureRedirect: "/login", + }); } export default function Login() { - return ( -
-
-

Login

-
- - -
-
- - -
- -
-
- ); + return ( +
+
+

Login

+
+ + +
+
+ + +
+ +
+
+ ); } diff --git a/frontend/app/routes/logout.tsx b/frontend/app/routes/logout.tsx index 030bde0..012d9e9 100644 --- a/frontend/app/routes/logout.tsx +++ b/frontend/app/routes/logout.tsx @@ -2,6 +2,6 @@ import type { ActionFunctionArgs } from "@remix-run/node"; import { authenticator } from "../.server/auth"; export async function action({ request }: ActionFunctionArgs) { - await authenticator.logout(request, { redirectTo: "/" }); - return null; + await authenticator.logout(request, { redirectTo: "/" }); + return null; } -- cgit v1.2.3-70-g09d2