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

Player turn aura #171

Merged
merged 11 commits into from
Mar 6, 2025
30 changes: 29 additions & 1 deletion src/app/GameBoard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const GameBoard = () => {
const [sidebarOpen, setSidebarOpen] = useState(sidebarState);
const [isPreferenceOpen, setPreferenceOpen] = useState(false);


useEffect(() => {
if(lobbyState && !lobbyState.gameOngoing && lobbyState.gameType !== MatchType.Quick) {
router.push('/lobby');
Expand Down Expand Up @@ -58,6 +57,9 @@ const GameBoard = () => {
if (!gameState || !connectedPlayer) {
return null;
}

const activePlayer = gameState.players[connectedPlayer].isActionPhaseActivePlayer;
const phase = gameState.phase;
// ----------------------Styles-----------------------------//
const styles = {
mainBoxStyle: {
Expand Down Expand Up @@ -99,6 +101,30 @@ const GameBoard = () => {
background: 'rgba(0, 0, 0, 0.5)',
filter: 'blur(10px)',
WebkitFilter: 'blur(10px)'
},
playerTurnAura: {
height: '100px',
width: '85%',
position: 'absolute',
bottom: '-100px',
boxShadow: activePlayer === true ? '0px -20px 35px var(--initiative-blue)' : phase === 'regroup' || phase === 'setup' ? '0px -20px 35px var(--selection-yellow)' : 'none',
transition: 'box-shadow 1.5s',
borderRadius: '50%',
left: '0',
right: '0',
marginInline: 'auto',
},
opponentTurnAura: {
height: '100px',
width: '85%',
position: 'absolute',
top: '-100px',
boxShadow: activePlayer === false ? '0px 20px 35px var(--initiative-red)' : phase === 'regroup' || phase === 'setup' ? '0px 20px 35px var(--selection-yellow)' : 'none',
transition: 'box-shadow 1.5s',
borderRadius: '50%',
left: '0',
right: '0',
marginInline: 'auto',
}
};

Expand All @@ -109,11 +135,13 @@ const GameBoard = () => {
trayPlayer={getOpponent(connectedPlayer)}
preferenceToggle={handlePreferenceToggle}
/>
<Box sx={ styles.opponentTurnAura} />
<Board sidebarOpen={sidebarOpen} />
<PlayerCardTray
trayPlayer={connectedPlayer}
toggleSidebar={toggleSidebar}
/>
<Box sx={styles.playerTurnAura} />
</Box>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const OpponentCardTray: React.FC<IOpponentCardTrayProps> = ({ trayPlayer, prefer
width: '100%',
height: '100%',
transform: 'translateY(-2rem)',
zIndex: '1',
},
rightColumn: {
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const PlayerCardTray: React.FC<IPlayerCardTrayProps> = ({ trayPlayer, toggleSide
display: 'flex',
alignItems: 'flex-end',
transform: 'translateY(1.6rem)',
zIndex: '1',
},
chatColumn: {
display: 'flex',
Expand Down
Loading