Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Design] 메인디스플레이에 화면 UI 꽉 차게 보이도록 수정 #217

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"typescript": "^5.6.3",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.10",
"vite-plugin-remove-console": "^2.2.0",
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.0"
}
Expand Down
153 changes: 80 additions & 73 deletions packages/frontend/src/components/gamePage/leftSection/MainDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,94 +73,101 @@ export default function MainDisplay() {
};
return (
<div
className={`relative flex flex-col flex-grow w-full p-4 mt-4 rounded-lg ${
className={`relative flex-1 flex flex-col w-full p-4 mt-4 rounded-lg overflow-hidden ${
gamePhase === GAME_PHASE.ENDING ? 'bg-green-default' : 'bg-green-default/40'
}`}
>
<WordDisplay
gamePhase={gamePhase}
currentWord={currentWord}
theme={theme}
isPinoco={isPinoco}
/>
{gamePhase === GAME_PHASE.SPEAKING && (
<div className="absolute inset-0">
<VideoStream
stream={getCurrentStream() || null}
userName={currentSpeaker}
isLocal={true}
height="h-full"
/>
</div>
)}

<div className="flex-grow">
{gamePhase === GAME_PHASE.WAITING && (
<div className="flex flex-col items-center justify-center h-full">
{isHost ? <StartButton /> : <ReadyButton />}
<div className="relative z-10 flex flex-col h-full">
<div className="mb-4">
<div className="mb-2">
<WordDisplay
gamePhase={gamePhase}
currentWord={currentWord}
theme={theme}
isPinoco={isPinoco}
/>
</div>
)}

{gamePhase === GAME_PHASE.COUNTDOWN && <Countdown onCountdownEnd={handleCountdownEnd} />}
{gamePhase === GAME_PHASE.SPEAKING && (
<div className="p-2 text-lg rounded-lg w-fit text-white-default bg-slate-950">
📢 {currentSpeaker}
</div>
)}
</div>

{gamePhase === GAME_PHASE.SPEAKING && (
<div className="flex flex-col items-center justify-center h-full">
<div className="w-4/6 p-4">
<VideoStream
stream={getCurrentStream() || null}
userName={currentSpeaker}
isLocal={true}
height="h-full"
/>
<div className="flex-1">
{gamePhase === GAME_PHASE.WAITING && (
<div className="flex flex-col items-center justify-center h-full">
{isHost ? <StartButton /> : <ReadyButton />}
</div>
<div className="absolute p-2 text-lg rounded-lg top-16 left-4 text-white-default bg-slate-950">
📢 {currentSpeaker}
)}
{gamePhase === GAME_PHASE.COUNTDOWN && <Countdown onCountdownEnd={handleCountdownEnd} />}
{gamePhase === GAME_PHASE.VOTING && (
<Voting
userId={userId!}
allUsers={allUsers}
selectedVote={selectedVote}
isVoteSubmitted={isVoteSubmitted}
setSelectedVote={setSelectedVote}
handleVote={handleVote}
/>
)}
{gamePhase === GAME_PHASE.VOTING_RESULT && (
<VoteResult
deadPerson={deadPerson ?? ''}
voteResult={voteResult}
isDeadPersonPinoco={isDeadPersonPinoco ?? null}
/>
)}
{gamePhase === GAME_PHASE.GUESSING && (
<div className="flex flex-col items-center justify-center h-full">
{isPinoco ? (
<GuessInput onSubmitGuess={submitGuess} />
) : (
<p className="text-xl text-center text-white-default">
피노코가 제시어를 추측 중입니다 🤔
</p>
)}
</div>
{currentSpeaker === userId && (
)}
{gamePhase === GAME_PHASE.ENDING && <EndingResult endingResult={endingResult} />}
</div>

<div className="relative mt-auto">
{gamePhase === GAME_PHASE.SPEAKING && currentSpeaker === userId && (
<div className="absolute bottom-12 right-4">
<button
className="mt-4 px-6 py-2 bg-green-default text-white-default rounded-lg hover:bg-green-200 hover:text-black self-end ml-auto"
className="px-6 py-2 rounded-lg bg-green-default text-white-default hover:bg-green-200 hover:text-black"
onClick={endSpeakingEarly}
>
발언 종료
</button>
)}
</div>
)}

{gamePhase === GAME_PHASE.VOTING && (
<Voting
userId={userId!}
allUsers={allUsers}
selectedVote={selectedVote}
isVoteSubmitted={isVoteSubmitted}
setSelectedVote={setSelectedVote}
handleVote={handleVote}
/>
)}

{gamePhase === GAME_PHASE.VOTING_RESULT && (
<VoteResult
deadPerson={deadPerson ?? ''}
voteResult={voteResult}
isDeadPersonPinoco={isDeadPersonPinoco ?? null}
/>
)}
{gamePhase === GAME_PHASE.GUESSING && (
<div className="flex flex-col items-center justify-center h-full">
{isPinoco ? (
<GuessInput onSubmitGuess={submitGuess} />
) : (
<p className="text-xl text-center text-white-default">
피노코가 제시어를 추측 중입니다 🤔
</p>
)}
</div>
)}

{gamePhase === GAME_PHASE.ENDING && <EndingResult endingResult={endingResult} />}
</div>

{gamePhase === GAME_PHASE.SPEAKING && (
<div className="w-full mt-auto">
<Timer key={currentSpeaker} initialTime={15} onTimeEnd={() => endSpeaking(userId!)} />
</div>
)}
</div>
)}

{gamePhase === GAME_PHASE.VOTING && (
<div className="w-full mt-auto">
<Timer key="voting" initialTime={30} onTimeEnd={handleVote} />
{(gamePhase === GAME_PHASE.SPEAKING || gamePhase === GAME_PHASE.VOTING) && (
<div className="w-full">
<Timer
key={gamePhase === GAME_PHASE.SPEAKING ? currentSpeaker : 'voting'}
initialTime={gamePhase === GAME_PHASE.SPEAKING ? 15 : 30}
onTimeEnd={
gamePhase === GAME_PHASE.SPEAKING ? () => endSpeaking(userId!) : handleVote
}
/>
</div>
)}
</div>
)}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function WordDisplay({
className={`${
gamePhase === GAME_PHASE.WORD_REVEAL
? 'fixed inset-0 flex items-center justify-center bg-black/50 z-50'
: 'absolute left-4 top-4 p-2 bg-black rounded-lg'
: 'absolute top-14 p-2 bg-black rounded-lg'
}`}
>
<motion.div
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgrPlugin from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
import removeConsole from 'vite-plugin-remove-console';

export default defineConfig({
plugins: [react(), tsconfigPaths(), svgrPlugin()],
Expand All @@ -24,6 +25,9 @@ export default defineConfig({
return null;
},
},
removeConsole({
includes: ['log', 'warn', 'error'],
}),
],
},
},
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5454,6 +5454,7 @@ __metadata:
typescript: "npm:^5.6.3"
typescript-eslint: "npm:^8.11.0"
vite: "npm:^5.4.10"
vite-plugin-remove-console: "npm:^2.2.0"
vite-plugin-svgr: "npm:^4.3.0"
vite-tsconfig-paths: "npm:^5.1.0"
zustand: "npm:^5.0.1"
Expand Down Expand Up @@ -10631,6 +10632,13 @@ __metadata:
languageName: node
linkType: hard

"vite-plugin-remove-console@npm:^2.2.0":
version: 2.2.0
resolution: "vite-plugin-remove-console@npm:2.2.0"
checksum: 10c0/b97e77f68e52196bdae468161103217aaa6325bdb88e59dfd18fbe6ed0e4f8e4487708fb091f8780174b104c03c47cf94e7408fbe1d9360256f45bc35ccde0f7
languageName: node
linkType: hard

"vite-plugin-svgr@npm:^4.3.0":
version: 4.3.0
resolution: "vite-plugin-svgr@npm:4.3.0"
Expand Down
Loading