From 8c7d882dfa67bcef37a4f39be6f1ca57f160b816 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 12 Aug 2024 00:32:06 +0900 Subject: feat(frontend): improve play page styling --- frontend/app/components/GolfPlayApp.client.tsx | 8 +++ .../components/GolfPlayApps/GolfPlayAppGaming.tsx | 65 +++++++++++++--------- frontend/app/routes/_index.tsx | 2 +- frontend/app/routes/dashboard.tsx | 4 +- frontend/app/routes/golf.$gameId.play.tsx | 7 ++- frontend/app/tailwind.css | 6 ++ 6 files changed, 60 insertions(+), 32 deletions(-) (limited to 'frontend') diff --git a/frontend/app/components/GolfPlayApp.client.tsx b/frontend/app/components/GolfPlayApp.client.tsx index 4aebd52..ef3a229 100644 --- a/frontend/app/components/GolfPlayApp.client.tsx +++ b/frontend/app/components/GolfPlayApp.client.tsx @@ -12,14 +12,17 @@ type GamePlayerMessageS2C = components["schemas"]["GamePlayerMessageS2C"]; type GamePlayerMessageC2S = components["schemas"]["GamePlayerMessageC2S"]; type Game = components["schemas"]["Game"]; +type User = components["schemas"]["User"]; type GameState = "connecting" | "waiting" | "starting" | "gaming" | "finished"; export default function GolfPlayApp({ game, + player, sockToken, }: { game: Game; + player: User; sockToken: string; }) { const socketUrl = @@ -83,6 +86,9 @@ export default function GolfPlayApp({ }, 1000); const onCodeSubmit = useDebouncedCallback((code: string) => { + if (code === "") { + return; + } console.log("player:c2s:submit"); sendJsonMessage({ type: "player:c2s:submit", @@ -171,6 +177,8 @@ export default function GolfPlayApp({ } else if (gameState === "gaming") { return ( void; @@ -10,6 +15,8 @@ type Props = { }; export default function GolfPlayAppGaming({ + gameDisplayName, + playerDisplayName, problemTitle, problemDescription, onCodeChange, @@ -30,34 +37,40 @@ export default function GolfPlayAppGaming({ }; return ( -
-
-
-
-
{problemTitle}
-
{problemDescription}
-
-
-
-
- Score: {currentScore ?? "-"} ({lastExecStatus ?? "-"}) -
-
- +
+
+
+
{gameDisplayName}
+
03:21
+
+
+ + {playerDisplayName} + +
+
+
+
+
{problemTitle}
+
+ +
{problemDescription}
+
-
-
- +
+ +
+
+ 提出 +
+
+ Score: {currentScore ?? "-"} ({lastExecStatus ?? "-"}) +
diff --git a/frontend/app/routes/_index.tsx b/frontend/app/routes/_index.tsx index 9be594f..24fff9f 100644 --- a/frontend/app/routes/_index.tsx +++ b/frontend/app/routes/_index.tsx @@ -22,7 +22,7 @@ export default function Index() { className="w-24 h-24" />
-
+
iOSDC Japan 2024
Swift Code Battle
diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx index 4c751d9..99c64f2 100644 --- a/frontend/app/routes/dashboard.tsx +++ b/frontend/app/routes/dashboard.tsx @@ -31,8 +31,8 @@ export default function Dashboard() { return (
-

- {user.display_name} +

+ {user.display_name} @{user.username}

試合

diff --git a/frontend/app/routes/golf.$gameId.play.tsx b/frontend/app/routes/golf.$gameId.play.tsx index 3712df2..ea1b8fd 100644 --- a/frontend/app/routes/golf.$gameId.play.tsx +++ b/frontend/app/routes/golf.$gameId.play.tsx @@ -15,7 +15,7 @@ export const meta: MetaFunction = ({ data }) => [ ]; export async function loader({ params, request }: LoaderFunctionArgs) { - const { token } = await ensureUserLoggedIn(request); + const { token, user } = await ensureUserLoggedIn(request); const fetchGame = async () => { return (await apiGetGame(token, Number(params.gameId))).game; @@ -27,16 +27,17 @@ export async function loader({ params, request }: LoaderFunctionArgs) { const [game, sockToken] = await Promise.all([fetchGame(), fetchSockToken()]); return { game, + player: user, sockToken, }; } export default function GolfPlay() { - const { game, sockToken } = useLoaderData(); + const { game, player, sockToken } = useLoaderData(); return ( }> - {() => } + {() => } ); } diff --git a/frontend/app/tailwind.css b/frontend/app/tailwind.css index b5c61c9..6d3faee 100644 --- a/frontend/app/tailwind.css +++ b/frontend/app/tailwind.css @@ -1,3 +1,9 @@ @tailwind base; @tailwind components; @tailwind utilities; + +@layer components { + .bg-iosdc-japan { + @apply bg-gradient-to-r from-orange-400 via-pink-500 to-purple-400; + } +} -- cgit v1.2.3-70-g09d2