diff options
Diffstat (limited to 'frontend/src/game/apps')
| -rw-r--r-- | frontend/src/game/apps/Connecting.jsx | 7 | ||||
| -rw-r--r-- | frontend/src/game/apps/Failed.jsx | 7 | ||||
| -rw-r--r-- | frontend/src/game/apps/Finished.jsx | 24 | ||||
| -rw-r--r-- | frontend/src/game/apps/Gaming.jsx | 24 | ||||
| -rw-r--r-- | frontend/src/game/apps/Starting.jsx | 9 | ||||
| -rw-r--r-- | frontend/src/game/apps/Waiting.jsx | 7 |
6 files changed, 78 insertions, 0 deletions
diff --git a/frontend/src/game/apps/Connecting.jsx b/frontend/src/game/apps/Connecting.jsx new file mode 100644 index 0000000..464af23 --- /dev/null +++ b/frontend/src/game/apps/Connecting.jsx @@ -0,0 +1,7 @@ +export default () => { + return ( + <div> + 接続中です...... + </div> + ); +} diff --git a/frontend/src/game/apps/Failed.jsx b/frontend/src/game/apps/Failed.jsx new file mode 100644 index 0000000..f96e999 --- /dev/null +++ b/frontend/src/game/apps/Failed.jsx @@ -0,0 +1,7 @@ +export default () => { + return ( + <div> + エラー + </div> + ); +} diff --git a/frontend/src/game/apps/Finished.jsx b/frontend/src/game/apps/Finished.jsx new file mode 100644 index 0000000..efd4e81 --- /dev/null +++ b/frontend/src/game/apps/Finished.jsx @@ -0,0 +1,24 @@ +export default ({ result }) => { + const { yourScore, opponentScore } = result; + const yourScoreToCompare = yourScore ?? Infinity; + const opponentScoreToCompare = opponentScore ?? Infinity; + const resultText = yourScoreToCompare === opponentScoreToCompare ? '引き分け' : (yourScoreToCompare < opponentScoreToCompare ? 'あなたの勝ち' : 'あなたの負け'); + return ( + <> + <div> + 対戦終了 + </div> + <div> + <div> + {resultText} + </div> + <div> + あなたのスコア: {yourScore ?? 'なし'} + </div> + <div> + 相手のスコア: {opponentScore ?? 'なし'} + </div> + </div> + </> + ); +} diff --git a/frontend/src/game/apps/Gaming.jsx b/frontend/src/game/apps/Gaming.jsx new file mode 100644 index 0000000..bf47860 --- /dev/null +++ b/frontend/src/game/apps/Gaming.jsx @@ -0,0 +1,24 @@ +export default ({ problem, onCodeChange, score }) => { + const handleTextChange = (e) => { + onCodeChange({ code: e.target.value }); + }; + + return ( + <div style={{ display: 'flex' }}> + <div style={{ flex: 1, padding: '10px', borderRight: '1px solid #ccc' }}> + <div> + {problem} + </div> + <div> + {score == null ? 'Score: -' : `Score: ${score} byte`} + </div> + </div> + <div style={{ flex: 1, padding: '10px' }}> + <textarea + style={{ width: '100%', height: '100%' }} + onChange={handleTextChange} + /> + </div> + </div> + ); +}; diff --git a/frontend/src/game/apps/Starting.jsx b/frontend/src/game/apps/Starting.jsx new file mode 100644 index 0000000..e66aa34 --- /dev/null +++ b/frontend/src/game/apps/Starting.jsx @@ -0,0 +1,9 @@ +export default ({ timeLeft }) => { + return ( + <> + <div> + 対戦相手が見つかりました。{timeLeft} 秒後にゲームを開始します。 + </div> + </> + ); +} diff --git a/frontend/src/game/apps/Waiting.jsx b/frontend/src/game/apps/Waiting.jsx new file mode 100644 index 0000000..27fdd76 --- /dev/null +++ b/frontend/src/game/apps/Waiting.jsx @@ -0,0 +1,7 @@ +export default () => { + return ( + <div> + 対戦相手が現れるのを待っています...... + </div> + ); +} |
