throttle 'tilts' from the server
This commit is contained in:
@@ -22,7 +22,7 @@ type CardProps = {
|
||||
|
||||
export default function Card({ card, cardIndex }: CardProps) {
|
||||
const [tooltip, setTooltip] = useState<React.ReactNode>(null);
|
||||
const { flipCard, gameData, redraw, setSelectCardIndex } = useAppContext();
|
||||
const { emitFlip, gameData, emitRedraw, setSelectCardIndex } = useAppContext();
|
||||
|
||||
const { dmID, settings } = gameData;
|
||||
const isDM = !!dmID;
|
||||
@@ -32,7 +32,7 @@ export default function Card({ card, cardIndex }: CardProps) {
|
||||
|
||||
const handleClick = () => {
|
||||
if (isDM) {
|
||||
flipCard(cardIndex);
|
||||
emitFlip(cardIndex);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function Card({ card, cardIndex }: CardProps) {
|
||||
/>
|
||||
{isDM && !flipped && (
|
||||
<StackTheDeck
|
||||
onRedraw={() => redraw(cardIndex)}
|
||||
onRedraw={() => emitRedraw(cardIndex)}
|
||||
onSelect={() => setSelectCardIndex(cardIndex)}
|
||||
onHover={setTooltip}
|
||||
/>
|
||||
|
||||
@@ -14,7 +14,7 @@ type CardSelectProps = {
|
||||
};
|
||||
|
||||
export default function CardSelect({ className = '' }: CardSelectProps) {
|
||||
const { gameData, select, selectCardIndex, setSelectCardIndex } = useAppContext();
|
||||
const { gameData, emitSelect, selectCardIndex, setSelectCardIndex } = useAppContext();
|
||||
const { cards: hand, settings } = gameData;
|
||||
|
||||
const handIDs = hand.map(({ id }) => id);
|
||||
@@ -53,7 +53,7 @@ export default function CardSelect({ className = '' }: CardSelectProps) {
|
||||
<div
|
||||
key={card.id}
|
||||
className={`relative h-[21vh] w-[15vh] perspective transition-transform duration-200 hover:scale-150 z-0 hover:z-10`}
|
||||
onClick={() => select(card.id)}
|
||||
onClick={() => emitSelect(card.id)}
|
||||
>
|
||||
<img
|
||||
src={getURL(card, settings)}
|
||||
|
||||
@@ -22,13 +22,13 @@ const cardStyleOptions: CardStyle[] = ['standard', 'color', 'grayscale'];
|
||||
|
||||
export default function Settings() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const { gameData, handleSettings } = useAppContext();
|
||||
const { gameData, emitSettings } = useAppContext();
|
||||
|
||||
const { dmID } = gameData;
|
||||
const isDM = !!dmID;
|
||||
|
||||
const togglePermission = (key: string) => {
|
||||
handleSettings({
|
||||
emitSettings({
|
||||
...gameData,
|
||||
settings: {
|
||||
...gameData.settings,
|
||||
@@ -38,7 +38,7 @@ export default function Settings() {
|
||||
};
|
||||
|
||||
const tuneRadio = (cardStyle: CardStyle) => {
|
||||
handleSettings({
|
||||
emitSettings({
|
||||
...gameData,
|
||||
settings: {
|
||||
...gameData.settings,
|
||||
|
||||
Reference in New Issue
Block a user