From 46f9ba5d8c295454381655e6ec02ad3cf8bd79db Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 6 Mar 2026 02:18:40 +0900 Subject: 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 --- .../GolfPlayApps/GolfPlayAppGaming.test.tsx | 168 ++++++------- .../components/GolfPlayApps/GolfPlayAppGaming.tsx | 272 ++++++++++----------- .../components/GolfPlayApps/GolfPlayAppLoading.tsx | 14 +- .../GolfPlayApps/GolfPlayAppStarting.tsx | 24 +- .../components/GolfPlayApps/GolfPlayAppWaiting.tsx | 28 +-- 5 files changed, 253 insertions(+), 253 deletions(-) (limited to 'frontend/app/components/GolfPlayApps') diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.test.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.test.tsx index 2d51d66..ae5381b 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.test.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.test.tsx @@ -5,103 +5,103 @@ import { cleanup, render, screen } from "@testing-library/react"; import { createStore, Provider } from "jotai"; import { afterEach, describe, expect, test } from "vitest"; import { - setCurrentTimestampAtom, - setDurationSecondsAtom, - setGameStartedAtAtom, - setLatestGameStateAtom, + setCurrentTimestampAtom, + setDurationSecondsAtom, + setGameStartedAtAtom, + setLatestGameStateAtom, } from "../../states/play"; import GolfPlayAppGaming from "./GolfPlayAppGaming"; afterEach(() => { - cleanup(); + cleanup(); }); function createTestStore() { - const store = createStore(); - const now = Math.floor(Date.now() / 1000); - store.set(setCurrentTimestampAtom); - store.set(setDurationSecondsAtom, 600); - store.set(setGameStartedAtAtom, now - 60); - store.set(setLatestGameStateAtom, { - status: "none", - code: "", - score: null, - best_score_submitted_at: null, - }); - return store; + const store = createStore(); + const now = Math.floor(Date.now() / 1000); + store.set(setCurrentTimestampAtom); + store.set(setDurationSecondsAtom, 600); + store.set(setGameStartedAtAtom, now - 60); + store.set(setLatestGameStateAtom, { + status: "none", + code: "", + score: null, + best_score_submitted_at: null, + }); + return store; } const defaultProps = { - gameDisplayName: "Test Game", - playerProfile: { - id: 1, - displayName: "Test Player", - iconPath: null, - }, - problemTitle: "Test Problem", - problemDescription: "Description", - problemLanguage: "php" as const, - sampleCode: " {}, - onCodeSubmit: () => {}, - isFinished: false, + gameDisplayName: "Test Game", + playerProfile: { + id: 1, + displayName: "Test Player", + iconPath: null, + }, + problemTitle: "Test Problem", + problemDescription: "Description", + problemLanguage: "php" as const, + sampleCode: " {}, + onCodeSubmit: () => {}, + isFinished: false, }; describe("GolfPlayAppGaming submission history", () => { - test("shows placeholder row when no submissions", () => { - const store = createTestStore(); - render( - - - , - ); - expect(screen.getByText("提出待ち")).toBeDefined(); - const dashes = screen.getAllByText("-"); - expect(dashes.length).toBe(3); - }); + test("shows placeholder row when no submissions", () => { + const store = createTestStore(); + render( + + + , + ); + expect(screen.getByText("提出待ち")).toBeDefined(); + const dashes = screen.getAllByText("-"); + expect(dashes.length).toBe(3); + }); - test("renders submission rows with status and code size", () => { - const store = createTestStore(); - const submissions = [ - { - submission_id: 1, - game_id: 1, - status: "success" as const, - code: " - - , - ); - expect(screen.getByText("成功")).toBeDefined(); - expect(screen.getByText("テスト失敗")).toBeDefined(); - expect(screen.getByText("7")).toBeDefined(); - expect(screen.getByText("10")).toBeDefined(); - }); + test("renders submission rows with status and code size", () => { + const store = createTestStore(); + const submissions = [ + { + submission_id: 1, + game_id: 1, + status: "success" as const, + code: " + + , + ); + expect(screen.getByText("成功")).toBeDefined(); + expect(screen.getByText("テスト失敗")).toBeDefined(); + expect(screen.getByText("7")).toBeDefined(); + expect(screen.getByText("10")).toBeDefined(); + }); - test("renders table headers", () => { - const store = createTestStore(); - render( - - - , - ); - expect(screen.getByText("ステータス")).toBeDefined(); - expect(screen.getByText("スコア")).toBeDefined(); - expect(screen.getByText("提出時刻")).toBeDefined(); - expect(screen.getByText("コード")).toBeDefined(); - }); + test("renders table headers", () => { + const store = createTestStore(); + render( + + + , + ); + expect(screen.getByText("ステータス")).toBeDefined(); + expect(screen.getByText("スコア")).toBeDefined(); + expect(screen.getByText("提出時刻")).toBeDefined(); + expect(screen.getByText("コード")).toBeDefined(); + }); }); diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx index e590df0..3e1ab67 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx @@ -3,18 +3,18 @@ import React, { useRef, useState } from "react"; import { Link } from "wouter"; import type { components } from "../../api/schema"; import { - calcCodeSize, - gamingLeftTimeSecondsAtom, - scoreAtom, - statusAtom, + calcCodeSize, + gamingLeftTimeSecondsAtom, + scoreAtom, + statusAtom, } from "../../states/play"; import type { PlayerProfile } from "../../types/PlayerProfile"; import type { SupportedLanguage } from "../../types/SupportedLanguage"; import BorderedContainer from "../BorderedContainer"; import CodePopover from "../Gaming/CodePopover"; import DataTable, { - DataTableCell, - formatUnixTimestamp, + DataTableCell, + formatUnixTimestamp, } from "../Gaming/DataTable"; import LeftTime from "../Gaming/LeftTime"; import ProblemColumn from "../Gaming/ProblemColumn"; @@ -27,142 +27,142 @@ import UserIcon from "../UserIcon"; type Submission = components["schemas"]["Submission"]; type Props = { - gameDisplayName: string; - playerProfile: PlayerProfile; - problemTitle: string; - problemDescription: string; - problemLanguage: SupportedLanguage; - sampleCode: string; - initialCode: string; - onCodeChange: (code: string) => void; - onCodeSubmit: (code: string) => void; - isFinished: boolean; - submissions: Submission[]; + gameDisplayName: string; + playerProfile: PlayerProfile; + problemTitle: string; + problemDescription: string; + problemLanguage: SupportedLanguage; + sampleCode: string; + initialCode: string; + onCodeChange: (code: string) => void; + onCodeSubmit: (code: string) => void; + isFinished: boolean; + submissions: Submission[]; }; export default function GolfPlayAppGaming({ - gameDisplayName, - playerProfile, - problemTitle, - problemDescription, - problemLanguage, - sampleCode, - initialCode, - onCodeChange, - onCodeSubmit, - isFinished, - submissions, + gameDisplayName, + playerProfile, + problemTitle, + problemDescription, + problemLanguage, + sampleCode, + initialCode, + onCodeChange, + onCodeSubmit, + isFinished, + submissions, }: Props) { - const leftTimeSeconds = useAtomValue(gamingLeftTimeSecondsAtom); - const score = useAtomValue(scoreAtom); - const status = useAtomValue(statusAtom); + const leftTimeSeconds = useAtomValue(gamingLeftTimeSecondsAtom); + const score = useAtomValue(scoreAtom); + const status = useAtomValue(statusAtom); - const [codeSize, setCodeSize] = useState( - calcCodeSize(initialCode, problemLanguage), - ); - const textareaRef = useRef(null); + const [codeSize, setCodeSize] = useState( + calcCodeSize(initialCode, problemLanguage), + ); + const textareaRef = useRef(null); - const handleTextChange = (e: React.ChangeEvent) => { - setCodeSize(calcCodeSize(e.target.value, problemLanguage)); - if (!isFinished) { - onCodeChange(e.target.value); - } - }; + const handleTextChange = (e: React.ChangeEvent) => { + setCodeSize(calcCodeSize(e.target.value, problemLanguage)); + if (!isFinished) { + onCodeChange(e.target.value); + } + }; - const handleSubmitButtonClick = () => { - if (textareaRef.current && !isFinished) { - onCodeSubmit(textareaRef.current.value); - } - }; + const handleSubmitButtonClick = () => { + if (textareaRef.current && !isFinished) { + onCodeSubmit(textareaRef.current.value); + } + }; - return ( -
-
-
-
{gameDisplayName}
- {isFinished ? ( -
終了
- ) : leftTimeSeconds === null ? ( -
未開始
- ) : ( - - )} -
- -
-
{score}
-
- {playerProfile.displayName} -
- {playerProfile.iconPath && ( - - )} -
- -
- - - - -
-
- コードサイズ: {codeSize} -
- - 提出 - -
-