-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from RuiOkazaki/feature/TSK-33
[TSK-33]ゲーム画面まで遷移できるようにする
- Loading branch information
Showing
25 changed files
with
628 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from '@/page/game-configure'; | ||
export { default } from '@/page/game-configure'; | ||
|
||
// MEMO: export type { Query } from '@/page/game-configure'; だと pathpida がうまく読み込んでくれない | ||
import type { Query as OriginalQuery } from '@/page/game-configure'; | ||
export type Query = OriginalQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
export * from '@/page/game/layout'; | ||
export { default } from '@/page/game/layout'; | ||
import { GameModeLayout } from '@/shared/layout/game-mode-layout'; | ||
|
||
export default function Layout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return <GameModeLayout>{children}</GameModeLayout>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from '@/page/game/page'; | ||
export { default } from '@/page/game/page'; | ||
export * from '@/page/game-home'; | ||
export { default } from '@/page/game-home'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export * from '@/page/game-play'; | ||
export { default } from '@/page/game-play'; | ||
|
||
// MEMO: export type { Query } from '@/page/game-play'; だと pathpida がうまく読み込んでくれない | ||
import type { Query as OriginalQuery } from '@/page/game-play'; | ||
export type Query = OriginalQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from '@/page/game-result'; | ||
export { default } from '@/page/game-result'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
export * from '@/page/layout'; | ||
export { default } from '@/page/layout'; | ||
import { UserProvider } from '@auth0/nextjs-auth0/client'; | ||
import type { Metadata } from 'next'; | ||
import './globals.css'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Create Next App', | ||
description: 'Generated by create next app', | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang='ja'> | ||
<UserProvider> | ||
<body>{children}</body> | ||
</UserProvider> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from '@/page/page'; | ||
export { default } from '@/page/page'; | ||
export * from '@/page/home'; | ||
export { default } from '@/page/home'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
'use client'; | ||
|
||
import { pagesPath } from '@/shared/libs/pathpida/$path'; | ||
import { Button } from '@/shared/ui/button'; | ||
import { Tabs, TabsList, TabsTrigger } from '@/shared/ui/tabs'; | ||
import { Typography } from '@/shared/ui/typography'; | ||
import { GameHeader } from '@/widget/game-header'; | ||
import { HomeIcon, MenuIcon } from 'lucide-react'; | ||
import Link from 'next/link'; | ||
import { useSearchParams } from 'next/navigation'; | ||
import { useState } from 'react'; | ||
|
||
export type Query = { | ||
game_name: 'target-bull' | 'cr-number'; | ||
}; | ||
|
||
const DIFFICULTY = ['5', '10', '30', '50', '100'] as const; | ||
|
||
// TODO: ゲームモードによって色を変更する | ||
export default function Game() { | ||
const [selectedDifficulty, setSelectedDifficulty] = | ||
useState<(typeof DIFFICULTY)[number]>('5'); | ||
|
||
const query = useSearchParams(); | ||
// TODO: query.get を型安全にする | ||
const game_name = query.get('game_name') as unknown as ReturnType< | ||
typeof pagesPath.game.configure.$url | ||
>['query']['game_name']; | ||
game_name; | ||
|
||
return ( | ||
<div className='grid h-full w-full grid-rows-[4.5rem_1fr]'> | ||
<GameHeader | ||
color='red-500' | ||
title='TARGET BULL' | ||
leftItems={ | ||
<Button | ||
variant='outline' | ||
size='icon' | ||
className='border-white bg-red-500 text-white hover:border-white hover:bg-red-500 hover:text-white' | ||
asChild | ||
> | ||
<Link href={pagesPath.game.$url()}> | ||
<HomeIcon className='stroke-1' /> | ||
</Link> | ||
</Button> | ||
} | ||
rightItems={ | ||
<Button | ||
variant='outline' | ||
size='icon' | ||
className='border-white bg-red-500 text-white hover:border-white hover:bg-red-500 hover:text-white' | ||
> | ||
<MenuIcon className='stroke-1' /> | ||
</Button> | ||
} | ||
/> | ||
<main className='h-full p-4'> | ||
<div className='flex h-full flex-col items-center justify-center gap-7'> | ||
<div className='flex items-center gap-7'> | ||
<span className='block aspect-video h-24 bg-gray-300' /> | ||
<div className='flex w-72 flex-col gap-2'> | ||
<Typography variant='body-l'> | ||
ゲームの難易度を選択してください | ||
</Typography> | ||
<span className='border-b' /> | ||
<Typography> | ||
ターゲットにn(5,10,30,50,100)回 | ||
<br /> | ||
刺さるまで狙い続ける | ||
</Typography> | ||
</div> | ||
</div> | ||
<Tabs value={selectedDifficulty}> | ||
<TabsList> | ||
{DIFFICULTY.map(level => ( | ||
<TabsTrigger | ||
key={level} | ||
value={level} | ||
onClick={() => setSelectedDifficulty(level)} | ||
> | ||
{level} | ||
</TabsTrigger> | ||
))} | ||
</TabsList> | ||
</Tabs> | ||
<Button | ||
variant='outline' | ||
className='w-80 border-red-500 text-red-500 hover:bg-red-500 hover:text-white' | ||
asChild | ||
disabled={!selectedDifficulty} | ||
> | ||
<Link | ||
href={pagesPath.game.play.$url({ | ||
query: { | ||
game_name: 'target-bull', | ||
difficulty: selectedDifficulty, | ||
}, | ||
})} | ||
> | ||
ゲームを開始する | ||
</Link> | ||
</Button> | ||
</div> | ||
</main> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use client'; | ||
|
||
import { pagesPath } from '@/shared/libs/pathpida/$path'; | ||
import { Button } from '@/shared/ui/button'; | ||
import { Typography } from '@/shared/ui/typography'; | ||
import { GameHeader } from '@/widget/game-header'; | ||
import { MenuIcon, SettingsIcon, UserIcon } from 'lucide-react'; | ||
import Link from 'next/link'; | ||
|
||
export default function Game() { | ||
return ( | ||
<div className='grid h-full w-full grid-rows-[4.5rem_1fr]'> | ||
<GameHeader | ||
leftItems={ | ||
<Button className='flex gap-2 uppercase' variant='outline'> | ||
<UserIcon size='1rem' /> | ||
Profile | ||
</Button> | ||
} | ||
rightItems={ | ||
<div className='flex gap-4'> | ||
<Button variant='outline' size='icon'> | ||
<SettingsIcon className='stroke-[1.5]' /> | ||
</Button> | ||
<Button variant='outline' size='icon'> | ||
<MenuIcon /> | ||
</Button> | ||
</div> | ||
} | ||
/> | ||
<main className='h-full p-4'> | ||
<div className='flex h-full items-center justify-center gap-8'> | ||
<div className='h-3/4'> | ||
<Typography | ||
className='grid h-full w-36 place-items-center border border-red-500 text-red-500 uppercase' | ||
variant='body-m' | ||
weight='bold' | ||
asChild | ||
> | ||
<Button variant='unstyle' asChild> | ||
<Link | ||
href={pagesPath.game.configure.$url({ | ||
query: { game_name: 'target-bull' }, | ||
})} | ||
> | ||
Target Bull | ||
</Link> | ||
</Button> | ||
</Typography> | ||
</div> | ||
<div className='h-3/4'> | ||
<Typography | ||
className='grid h-full w-36 place-items-center border border-blue-500 text-blue-500 uppercase' | ||
variant='body-m' | ||
weight='bold' | ||
asChild | ||
> | ||
<Button variant='unstyle' asChild> | ||
<Link | ||
href={pagesPath.game.configure.$url({ | ||
query: { game_name: 'cr-number' }, | ||
})} | ||
> | ||
CR Number | ||
</Link> | ||
</Button> | ||
</Typography> | ||
</div> | ||
</div> | ||
</main> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.