mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-14 06:58:00 +00:00
fix aria and minify
This commit is contained in:
@@ -201,6 +201,7 @@ export const CommanderDamage = ({
|
|||||||
<CommanderDamageContainer
|
<CommanderDamageContainer
|
||||||
key={opponentIndex}
|
key={opponentIndex}
|
||||||
$rotation={player.settings.rotation}
|
$rotation={player.settings.rotation}
|
||||||
|
aria-label={`Commander damage bar ${player.index}`}
|
||||||
>
|
>
|
||||||
<CommanderDamageButton
|
<CommanderDamageButton
|
||||||
key={opponentIndex}
|
key={opponentIndex}
|
||||||
@@ -214,6 +215,7 @@ export const CommanderDamage = ({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
$backgroundColor={opponent.color}
|
$backgroundColor={opponent.color}
|
||||||
|
aria-label={`Commander damage. Player ${player.index}, opponent ${opponent.index}`}
|
||||||
>
|
>
|
||||||
<CommanderDamageTextContainer $rotation={player.settings.rotation}>
|
<CommanderDamageTextContainer $rotation={player.settings.rotation}>
|
||||||
<OutlinedText
|
<OutlinedText
|
||||||
@@ -247,6 +249,7 @@ export const CommanderDamage = ({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
$backgroundColor={opponent.color}
|
$backgroundColor={opponent.color}
|
||||||
|
aria-label={`Partner Commander damage. Player ${player.index}, opponent ${opponent.index}`}
|
||||||
>
|
>
|
||||||
<CommanderDamageTextContainer $rotation={player.settings.rotation}>
|
<CommanderDamageTextContainer $rotation={player.settings.rotation}>
|
||||||
<OutlinedText
|
<OutlinedText
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ type ExtraCounterProps = {
|
|||||||
type: CounterType;
|
type: CounterType;
|
||||||
setCounterTotal: (updatedCounterTotal: number, type: CounterType) => void;
|
setCounterTotal: (updatedCounterTotal: number, type: CounterType) => void;
|
||||||
rotation: number;
|
rotation: number;
|
||||||
|
playerIndex: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ExtraCounter = ({
|
const ExtraCounter = ({
|
||||||
@@ -67,6 +68,7 @@ const ExtraCounter = ({
|
|||||||
setCounterTotal,
|
setCounterTotal,
|
||||||
type,
|
type,
|
||||||
rotation,
|
rotation,
|
||||||
|
playerIndex,
|
||||||
}: ExtraCounterProps) => {
|
}: ExtraCounterProps) => {
|
||||||
const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);
|
const timeoutRef = useRef<NodeJS.Timeout | undefined>(undefined);
|
||||||
const [timeoutFinished, setTimeoutFinished] = useState(false);
|
const [timeoutFinished, setTimeoutFinished] = useState(false);
|
||||||
@@ -120,6 +122,7 @@ const ExtraCounter = ({
|
|||||||
onContextMenu={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
onContextMenu={(e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
|
aria-label={`Player ${playerIndex} extra counter: ${type}`}
|
||||||
>
|
>
|
||||||
<IconContainer $rotation={rotation}>
|
<IconContainer $rotation={rotation}>
|
||||||
{Icon}
|
{Icon}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ const LifeCounterButton = ({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
style={{ fontSize }}
|
style={{ fontSize }}
|
||||||
|
aria-label={`${operation === 'add' ? 'Add' : 'Subtract'} life`}
|
||||||
>
|
>
|
||||||
<TextContainer
|
<TextContainer
|
||||||
$rotation={rotation}
|
$rotation={rotation}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ type LoseButtonProps = {
|
|||||||
|
|
||||||
export const LoseGameButton = ({ rotation, onClick }: LoseButtonProps) => {
|
export const LoseGameButton = ({ rotation, onClick }: LoseButtonProps) => {
|
||||||
return (
|
return (
|
||||||
<LoseButton $rotation={rotation} onClick={onClick}>
|
<LoseButton $rotation={rotation} onClick={onClick} aria-label={`Lose Game`}>
|
||||||
<Skull size="5vmin" color="black" opacity={0.5} />
|
<Skull size="5vmin" color="black" opacity={0.5} />
|
||||||
</LoseButton>
|
</LoseButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -40,7 +40,11 @@ type SettingsButtonProps = {
|
|||||||
|
|
||||||
const SettingsButton = ({ onClick, rotation }: SettingsButtonProps) => {
|
const SettingsButton = ({ onClick, rotation }: SettingsButtonProps) => {
|
||||||
return (
|
return (
|
||||||
<StyledSettingsButton onClick={onClick} $rotation={rotation}>
|
<StyledSettingsButton
|
||||||
|
onClick={onClick}
|
||||||
|
$rotation={rotation}
|
||||||
|
aria-label={`Settings`}
|
||||||
|
>
|
||||||
<Cog size="5vmin" color="black" opacity="0.3" />
|
<Cog size="5vmin" color="black" opacity="0.3" />
|
||||||
</StyledSettingsButton>
|
</StyledSettingsButton>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ const ExtraCountersBar = ({
|
|||||||
)?.value
|
)?.value
|
||||||
}
|
}
|
||||||
setCounterTotal={handleCounterChange}
|
setCounterTotal={handleCounterChange}
|
||||||
|
playerIndex={player.index}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{Boolean(useCommanderDamage && usePartner) && (
|
{Boolean(useCommanderDamage && usePartner) && (
|
||||||
@@ -145,6 +146,7 @@ const ExtraCountersBar = ({
|
|||||||
)?.value
|
)?.value
|
||||||
}
|
}
|
||||||
setCounterTotal={handleCounterChange}
|
setCounterTotal={handleCounterChange}
|
||||||
|
playerIndex={player.index}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{usePoison && (
|
{usePoison && (
|
||||||
@@ -157,6 +159,7 @@ const ExtraCountersBar = ({
|
|||||||
?.value
|
?.value
|
||||||
}
|
}
|
||||||
setCounterTotal={handleCounterChange}
|
setCounterTotal={handleCounterChange}
|
||||||
|
playerIndex={player.index}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{useEnergy && (
|
{useEnergy && (
|
||||||
@@ -169,6 +172,7 @@ const ExtraCountersBar = ({
|
|||||||
?.value
|
?.value
|
||||||
}
|
}
|
||||||
setCounterTotal={handleCounterChange}
|
setCounterTotal={handleCounterChange}
|
||||||
|
playerIndex={player.index}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{useExperience && (
|
{useExperience && (
|
||||||
@@ -182,6 +186,7 @@ const ExtraCountersBar = ({
|
|||||||
)?.value
|
)?.value
|
||||||
}
|
}
|
||||||
setCounterTotal={handleCounterChange}
|
setCounterTotal={handleCounterChange}
|
||||||
|
playerIndex={player.index}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ExtraCountersGrid>
|
</ExtraCountersGrid>
|
||||||
|
|||||||
@@ -183,6 +183,8 @@ const Settings = ({
|
|||||||
type="color"
|
type="color"
|
||||||
value={player.color}
|
value={player.color}
|
||||||
onChange={handleColorChange}
|
onChange={handleColorChange}
|
||||||
|
role="button"
|
||||||
|
aria-label="Color picker"
|
||||||
/>
|
/>
|
||||||
<TogglesSection $rotation={player.settings.rotation}>
|
<TogglesSection $rotation={player.settings.rotation}>
|
||||||
{player.settings.useCommanderDamage && (
|
{player.settings.useCommanderDamage && (
|
||||||
@@ -207,6 +209,9 @@ const Settings = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onChange={handleSettingsChange}
|
onChange={handleSettingsChange}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={player.settings.usePartner}
|
||||||
|
aria-label="Partner"
|
||||||
/>
|
/>
|
||||||
</CheckboxContainer>
|
</CheckboxContainer>
|
||||||
)}
|
)}
|
||||||
@@ -232,6 +237,9 @@ const Settings = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onChange={handleSettingsChange}
|
onChange={handleSettingsChange}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={player.settings.usePoison}
|
||||||
|
aria-label="Poison"
|
||||||
/>
|
/>
|
||||||
</CheckboxContainer>
|
</CheckboxContainer>
|
||||||
|
|
||||||
@@ -256,6 +264,9 @@ const Settings = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onChange={handleSettingsChange}
|
onChange={handleSettingsChange}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={player.settings.useEnergy}
|
||||||
|
aria-label="Energy"
|
||||||
/>
|
/>
|
||||||
</CheckboxContainer>
|
</CheckboxContainer>
|
||||||
|
|
||||||
@@ -280,6 +291,9 @@ const Settings = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onChange={handleSettingsChange}
|
onChange={handleSettingsChange}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={player.settings.useExperience}
|
||||||
|
aria-label="Experience"
|
||||||
/>
|
/>
|
||||||
</CheckboxContainer>
|
</CheckboxContainer>
|
||||||
</TogglesSection>
|
</TogglesSection>
|
||||||
@@ -293,6 +307,7 @@ const Settings = ({
|
|||||||
padding: '0 4px 0 4px',
|
padding: '0 4px 0 4px',
|
||||||
}}
|
}}
|
||||||
onClick={handleNewGame}
|
onClick={handleNewGame}
|
||||||
|
aria-label="Back to start"
|
||||||
>
|
>
|
||||||
Back to Start
|
Back to Start
|
||||||
</Button>
|
</Button>
|
||||||
@@ -305,6 +320,9 @@ const Settings = ({
|
|||||||
padding: '0 4px 0 4px',
|
padding: '0 4px 0 4px',
|
||||||
}}
|
}}
|
||||||
onClick={toggleFullscreen}
|
onClick={toggleFullscreen}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={document.fullscreenElement ? true : false}
|
||||||
|
aria-label="Fullscreen toggle"
|
||||||
>
|
>
|
||||||
Fullscreen
|
Fullscreen
|
||||||
</Button>
|
</Button>
|
||||||
@@ -317,6 +335,9 @@ const Settings = ({
|
|||||||
padding: '0 4px 0 4px',
|
padding: '0 4px 0 4px',
|
||||||
}}
|
}}
|
||||||
onClick={handleWakeLock}
|
onClick={handleWakeLock}
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={wakeLock.active}
|
||||||
|
aria-label="Keep awake"
|
||||||
>
|
>
|
||||||
Keep Awake
|
Keep Awake
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react-swc'
|
import react from '@vitejs/plugin-react-swc';
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
build: {
|
build: {
|
||||||
|
minify: 'esbuild',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['babel-plugin-macros']
|
external: ['babel-plugin-macros'],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user