Compare commits
14 Commits
trunk
...
522fdf106e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
522fdf106e | ||
|
|
d531a9bd6a | ||
|
|
c6dfed9bed | ||
|
|
ddb1575dc8 | ||
|
|
4ec4ac0242 | ||
|
|
f61ca0d0a1 | ||
|
|
6b3ab9a54e | ||
|
|
1dbe6b7ec0 | ||
|
|
2ae4c6a77b | ||
|
|
a0e4f54ed9 | ||
|
|
2c2e93649c | ||
|
|
12ae8dd6d8 | ||
|
|
1c28a603b7 | ||
|
|
e7ebb0223b |
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { createContext, useContext, useEffect, useState } from 'react';
|
import { createContext, useContext, useEffect, useState } from 'react';
|
||||||
import useSocket from '@/hooks/useSocket';
|
import useSocket from '@/hooks/useSocket';
|
||||||
import { reduceTilts } from '@/tools';
|
|
||||||
|
|
||||||
import { GAME_START, LOCAL_DEFAULTS } from '@/constants';
|
import { GAME_START, LOCAL_DEFAULTS } from '@/constants';
|
||||||
import type { Dispatch, ReactNode, SetStateAction } from 'react';
|
import type { Dispatch, ReactNode, SetStateAction } from 'react';
|
||||||
@@ -16,7 +15,7 @@ export interface AppContext {
|
|||||||
noGame: boolean;
|
noGame: boolean;
|
||||||
selectCardIndex: number;
|
selectCardIndex: number;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
tilts: Tilt[];
|
tilt: Tilt[];
|
||||||
emitFlip: (cardIndex: number) => void;
|
emitFlip: (cardIndex: number) => void;
|
||||||
emitSettings: (gameData: GameUpdate) => void;
|
emitSettings: (gameData: GameUpdate) => void;
|
||||||
emitRedraw: (cardIndex: number) => void;
|
emitRedraw: (cardIndex: number) => void;
|
||||||
@@ -24,7 +23,7 @@ export interface AppContext {
|
|||||||
setGameID: (gameID: string) => void;
|
setGameID: (gameID: string) => void;
|
||||||
setLocalSettings: Dispatch<SetStateAction<LocalSettings>>;
|
setLocalSettings: Dispatch<SetStateAction<LocalSettings>>;
|
||||||
setSelectCardIndex: (cardIndex: number) => void;
|
setSelectCardIndex: (cardIndex: number) => void;
|
||||||
setLocalTilt: (tilt: Tilt[]) => void;
|
setTilt: (tilt: Tilt[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AppProvider({ children }: { children: ReactNode }) {
|
export function AppProvider({ children }: { children: ReactNode }) {
|
||||||
@@ -33,7 +32,7 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
|||||||
const [gameID, setGameID] = useState('');
|
const [gameID, setGameID] = useState('');
|
||||||
const [noGame, setNoGame] = useState(false);
|
const [noGame, setNoGame] = useState(false);
|
||||||
const [selectCardIndex, setSelectCardIndex] = useState(-1);
|
const [selectCardIndex, setSelectCardIndex] = useState(-1);
|
||||||
const [localTilt, setLocalTilt] = useState<Tilt[]>([]);
|
const [tilt, setTilt] = useState<Tilt[]>([]);
|
||||||
|
|
||||||
const { emitFlip, emitRedraw, emitSelect, emitSettings, emitTilt } = useSocket({
|
const { emitFlip, emitRedraw, emitSelect, emitSettings, emitTilt } = useSocket({
|
||||||
gameID,
|
gameID,
|
||||||
@@ -43,17 +42,17 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (localSettings.remoteTilt) {
|
if (localSettings.remoteTilt) {
|
||||||
const cardIndex = localTilt.findIndex((tilt) => !!tilt);
|
const cardIndex = tilt.findIndex((tilt) => !!tilt);
|
||||||
|
|
||||||
if (localTilt[cardIndex]) {
|
if (tilt[cardIndex]) {
|
||||||
emitTilt(cardIndex, localTilt[cardIndex]);
|
emitTilt(cardIndex, tilt[cardIndex]);
|
||||||
} else {
|
} else {
|
||||||
// cardIndex does not matter
|
// cardIndex does not matter
|
||||||
// all tilts for this user will be cleared
|
// all tilts for this user will be cleared
|
||||||
emitTilt(0, { percentX: -1, percentY: -1, rotateX: 0, rotateY: 0 });
|
emitTilt(0, { rotateX: 0, rotateY: 0 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [localTilt, localSettings]);
|
}, [tilt, localSettings]);
|
||||||
|
|
||||||
const handleSelect = (cardID: string) => {
|
const handleSelect = (cardID: string) => {
|
||||||
setSelectCardIndex(-1);
|
setSelectCardIndex(-1);
|
||||||
@@ -63,15 +62,14 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
const { dmID } = gameData;
|
const { dmID } = gameData;
|
||||||
const isDM = !!dmID;
|
const isDM = !!dmID;
|
||||||
const settings = { ...gameData.settings, ...localSettings };
|
|
||||||
|
|
||||||
const appInterface = {
|
const appInterface = {
|
||||||
gameData,
|
gameData,
|
||||||
isDM,
|
isDM,
|
||||||
noGame,
|
noGame,
|
||||||
selectCardIndex,
|
selectCardIndex,
|
||||||
settings,
|
settings: { ...gameData.settings, ...localSettings },
|
||||||
tilts: reduceTilts(gameData, localTilt, settings),
|
tilt,
|
||||||
emitFlip,
|
emitFlip,
|
||||||
emitSettings,
|
emitSettings,
|
||||||
emitRedraw,
|
emitRedraw,
|
||||||
@@ -79,7 +77,7 @@ export function AppProvider({ children }: { children: ReactNode }) {
|
|||||||
setGameID,
|
setGameID,
|
||||||
setLocalSettings,
|
setLocalSettings,
|
||||||
setSelectCardIndex,
|
setSelectCardIndex,
|
||||||
setLocalTilt,
|
setTilt,
|
||||||
};
|
};
|
||||||
|
|
||||||
return <AppContext.Provider value={appInterface}>{children}</AppContext.Provider>;
|
return <AppContext.Provider value={appInterface}>{children}</AppContext.Provider>;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { useAppContext } from '@/app/AppContext';
|
|||||||
import CardSelect from '@/components/CardSelect';
|
import CardSelect from '@/components/CardSelect';
|
||||||
import Notes from '@/components/Notes';
|
import Notes from '@/components/Notes';
|
||||||
import NotFound from '@/components/NotFound';
|
import NotFound from '@/components/NotFound';
|
||||||
import Settings from '@/components/Settings/index';
|
import Settings from '@/components/Settings';
|
||||||
import { SpectatorLink } from '@/components/SpectatorLink';
|
import { SpectatorLink } from '@/components/SpectatorLink';
|
||||||
import TarokkaGrid from '@/components/TarokkaGrid';
|
import TarokkaGrid from '@/components/TarokkaGrid';
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export default function GamePage() {
|
|||||||
return noGame ? (
|
return noGame ? (
|
||||||
<NotFound />
|
<NotFound />
|
||||||
) : (
|
) : (
|
||||||
<main className="h-dvh flex flex-col items-center justify-center gap-4 bg-[url('/img/table3.png')] bg-cover bg-center">
|
<main className="min-h-screen flex flex-col items-center justify-center gap-4 bg-[url('/img/table3.png')] bg-cover bg-center">
|
||||||
<SpectatorLink />
|
<SpectatorLink />
|
||||||
<Settings />
|
<Settings />
|
||||||
<TarokkaGrid />
|
<TarokkaGrid />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
import { Eagle_Lake } from 'next/font/google';
|
import { Pirata_One, Eagle_Lake, Cinzel_Decorative } from 'next/font/google';
|
||||||
import { AppProvider } from '@/app/AppContext';
|
import { AppProvider } from '@/app/AppContext';
|
||||||
import './globals.css';
|
import './globals.css';
|
||||||
|
|
||||||
|
const pirataOne = Pirata_One({
|
||||||
|
variable: '--font-pirata',
|
||||||
|
subsets: ['latin'],
|
||||||
|
weight: '400',
|
||||||
|
});
|
||||||
|
|
||||||
const eagleLake = Eagle_Lake({
|
const eagleLake = Eagle_Lake({
|
||||||
variable: '--font-eagle-lake',
|
variable: '--font-eagle-lake',
|
||||||
subsets: ['latin'],
|
subsets: ['latin'],
|
||||||
weight: '400',
|
weight: '400',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const cinzel = Cinzel_Decorative({
|
||||||
|
variable: '--font-cinzel',
|
||||||
|
subsets: ['latin'],
|
||||||
|
weight: '400',
|
||||||
|
});
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'Tarokka',
|
title: 'Tarokka',
|
||||||
description: 'Fortune telling for D&D’s Curse of Strahd',
|
description: 'Fortune telling for D&D’s Curse of Strahd',
|
||||||
@@ -25,8 +37,11 @@ export default function RootLayout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en" className={`${eagleLake.variable} antialiased overscroll-none`}>
|
<html
|
||||||
<body className={`${eagleLake.className} antialiased h-dvh`}>
|
lang="en"
|
||||||
|
className={`${pirataOne.variable} ${eagleLake.variable} ${cinzel.variable} antialiased`}
|
||||||
|
>
|
||||||
|
<body className={`${eagleLake.className} antialiased`}>
|
||||||
<AppProvider>{children}</AppProvider>
|
<AppProvider>{children}</AppProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function Home() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex justify-center items-center h-dvh text-yellow-400 bg-[url('/img/table3.png')] bg-cover bg-center">
|
<main className="min-h-screen flex justify-center items-center text-yellow-400 bg-[url('/img/table3.png')] bg-cover bg-center">
|
||||||
<div className="flex flex-col items-center gap-8 text-center">
|
<div className="flex flex-col items-center gap-8 text-center">
|
||||||
<h1 className="text-5xl font-bold text-center text-primary">Tarokka</h1>
|
<h1 className="text-5xl font-bold text-center text-primary">Tarokka</h1>
|
||||||
<p className="text-l text-center w-[350px] m-auto">
|
<p className="text-l text-center w-[350px] m-auto">
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { useAppContext } from '@/app/AppContext';
|
|||||||
import TiltCard from '@/components/TiltCard';
|
import TiltCard from '@/components/TiltCard';
|
||||||
import ToolTip from '@/components/ToolTip';
|
import ToolTip from '@/components/ToolTip';
|
||||||
import StackTheDeck from '@/components/StackTheDeck';
|
import StackTheDeck from '@/components/StackTheDeck';
|
||||||
import Sheen from '@/components/Sheen';
|
import getCardInfo from '@/tools/getCardInfo';
|
||||||
import { getCardInfo, getURL } from '@/tools';
|
import getURL from '@/tools/getURL';
|
||||||
|
|
||||||
import tarokkaCards from '@/constants/tarokkaCards';
|
import tarokkaCards from '@/constants/tarokkaCards';
|
||||||
import { layout } from '@/constants/tarokka';
|
import { layout } from '@/constants/tarokka';
|
||||||
@@ -54,7 +54,7 @@ export default function Card({ card, cardIndex }: CardProps) {
|
|||||||
return (
|
return (
|
||||||
<ToolTip content={tooltip || getTooltip()}>
|
<ToolTip content={tooltip || getTooltip()}>
|
||||||
<TiltCard
|
<TiltCard
|
||||||
className={`h-[21vh] w-[15vh] max-w-[30vw] relative perspective transition-transform duration-200 z-0 hover:z-10 hover:scale-150 ${isDM ? 'cursor-pointer' : ''} `}
|
className={`h-[21vh] w-[15vh] relative perspective transition-transform duration-200 z-0 hover:z-10 hover:scale-150 ${isDM ? 'cursor-pointer' : ''} `}
|
||||||
cardIndex={cardIndex}
|
cardIndex={cardIndex}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -84,7 +84,6 @@ export default function Card({ card, cardIndex }: CardProps) {
|
|||||||
onHover={setTooltip}
|
onHover={setTooltip}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Sheen cardIndex={cardIndex} />
|
|
||||||
</div>
|
</div>
|
||||||
<div className="absolute inset-0 backface-hidden rotate-y-180">
|
<div className="absolute inset-0 backface-hidden rotate-y-180">
|
||||||
<img
|
<img
|
||||||
@@ -92,7 +91,6 @@ export default function Card({ card, cardIndex }: CardProps) {
|
|||||||
alt={aria}
|
alt={aria}
|
||||||
className="rounded-lg border border-yellow-500/25 hover:drop-shadow-[0_0_3px_#ffd700/50]"
|
className="rounded-lg border border-yellow-500/25 hover:drop-shadow-[0_0_3px_#ffd700/50]"
|
||||||
/>
|
/>
|
||||||
<Sheen cardIndex={cardIndex} />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TiltCard>
|
</TiltCard>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { CircleX } from 'lucide-react';
|
import { CircleX } from 'lucide-react';
|
||||||
import { useAppContext } from '@/app/AppContext';
|
import { useAppContext } from '@/app/AppContext';
|
||||||
import TarokkaDeck from '@/lib/TarokkaDeck';
|
import TarokkaDeck from '@/lib/TarokkaDeck';
|
||||||
import { getURL } from '@/tools';
|
import getURL from '@/tools/getURL';
|
||||||
|
|
||||||
import { Deck } from '@/types';
|
import { Deck } from '@/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { CircleX, ScrollText } from 'lucide-react';
|
import { ScrollText } from 'lucide-react';
|
||||||
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
import { useAppContext } from '@/app/AppContext';
|
||||||
import CopyButton from '@/components/CopyButton';
|
import CopyButton from '@/components/CopyButton';
|
||||||
import Scrim from '@/components/Scrim';
|
import Scrim from '@/components/Scrim';
|
||||||
import { getCardInfo } from '@/tools';
|
import getCardInfo from '@/tools/getCardInfo';
|
||||||
import { cardMap, layout } from '@/constants/tarokka';
|
import { cardMap, layout } from '@/constants/tarokka';
|
||||||
|
|
||||||
export default function Notes() {
|
export default function Notes() {
|
||||||
@@ -51,24 +51,13 @@ export default function Notes() {
|
|||||||
className={`transition-all duration-250 ${showNotes ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'}`}
|
className={`transition-all duration-250 ${showNotes ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`fixed bottom-4 right-4 transition-all duration-250 bg-slate-800 border border-yellow-400 rounded-lg space-y-2 ${showNotes ? 'sm:w-[33vw] sm:h-[67vh] w-[80vw] h-[80vh]' : 'w-0 h-0'}`}
|
||||||
fixed bottom-4 right-4
|
|
||||||
transition-all duration-250
|
|
||||||
bg-slate-800
|
|
||||||
border border-yellow-400 rounded-lg
|
|
||||||
${showNotes ? 'sm:w-[50vw] sm:h-[67vh] w-[80vw] h-[80vh]' : 'w-0 h-0'}
|
|
||||||
`}
|
|
||||||
>
|
>
|
||||||
<CopyButton
|
<CopyButton
|
||||||
copy={notes.map((note) => note!.join('\n')).join('\n\n')}
|
copy={notes.map((note) => note!.join('\n')).join('\n\n')}
|
||||||
className={`
|
className="text-yellow-400 hover:drop-shadow-[0_0_1px_#ffd700] absolute top-2 right-2 p-2 transition-all duration-250 bg-black/20 hover:bg-black/40 rounded-full cursor-pointer"
|
||||||
absolute top-2 right-2
|
|
||||||
cursor-pointer p-2
|
|
||||||
transition-all duration-250
|
|
||||||
text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700]
|
|
||||||
`}
|
|
||||||
/>
|
/>
|
||||||
<div className="text-yellow-400 h-full overflow-scroll p-8 transition-all delay-200 duration-50 ${showNotes ? 'opacity-100' : 'opacity-0'}">
|
<div className="text-yellow-400 h-full overflow-scroll p-6 transition-all delay-200 duration-50 ${showNotes ? 'opacity-100' : 'opacity-0'}">
|
||||||
{notes.map((note, index) => (
|
{notes.map((note, index) => (
|
||||||
<div key={index}>
|
<div key={index}>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
@@ -81,17 +70,6 @@ export default function Notes() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
className={`
|
|
||||||
fixed bottom-4 right-4
|
|
||||||
cursor-pointer p-2
|
|
||||||
transition-all duration-250
|
|
||||||
text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700]
|
|
||||||
`}
|
|
||||||
onClick={() => setOpen((prev) => !prev)}
|
|
||||||
>
|
|
||||||
<CircleX className="w-5 h-5" />
|
|
||||||
</button>
|
|
||||||
</Scrim>
|
</Scrim>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
144
components/Settings.tsx
Normal file
144
components/Settings.tsx
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { Settings as Gear } from 'lucide-react';
|
||||||
|
import { Cinzel_Decorative } from 'next/font/google';
|
||||||
|
|
||||||
|
import { useAppContext } from '@/app/AppContext';
|
||||||
|
import BuyMeACoffee from '@/components/BuyMeACoffee';
|
||||||
|
import CopyButton from '@/components/CopyButton';
|
||||||
|
import GitHubButton from '@/components/GitHubButton';
|
||||||
|
import Scrim from '@/components/Scrim';
|
||||||
|
import Switch from '@/components/Switch';
|
||||||
|
|
||||||
|
import { LOCAL_SETTINGS, SPECTATOR_SETTINGS } from '@/constants';
|
||||||
|
import type { CardStyle, LocalSettings } from '@/types';
|
||||||
|
|
||||||
|
const cinzel = Cinzel_Decorative({
|
||||||
|
variable: '--font-cinzel',
|
||||||
|
subsets: ['latin'],
|
||||||
|
weight: '400',
|
||||||
|
});
|
||||||
|
|
||||||
|
const cardStyleOptions: CardStyle[] = ['standard', 'color', 'grayscale'];
|
||||||
|
|
||||||
|
export default function Settings() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const { gameData, isDM, settings, emitSettings, setLocalSettings } = useAppContext();
|
||||||
|
|
||||||
|
const togglePermission = (key: keyof LocalSettings) => {
|
||||||
|
if (LOCAL_SETTINGS.includes(key)) {
|
||||||
|
setLocalSettings((prev) => ({ ...prev, [key]: !prev[key] }));
|
||||||
|
} else if (isDM) {
|
||||||
|
emitSettings({
|
||||||
|
...gameData,
|
||||||
|
settings: {
|
||||||
|
...gameData.settings,
|
||||||
|
[key]: !gameData.settings[key],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const tuneRadio = (cardStyle: CardStyle) => {
|
||||||
|
emitSettings({
|
||||||
|
...gameData,
|
||||||
|
settings: {
|
||||||
|
...gameData.settings,
|
||||||
|
cardStyle,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const Icon = () => (
|
||||||
|
<button
|
||||||
|
className={`p-2 transition-all duration-250 text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700] cursor-pointer ${open ? 'pointer-events-none opacity-0' : 'pointer-events-auto opacity-100'}`}
|
||||||
|
onClick={() => setOpen((prev) => !prev)}
|
||||||
|
>
|
||||||
|
<Gear className="w-5 h-5" />
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
|
||||||
|
const Links = () => (
|
||||||
|
<>
|
||||||
|
{isDM && (
|
||||||
|
<CopyButton
|
||||||
|
title="Copy DM link"
|
||||||
|
copy={`${location.origin}/${gameData.dmID}`}
|
||||||
|
tooltip={`${location.origin}/${gameData.dmID}`}
|
||||||
|
className="flex flex-row content-between w-full py-1 px-2 transition-all duration-250 bg-slate-700 hover:bg-slate-600 hover:text-yellow-300 rounded-lg shadow"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<CopyButton
|
||||||
|
title="Copy Spectator link"
|
||||||
|
copy={`${location.origin}/${gameData.spectatorID}`}
|
||||||
|
tooltip={`${location.origin}/${gameData.spectatorID}`}
|
||||||
|
className="flex flex-row content-between w-full py-1 px-2 transition-all duration-250 bg-slate-700 hover:bg-slate-600 hover:text-yellow-300 rounded-lg shadow"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
const Permissions = () => (
|
||||||
|
<>
|
||||||
|
{Object.entries(settings)
|
||||||
|
.filter(([_key, value]) => typeof value === 'boolean')
|
||||||
|
.filter(([key]) => isDM || SPECTATOR_SETTINGS.includes(key))
|
||||||
|
.map(([key, value]) => (
|
||||||
|
<Switch key={key} label={key} value={value} toggleAction={() => togglePermission(key)} />
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
const CardStyle = () =>
|
||||||
|
isDM ? (
|
||||||
|
<fieldset className="flex flex-col w-full">
|
||||||
|
<div className="text-xs my-1">Card style:</div>
|
||||||
|
<div className="inline-flex overflow-hidden rounded-md w-full">
|
||||||
|
{cardStyleOptions.map((option, index) => (
|
||||||
|
<label
|
||||||
|
key={option}
|
||||||
|
className={`flex justify-center items-center cursor-pointer w-full px-4 py-2 text-sm font-medium transition
|
||||||
|
${settings.cardStyle === option ? 'bg-slate-700 text-yellow-300 font-extrabold' : 'bg-slate-800 hover:bg-slate-700'}
|
||||||
|
${index === 0 ? 'rounded-l-md' : ''}
|
||||||
|
${index === cardStyleOptions.length - 1 ? 'rounded-r-md' : ''}
|
||||||
|
${index !== 0 && 'border-l border-gray-600'}
|
||||||
|
border border-yellow-500 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700]
|
||||||
|
`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="cardStyle"
|
||||||
|
value={option}
|
||||||
|
checked={settings.cardStyle === option}
|
||||||
|
onChange={() => tuneRadio(option)}
|
||||||
|
className="sr-only"
|
||||||
|
/>
|
||||||
|
{option}
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
) : null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`fixed top-4 right-4 z-25 ${cinzel.className}`}>
|
||||||
|
<Scrim
|
||||||
|
clickAction={() => setOpen((prev) => !prev)}
|
||||||
|
className={`transition-all duration-250 ${open ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'}`}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={`fixed top-4 right-4 flex flex-col items-center justify-evenly bg-slate-800 text-yellow-400 rounded-lg border border-yellow-400 py-3 px-4 transition-all duration-250 ${open ? 'opacity-100 w-[350px] h-[350px]' : 'opacity-0 w-0 h-0'}`}
|
||||||
|
>
|
||||||
|
<Links />
|
||||||
|
<Permissions />
|
||||||
|
<CardStyle />
|
||||||
|
<span className="w-full flex flex-row justify-evenly">
|
||||||
|
<GitHubButton className="h-[35px] w-[125px]" />
|
||||||
|
<BuyMeACoffee className="h-[35px] w-[125px]" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</Scrim>
|
||||||
|
<Icon />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
|
||||||
import type { CardStyle } from '@/types';
|
|
||||||
|
|
||||||
const cardStyleOptions: CardStyle[] = ['standard', 'color', 'grayscale'];
|
|
||||||
|
|
||||||
export default function CardStyle({ className }: { className?: string }) {
|
|
||||||
const { gameData, isDM, settings, emitSettings } = useAppContext();
|
|
||||||
|
|
||||||
const tuneRadio = (cardStyle: CardStyle) => {
|
|
||||||
emitSettings({
|
|
||||||
...gameData,
|
|
||||||
settings: {
|
|
||||||
...gameData.settings,
|
|
||||||
cardStyle,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return isDM ? (
|
|
||||||
<fieldset className={`flex flex-col w-full ${className}`}>
|
|
||||||
<div className="text-xs ml-1 mb-1">Card style:</div>
|
|
||||||
<div className="inline-flex overflow-hidden rounded-md w-full">
|
|
||||||
{cardStyleOptions.map((option, index) => (
|
|
||||||
<label
|
|
||||||
key={option}
|
|
||||||
className={`
|
|
||||||
flex justify-center
|
|
||||||
cursor-pointer
|
|
||||||
w-full px-3 py-2
|
|
||||||
text-xs font-medium capitalize
|
|
||||||
border border-yellow-500
|
|
||||||
transition hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700]
|
|
||||||
${settings.cardStyle === option ? 'bg-slate-700 text-yellow-300 font-extrabold' : 'bg-slate-800 hover:bg-slate-700'}
|
|
||||||
${index === 0 ? 'rounded-l-md' : ''}
|
|
||||||
${index === cardStyleOptions.length - 1 ? 'rounded-r-md' : ''}
|
|
||||||
${index !== 0 && 'border-l border-gray-600'}
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="cardStyle"
|
|
||||||
value={option}
|
|
||||||
checked={settings.cardStyle === option}
|
|
||||||
onChange={() => tuneRadio(option)}
|
|
||||||
className="sr-only"
|
|
||||||
/>
|
|
||||||
{option}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
) : null;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import BuyMeACoffee from '@/components/BuyMeACoffee';
|
|
||||||
import GitHubButton from '@/components/GitHubButton';
|
|
||||||
|
|
||||||
export default function CardStyle({ className }: { className?: string }) {
|
|
||||||
return (
|
|
||||||
<span className={`w-full flex flex-row justify-between ${className}`}>
|
|
||||||
<GitHubButton className="h-[35px] w-[125px]" />
|
|
||||||
<BuyMeACoffee className="h-[35px] w-[125px]" />
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
|
||||||
import CopyButton from '@/components/CopyButton';
|
|
||||||
|
|
||||||
export default function Links({ className }: { className?: string }) {
|
|
||||||
const { gameData, isDM } = useAppContext();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={`w-full flex flex-col justify-between gap-2 ${className}`}>
|
|
||||||
{isDM && (
|
|
||||||
<CopyButton
|
|
||||||
title="Copy DM link"
|
|
||||||
copy={`${location.origin}/${gameData.dmID}`}
|
|
||||||
tooltip={`${location.origin}/${gameData.dmID}`}
|
|
||||||
className="flex flex-row content-between w-full py-1 px-2 transition-all duration-250 bg-slate-700 hover:bg-slate-600 hover:text-yellow-300 rounded-lg shadow"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<CopyButton
|
|
||||||
title="Copy Spectator link"
|
|
||||||
copy={`${location.origin}/${gameData.spectatorID}`}
|
|
||||||
tooltip={`${location.origin}/${gameData.spectatorID}`}
|
|
||||||
className="flex flex-row content-between w-full py-1 px-2 transition-all duration-250 bg-slate-700 hover:bg-slate-600 hover:text-yellow-300 rounded-lg shadow"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
|
||||||
import Switch from '@/components/Switch';
|
|
||||||
import { LOCAL_SETTINGS, SPECTATOR_SETTINGS } from '@/constants';
|
|
||||||
|
|
||||||
export default function Permissions() {
|
|
||||||
const { gameData, isDM, settings, emitSettings, setLocalSettings } = useAppContext();
|
|
||||||
|
|
||||||
const togglePermission = (key: string) => {
|
|
||||||
if (LOCAL_SETTINGS.includes(key)) {
|
|
||||||
setLocalSettings((prev) => ({ ...prev, [key]: !prev[key] }));
|
|
||||||
} else if (isDM) {
|
|
||||||
emitSettings({
|
|
||||||
...gameData,
|
|
||||||
settings: {
|
|
||||||
...gameData.settings,
|
|
||||||
[key]: !gameData.settings[key],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{Object.entries(settings)
|
|
||||||
.filter(([_key, value]) => typeof value === 'boolean')
|
|
||||||
.filter(([key]) => isDM || SPECTATOR_SETTINGS.includes(key))
|
|
||||||
.map(([key, value]) => (
|
|
||||||
<Switch key={key} label={key} value={value} toggleAction={() => togglePermission(key)} />
|
|
||||||
))}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { CircleX, Settings as Gear } from 'lucide-react';
|
|
||||||
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
|
||||||
import Scrim from '@/components/Scrim';
|
|
||||||
|
|
||||||
import CardStyle from './CardStyle';
|
|
||||||
import ExternalLinks from './ExternalLinks';
|
|
||||||
import GameLinks from './GameLinks';
|
|
||||||
import Permissions from './Permissions';
|
|
||||||
|
|
||||||
export default function Settings() {
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const { isDM } = useAppContext();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={`fixed top-4 right-4 z-25`}>
|
|
||||||
<Scrim
|
|
||||||
clickAction={() => setOpen((prev) => !prev)}
|
|
||||||
className={`transition-all duration-250 ${open ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'}`}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className={`
|
|
||||||
fixed top-4 right-4
|
|
||||||
flex flex-col items-center justify-between
|
|
||||||
bg-slate-800 text-yellow-400
|
|
||||||
rounded-lg border border-yellow-400
|
|
||||||
h-full p-8
|
|
||||||
transition-all duration-250
|
|
||||||
${open ? `opacity-100 ${isDM ? 'w-[350px] max-h-[425px]' : 'w-[325px] max-h-[200px]'}` : 'opacity-0 w-0 max-h-0'}
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
<GameLinks />
|
|
||||||
<Permissions />
|
|
||||||
<CardStyle />
|
|
||||||
<ExternalLinks />
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
className={`fixed top-4 right-4 p-2 transition-all duration-250 text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700] cursor-pointer`}
|
|
||||||
onClick={() => setOpen((prev) => !prev)}
|
|
||||||
>
|
|
||||||
<CircleX className="w-5 h-5" />
|
|
||||||
</button>
|
|
||||||
</Scrim>
|
|
||||||
<button
|
|
||||||
className={`p-2 transition-all duration-250 text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700] cursor-pointer`}
|
|
||||||
onClick={() => setOpen((prev) => !prev)}
|
|
||||||
>
|
|
||||||
<Gear className="w-5 h-5" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
|
||||||
import { useAppContext } from '@/app/AppContext';
|
|
||||||
import { validTilt } from '@/tools';
|
|
||||||
|
|
||||||
const tiltSheen = (sheen: HTMLDivElement, x: number, y: number) => {
|
|
||||||
const rect = sheen.getBoundingClientRect();
|
|
||||||
const sheenX = rect.width - x * rect.width;
|
|
||||||
const sheenY = rect.height - y * rect.height;
|
|
||||||
|
|
||||||
sheen.style.opacity = '1';
|
|
||||||
sheen.style.backgroundImage = `
|
|
||||||
radial-gradient(
|
|
||||||
circle at
|
|
||||||
${sheenX}px ${sheenY}px,
|
|
||||||
#ffffff44,
|
|
||||||
#0000000f
|
|
||||||
)
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function Sheen({ cardIndex, className }: { cardIndex: number; className?: string }) {
|
|
||||||
const sheenRef = useRef<HTMLDivElement>(null);
|
|
||||||
const [untilt, setUntilt] = useState(false);
|
|
||||||
const { tilts } = useAppContext();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const sheen = sheenRef.current;
|
|
||||||
if (!sheen) return;
|
|
||||||
|
|
||||||
const tilt = tilts[cardIndex];
|
|
||||||
|
|
||||||
if (validTilt(tilt)) {
|
|
||||||
setUntilt(false);
|
|
||||||
tiltSheen(sheen, tilt.percentX, tilt.percentY);
|
|
||||||
} else {
|
|
||||||
setUntilt(true);
|
|
||||||
}
|
|
||||||
}, [tilts]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const sheen = sheenRef.current;
|
|
||||||
if (!sheen || !untilt) return;
|
|
||||||
|
|
||||||
sheen.style.opacity = '0';
|
|
||||||
}, [untilt]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
ref={sheenRef}
|
|
||||||
className={`
|
|
||||||
absolute inset-0
|
|
||||||
rounded-lg pointer-events-none
|
|
||||||
transition-opacity duration-500
|
|
||||||
bg-gradient-to-tr from-transparent via-white/20 to-transparent mix-blend-screen opacity-0
|
|
||||||
${className}
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,44 +1,25 @@
|
|||||||
import type { ChangeEventHandler } from 'react';
|
|
||||||
|
|
||||||
export interface SwitchProps {
|
export interface SwitchProps {
|
||||||
label: string;
|
label: string;
|
||||||
value: boolean;
|
value: boolean;
|
||||||
toggleAction: ChangeEventHandler<HTMLInputElement>;
|
toggleAction: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
||||||
className?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const nonInitialCaps = /(?!^)([A-Z])/g;
|
export default function Switch({ label, value, toggleAction }: SwitchProps) {
|
||||||
|
|
||||||
export default function Switch({ label, value, toggleAction, className }: SwitchProps) {
|
|
||||||
return (
|
return (
|
||||||
<label
|
<label className="flex items-center justify-between w-full gap-2 cursor-pointer text-yellow-400 hover:text-yellow-300">
|
||||||
className={`flex items-center justify-between gap-2 w-full cursor-pointer text-yellow-400 hover:text-yellow-300 ${className}`}
|
<span className="text-sm capitalize">{label}</span>
|
||||||
>
|
|
||||||
<span className="text-sm capitalize">{label.replace(nonInitialCaps, ' $1')}</span>
|
|
||||||
|
|
||||||
<div className="relative inline-block w-8 h-4 align-middle select-none transition duration-200 ease-in">
|
<div className="relative inline-block w-8 h-4 align-middle select-none transition duration-200 ease-in">
|
||||||
<input
|
<input type="checkbox" checked={value} onChange={toggleAction} className="sr-only" />
|
||||||
id={`switch-${label}`}
|
<div
|
||||||
type="checkbox"
|
className={`block w-8 h-4 rounded-full transition ${
|
||||||
checked={value}
|
value ? 'bg-slate-500' : 'bg-slate-600'
|
||||||
onChange={toggleAction}
|
}`}
|
||||||
className="sr-only peer"
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`absolute top-[2px] left-[2px] w-3 h-3 rounded-full transition-all duration-250 ease-out transform
|
||||||
block w-8 h-4 rounded-full
|
${value ? 'translate-x-4 scale-110' : 'scale-95'}
|
||||||
transition-colors duration-200 ease-in
|
${value ? 'bg-yellow-400' : 'bg-yellow-500'}`}
|
||||||
bg-slate-600 peer-checked:bg-slate-500
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
className={`
|
|
||||||
absolute top-[2px] left-[2px]
|
|
||||||
w-3 h-3 rounded-full
|
|
||||||
transition-all duration-250 ease-out
|
|
||||||
translate-x-0 scale-95 bg-yellow-500
|
|
||||||
peer-checked:translate-x-4 peer-checked:scale-110 peer-checked:bg-yellow-400
|
|
||||||
`}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function TarokkaGrid() {
|
|||||||
const arrangeCards = (_cell: unknown, index: number) => cards[cardMap[index]];
|
const arrangeCards = (_cell: unknown, index: number) => cards[cardMap[index]];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-3 grid-rows-3 gap-2 sm:gap-4 md:gap-8 w-fit mx-auto">
|
<div className="grid grid-cols-3 grid-rows-3 gap-8 w-fit mx-auto">
|
||||||
{Array.from({ length: 9 })
|
{Array.from({ length: 9 })
|
||||||
.map(arrangeCards)
|
.map(arrangeCards)
|
||||||
.map((card, index) => (
|
.map((card, index) => (
|
||||||
|
|||||||
@@ -1,12 +1,30 @@
|
|||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { useAppContext } from '@/app/AppContext';
|
import { useAppContext } from '@/app/AppContext';
|
||||||
import { throttle, validTilt } from '@/tools';
|
import throttle from '@/tools/throttle';
|
||||||
|
|
||||||
import { thirtyFPS } from '@/constants/time';
|
import { thirtyFPS } from '@/constants/time';
|
||||||
import type { Tilt } from '@/types';
|
import type { Tilt } from '@/types';
|
||||||
|
|
||||||
const ZERO_ROTATION = 'rotateX(0deg) rotateY(0deg)';
|
const ZERO_ROTATION = 'rotateX(0deg) rotateY(0deg)';
|
||||||
|
|
||||||
|
const tiltSheen = (sheen: HTMLDivElement, tiltX: number, tiltY: number) => {
|
||||||
|
const rect = sheen.getBoundingClientRect();
|
||||||
|
const centerX = rect.width / 2;
|
||||||
|
const centerY = rect.height / 2;
|
||||||
|
const sheenX = centerX + (tiltY / -20) * centerX;
|
||||||
|
const sheenY = centerY + (tiltX / 20) * centerY;
|
||||||
|
|
||||||
|
sheen.style.opacity = '1';
|
||||||
|
sheen.style.backgroundImage = `
|
||||||
|
radial-gradient(
|
||||||
|
circle at
|
||||||
|
${sheenX}px ${sheenY}px,
|
||||||
|
#ffffff44,
|
||||||
|
#0000000f
|
||||||
|
)
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
export default function TiltCard({
|
export default function TiltCard({
|
||||||
children,
|
children,
|
||||||
cardIndex,
|
cardIndex,
|
||||||
@@ -17,88 +35,91 @@ export default function TiltCard({
|
|||||||
className?: string;
|
className?: string;
|
||||||
}) {
|
}) {
|
||||||
const cardRef = useRef<HTMLDivElement>(null);
|
const cardRef = useRef<HTMLDivElement>(null);
|
||||||
|
const sheenRef = useRef<HTMLDivElement>(null);
|
||||||
const [untilt, setUntilt] = useState(false);
|
const [untilt, setUntilt] = useState(false);
|
||||||
const { settings, tilts, setLocalTilt } = useAppContext();
|
const {
|
||||||
|
gameData,
|
||||||
|
settings: { tilt, remoteTilt },
|
||||||
|
setTilt,
|
||||||
|
tilt: localTilts,
|
||||||
|
} = useAppContext();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const card = cardRef.current;
|
const card = cardRef.current;
|
||||||
if (!card) return;
|
const sheen = sheenRef.current;
|
||||||
|
if (!card || !sheen) return;
|
||||||
|
|
||||||
const tilt = tilts[cardIndex];
|
if (tilt) {
|
||||||
|
const rotateX = localTilts[cardIndex]?.rotateX || 0;
|
||||||
|
const rotateY = localTilts[cardIndex]?.rotateY || 0;
|
||||||
|
|
||||||
if (validTilt(tilt)) {
|
const tilts = remoteTilt
|
||||||
|
? [...gameData.tilts[cardIndex], { rotateX, rotateY }]
|
||||||
|
: [{ rotateX, rotateY }];
|
||||||
|
|
||||||
|
const { totalX, totalY, count } = tilts
|
||||||
|
.filter(({ rotateX, rotateY }) => !!rotateX && !!rotateY)
|
||||||
|
.reduce(
|
||||||
|
({ totalX, totalY, count }, { rotateX, rotateY }) => ({
|
||||||
|
totalX: totalX + rotateX,
|
||||||
|
totalY: totalY + rotateY,
|
||||||
|
count: ++count,
|
||||||
|
}),
|
||||||
|
{ totalX: 0, totalY: 0, count: 0 },
|
||||||
|
);
|
||||||
|
|
||||||
|
if (count && (totalX || totalY)) {
|
||||||
setUntilt(false);
|
setUntilt(false);
|
||||||
card.style.transform = `rotateX(${tilt.rotateX}deg) rotateY(${tilt.rotateY}deg)`;
|
|
||||||
|
const x = totalX / count;
|
||||||
|
const y = totalY / count;
|
||||||
|
|
||||||
|
card.style.transform = `rotateX(${x}deg) rotateY(${y}deg)`;
|
||||||
|
tiltSheen(sheen, x, y);
|
||||||
} else {
|
} else {
|
||||||
setUntilt(true);
|
setUntilt(true);
|
||||||
}
|
}
|
||||||
}, [tilts]);
|
} else if (card.style.transform !== ZERO_ROTATION) {
|
||||||
|
setUntilt(true);
|
||||||
|
}
|
||||||
|
}, [tilt, localTilts, gameData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const card = cardRef.current;
|
const card = cardRef.current;
|
||||||
if (!card || !untilt) return;
|
const sheen = sheenRef.current;
|
||||||
|
if (!card || !sheen || !untilt) return;
|
||||||
|
|
||||||
card.style.transform = ZERO_ROTATION;
|
card.style.transform = ZERO_ROTATION;
|
||||||
|
sheen.style.opacity = '0';
|
||||||
}, [untilt]);
|
}, [untilt]);
|
||||||
|
|
||||||
const handleTilt = (x: number, y: number) => {
|
const handleMouseMove = throttle((e: React.MouseEvent) => {
|
||||||
const card = cardRef.current;
|
const card = cardRef.current;
|
||||||
if (!card) return;
|
if (!card) return;
|
||||||
|
|
||||||
const rect = card.getBoundingClientRect();
|
const rect = card.getBoundingClientRect();
|
||||||
x -= rect.left;
|
const x = e.clientX - rect.left;
|
||||||
y -= rect.top;
|
const y = e.clientY - rect.top;
|
||||||
|
|
||||||
const centerX = rect.width / 2;
|
const centerX = rect.width / 2;
|
||||||
const centerY = rect.height / 2;
|
const centerY = rect.height / 2;
|
||||||
|
|
||||||
const rotateX = ((y - centerY) / centerY) * -20;
|
const rotateX = ((y - centerY) / centerY) * -20;
|
||||||
const rotateY = ((x - centerX) / centerX) * 20;
|
const rotateY = ((x - centerX) / centerX) * 20;
|
||||||
const percentX = x / rect.width;
|
|
||||||
const percentY = y / rect.height;
|
|
||||||
|
|
||||||
const newTilt: Tilt[] = [];
|
const newTilt: Tilt[] = [];
|
||||||
newTilt[cardIndex] = {
|
newTilt[cardIndex] = { rotateX, rotateY };
|
||||||
percentX,
|
|
||||||
percentY,
|
|
||||||
rotateX,
|
|
||||||
rotateY,
|
|
||||||
};
|
|
||||||
|
|
||||||
setLocalTilt(newTilt);
|
setTilt(newTilt);
|
||||||
};
|
|
||||||
|
|
||||||
const handleMouseMove = throttle((e: React.MouseEvent) => {
|
|
||||||
handleTilt(e.clientX, e.clientY);
|
|
||||||
}, thirtyFPS);
|
|
||||||
|
|
||||||
const handleTouchMove = throttle((e: React.TouchEvent) => {
|
|
||||||
const card = cardRef.current;
|
|
||||||
const touch = e.touches[0];
|
|
||||||
|
|
||||||
if (card && touch) {
|
|
||||||
const rect = card.getBoundingClientRect();
|
|
||||||
const x = touch.clientX;
|
|
||||||
const y = touch.clientY;
|
|
||||||
|
|
||||||
if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
|
|
||||||
handleTilt(x, y);
|
|
||||||
} else {
|
|
||||||
setLocalTilt([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, thirtyFPS);
|
}, thirtyFPS);
|
||||||
|
|
||||||
const handleMouseLeave = () => {
|
const handleMouseLeave = () => {
|
||||||
setLocalTilt([]);
|
setTilt([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`group ${className}`}
|
className={`group ${className}`}
|
||||||
onMouseMove={settings.tilt ? handleMouseMove : undefined}
|
onMouseMove={tilt ? handleMouseMove : undefined}
|
||||||
onTouchMove={settings.tilt ? handleTouchMove : undefined}
|
|
||||||
onTouchEnd={handleMouseLeave}
|
|
||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -107,6 +128,10 @@ export default function TiltCard({
|
|||||||
className={`h-full w-full transition-transform ${untilt ? 'duration-500' : 'duration-0'}`}
|
className={`h-full w-full transition-transform ${untilt ? 'duration-500' : 'duration-0'}`}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
<div
|
||||||
|
ref={sheenRef}
|
||||||
|
className="pointer-events-none absolute inset-0 rounded-lg bg-gradient-to-tr from-transparent via-white/20 to-transparent mix-blend-screen opacity-0 transition-opacity duration-500"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import type { GameUpdate, LocalSettings, Settings } from '@/types';
|
|||||||
|
|
||||||
export const SETTINGS: Settings = {
|
export const SETTINGS: Settings = {
|
||||||
cardStyle: 'color',
|
cardStyle: 'color',
|
||||||
notes: true,
|
notes: false,
|
||||||
positionBack: true,
|
positionBack: false,
|
||||||
positionFront: true,
|
positionFront: false,
|
||||||
prophecy: true,
|
prophecy: false,
|
||||||
tilt: true,
|
tilt: true,
|
||||||
remoteTilt: true,
|
remoteTilt: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GAME_START: GameUpdate = {
|
export const GAME_START: GameUpdate = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { socket } from '@/socket';
|
import { socket } from '@/socket';
|
||||||
import type { GameUpdate, Tilt } from '@/types';
|
import type { GameUpdate, Tilt } from '@/types';
|
||||||
|
|
||||||
@@ -9,15 +9,11 @@ interface UseSocketProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketProps) {
|
export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketProps) {
|
||||||
const [connect, setConnect] = useState(1);
|
|
||||||
const [disconnected, setDisconnected] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gameID) {
|
if (gameID) {
|
||||||
socket.emit('join', gameID);
|
socket.emit('join', gameID);
|
||||||
|
|
||||||
socket.on('init', (data: GameUpdate) => {
|
socket.on('init', (data: GameUpdate) => {
|
||||||
setDisconnected(false);
|
|
||||||
setGameData(data);
|
setGameData(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -35,20 +31,14 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
|
|||||||
socket.on('flip-error', (error) => {
|
socket.on('flip-error', (error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('disconnect', () => {
|
|
||||||
setDisconnected(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
socket.removeAllListeners();
|
socket.removeAllListeners();
|
||||||
};
|
};
|
||||||
}, [gameID, connect]);
|
}, [gameID]);
|
||||||
|
|
||||||
const emitFlip = (cardIndex: number) => {
|
const emitFlip = (cardIndex: number) => {
|
||||||
if (disconnected) setConnect(connect + 1);
|
|
||||||
|
|
||||||
socket.emit('flip-card', {
|
socket.emit('flip-card', {
|
||||||
gameID,
|
gameID,
|
||||||
cardIndex,
|
cardIndex,
|
||||||
@@ -56,8 +46,6 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
|
|||||||
};
|
};
|
||||||
|
|
||||||
const emitSettings = (gameData: GameUpdate) => {
|
const emitSettings = (gameData: GameUpdate) => {
|
||||||
if (disconnected) setConnect(connect + 1);
|
|
||||||
|
|
||||||
socket.emit('settings', {
|
socket.emit('settings', {
|
||||||
gameID,
|
gameID,
|
||||||
gameData,
|
gameData,
|
||||||
@@ -65,8 +53,6 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
|
|||||||
};
|
};
|
||||||
|
|
||||||
const emitRedraw = (cardIndex: number) => {
|
const emitRedraw = (cardIndex: number) => {
|
||||||
if (disconnected) setConnect(connect + 1);
|
|
||||||
|
|
||||||
socket.emit('redraw', {
|
socket.emit('redraw', {
|
||||||
gameID,
|
gameID,
|
||||||
cardIndex,
|
cardIndex,
|
||||||
@@ -74,8 +60,6 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
|
|||||||
};
|
};
|
||||||
|
|
||||||
const emitSelect = (cardIndex: number, cardID: string) => {
|
const emitSelect = (cardIndex: number, cardID: string) => {
|
||||||
if (disconnected) setConnect(connect + 1);
|
|
||||||
|
|
||||||
socket.emit('select', {
|
socket.emit('select', {
|
||||||
gameID,
|
gameID,
|
||||||
cardIndex,
|
cardIndex,
|
||||||
@@ -84,8 +68,6 @@ export default function useSocket({ gameID, setGameData, setNoGame }: UseSocketP
|
|||||||
};
|
};
|
||||||
|
|
||||||
const emitTilt = (cardIndex: number, tilt: Tilt) => {
|
const emitTilt = (cardIndex: number, tilt: Tilt) => {
|
||||||
if (disconnected) setConnect(connect + 1);
|
|
||||||
|
|
||||||
socket.emit('tilt', {
|
socket.emit('tilt', {
|
||||||
cardIndex,
|
cardIndex,
|
||||||
tilt,
|
tilt,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Deck from '@/lib/TarokkaDeck';
|
import Deck from '@/lib/TarokkaDeck';
|
||||||
import { generateID, parseMilliseconds } from '@/tools';
|
import generateID from '@/tools/simpleID';
|
||||||
|
import parseMilliseconds from '@/tools/parseMilliseconds';
|
||||||
|
|
||||||
import { HOUR, DAY, SETTINGS } from '@/constants';
|
import { HOUR, DAY, SETTINGS } from '@/constants';
|
||||||
import { GameState, GameUpdate, Settings, Tilt } from '@/types';
|
import { GameState, GameUpdate, Settings, Tilt } from '@/types';
|
||||||
@@ -156,7 +157,7 @@ export default class GameStore {
|
|||||||
return this.gameUpdate(game);
|
return this.gameUpdate(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
tilt(playerID: string, cardIndex: number, tilt: Tilt) {
|
tilt(playerID: string, cardIndex: number, { rotateX, rotateY }: Tilt) {
|
||||||
const game = this.getGameByPlayerID(playerID);
|
const game = this.getGameByPlayerID(playerID);
|
||||||
const cardTilts = game.tilts[cardIndex];
|
const cardTilts = game.tilts[cardIndex];
|
||||||
|
|
||||||
@@ -164,8 +165,8 @@ export default class GameStore {
|
|||||||
|
|
||||||
this._clearTilts(game, playerID);
|
this._clearTilts(game, playerID);
|
||||||
|
|
||||||
if (tilt.rotateX && tilt.rotateY) {
|
if (rotateX && rotateY) {
|
||||||
game.tilts[cardIndex] = [...game.tilts[cardIndex], { ...tilt, playerID }];
|
game.tilts[cardIndex] = [...game.tilts[cardIndex], { playerID, rotateX, rotateY }];
|
||||||
game.lastUpdated = Date.now();
|
game.lastUpdated = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getRandomItems } from '@/tools';
|
import getRandomItems from '@/tools/getRandomItems';
|
||||||
import cards from '@/constants/standardCards';
|
import cards from '@/constants/standardCards';
|
||||||
import type { StandardCard } from '@/types';
|
import type { StandardCard } from '@/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getRandomItems } from '@/tools';
|
import getRandomItems from '@/tools/getRandomItems';
|
||||||
import cards from '@/constants/tarokkaCards';
|
import cards from '@/constants/tarokkaCards';
|
||||||
import type { TarokkaCard, TarokkaGameCard } from '@/types';
|
import type { TarokkaCard, TarokkaGameCard } from '@/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import type { NextRequest } from 'next/server';
|
import type { NextRequest } from 'next/server';
|
||||||
|
|
||||||
export function proxy(request: NextRequest) {
|
export function middleware(request: NextRequest) {
|
||||||
const url = request.nextUrl;
|
const url = request.nextUrl;
|
||||||
const slug = url.pathname.slice(1);
|
const slug = url.pathname.slice(1);
|
||||||
|
|
||||||
2044
package-lock.json
generated
2044
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tarokka",
|
"name": "tarokka",
|
||||||
"version": "1.1.2",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon",
|
"dev": "nodemon",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.9 MiB After Width: | Height: | Size: 2.5 MiB |
@@ -3,7 +3,7 @@ import { createServer } from 'http';
|
|||||||
import { Server as SocketIOServer, type Socket } from 'socket.io';
|
import { Server as SocketIOServer, type Socket } from 'socket.io';
|
||||||
|
|
||||||
import GameStore from '@/lib/GameStore';
|
import GameStore from '@/lib/GameStore';
|
||||||
import { omit } from '@/tools';
|
import omit from '@/tools/omit';
|
||||||
|
|
||||||
import { thirtyFPS } from '@/constants/time';
|
import { thirtyFPS } from '@/constants/time';
|
||||||
import type { ClientUpdate, GameUpdate, Tilt } from '@/types';
|
import type { ClientUpdate, GameUpdate, Tilt } from '@/types';
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { isHighCard, isLowCard } from '@/tools';
|
import { isHighCard, isLowCard } from '@/tools/cardTypes';
|
||||||
import { Layout, Settings, TarokkaGameCard } from '@/types';
|
import { Layout, Settings, TarokkaGameCard } from '@/types';
|
||||||
|
|
||||||
export const getCardInfo = (
|
export default function getTooltip(
|
||||||
card: TarokkaGameCard,
|
card: TarokkaGameCard,
|
||||||
position: Layout,
|
position: Layout,
|
||||||
dm: boolean,
|
dm: boolean,
|
||||||
settings: Settings,
|
settings: Settings,
|
||||||
) => {
|
) {
|
||||||
const { card: cardName, description, flipped } = card;
|
const { card: cardName, description, flipped } = card;
|
||||||
|
|
||||||
let text: string[] = [];
|
let text: string[] = [];
|
||||||
@@ -39,4 +39,4 @@ export const getCardInfo = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const getRandomItems = <T>(items: T[], count: number): T[] => {
|
export default function getRandomItems<T>(items: T[], count: number): T[] {
|
||||||
const shuffled = [...items];
|
const shuffled = [...items];
|
||||||
|
|
||||||
// Fisher-Yates shuffle
|
// Fisher-Yates shuffle
|
||||||
@@ -8,4 +8,4 @@ export const getRandomItems = <T>(items: T[], count: number): T[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return count > shuffled.length ? shuffled : shuffled.slice(0, count);
|
return count > shuffled.length ? shuffled : shuffled.slice(0, count);
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { cardStyles, standardMap } from '@/constants/tarokka';
|
import { cardStyles, standardMap } from '@/constants/tarokka';
|
||||||
import { Settings, TarokkaCard, TarokkaGameCard } from '@/types';
|
import { Settings, TarokkaCard, TarokkaGameCard } from '@/types';
|
||||||
|
|
||||||
export const getURL = (card: TarokkaCard | TarokkaGameCard, settings: Settings) => {
|
export default function getURL(card: TarokkaCard | TarokkaGameCard, settings: Settings) {
|
||||||
const styleConfig = cardStyles[settings.cardStyle];
|
const styleConfig = cardStyles[settings.cardStyle];
|
||||||
const fileBase = settings.cardStyle === 'standard' ? standardMap[card.id] : card.id;
|
const fileBase = settings.cardStyle === 'standard' ? standardMap[card.id] : card.id;
|
||||||
return `${styleConfig.baseURL}${fileBase}${card.extension || styleConfig.extension}`;
|
return `${styleConfig.baseURL}${fileBase}${card.extension || styleConfig.extension}`;
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
export * from '@/tools/cardTypes';
|
|
||||||
export * from '@/tools/getCardInfo';
|
|
||||||
export * from '@/tools/getRandomItems';
|
|
||||||
export * from '@/tools/getURL';
|
|
||||||
export * from '@/tools/log';
|
|
||||||
export * from '@/tools/omit';
|
|
||||||
export * from '@/tools/parseMilliseconds';
|
|
||||||
export * from '@/tools/reduceTilts';
|
|
||||||
export * from '@/tools/simpleID';
|
|
||||||
export * from '@/tools/throttle';
|
|
||||||
export * from '@/tools/validTilt';
|
|
||||||
19
tools/log.ts
19
tools/log.ts
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* A logging utility designed to be inserted into functional chains.
|
|
||||||
* Logs all parameters with an optional prefix, then returns the first argument unchanged.
|
|
||||||
*
|
|
||||||
* @param {string} [prefix=''] - A label or message to prepend to the logged output.
|
|
||||||
* @returns {(value: any, ...rest: any[]) => any} - A function that logs its arguments and returns the first one.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const result = [1, 2, 3]
|
|
||||||
* .map((n) => n * 2)
|
|
||||||
* .map(log('doubled:'))
|
|
||||||
* .filter((n) => n > 2);
|
|
||||||
*/
|
|
||||||
export const log =
|
|
||||||
(prefix: string = ''): ((value: any, ...rest: any[]) => any) =>
|
|
||||||
(...args: any[]) => {
|
|
||||||
console.log(prefix, ...args);
|
|
||||||
return args[0];
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
export const omit = <T extends Record<string, any>>(
|
export default function omit<T extends Record<string, any>>(
|
||||||
obj: T,
|
obj: T,
|
||||||
propToRemove: keyof T,
|
propToRemove: keyof T,
|
||||||
): Omit<T, typeof propToRemove> => {
|
): Omit<T, typeof propToRemove> {
|
||||||
const { [propToRemove]: _, ...rest } = obj;
|
const { [propToRemove]: _, ...rest } = obj;
|
||||||
return rest;
|
return rest;
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface ParsedMilliseconds {
|
|||||||
seconds: number;
|
seconds: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseMilliseconds = (timestamp: number): ParsedMilliseconds => {
|
export default function parseMilliseconds(timestamp: number): ParsedMilliseconds {
|
||||||
const days = Math.floor(timestamp / DAY);
|
const days = Math.floor(timestamp / DAY);
|
||||||
timestamp %= DAY;
|
timestamp %= DAY;
|
||||||
|
|
||||||
@@ -21,4 +21,4 @@ export const parseMilliseconds = (timestamp: number): ParsedMilliseconds => {
|
|||||||
timestamp %= SECOND;
|
timestamp %= SECOND;
|
||||||
|
|
||||||
return { days, hours, minutes, seconds };
|
return { days, hours, minutes, seconds };
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import { validTilt } from '@/tools';
|
|
||||||
import { GameUpdate, Settings, Tilt } from '@/types';
|
|
||||||
|
|
||||||
const combineTilts = (tilts: Tilt[]) =>
|
|
||||||
tilts.reduce(
|
|
||||||
({ pX, pY, rX, rY, count }, { percentX, percentY, rotateX, rotateY }) => ({
|
|
||||||
pX: pX + percentX,
|
|
||||||
pY: pY + percentY,
|
|
||||||
rX: rX + rotateX,
|
|
||||||
rY: rY + rotateY,
|
|
||||||
count: count + 1,
|
|
||||||
}),
|
|
||||||
{ pX: 0, pY: 0, rX: 0, rY: 0, count: 0 },
|
|
||||||
);
|
|
||||||
|
|
||||||
export function reduceTilts(
|
|
||||||
gameData: GameUpdate,
|
|
||||||
localTilt: Tilt[],
|
|
||||||
{ tilt, remoteTilt }: Settings,
|
|
||||||
): Tilt[] {
|
|
||||||
const remoteTilts = gameData.tilts;
|
|
||||||
|
|
||||||
if (!tilt) return [];
|
|
||||||
if (!remoteTilt) return localTilt;
|
|
||||||
|
|
||||||
return Array.from({ length: 5 }, (_, i) => (localTilt[i] ? [localTilt[i]] : []))
|
|
||||||
.map((cardTilts, cardIndex) => [...remoteTilts[cardIndex], ...cardTilts])
|
|
||||||
.map((cardTilts) => cardTilts.filter(validTilt))
|
|
||||||
.map(combineTilts)
|
|
||||||
.map(({ pX, pY, rX, rY, count }) => ({
|
|
||||||
percentX: count ? pX / count : -1,
|
|
||||||
percentY: count ? pY / count : -1,
|
|
||||||
rotateX: count ? rX / count : 0,
|
|
||||||
rotateY: count ? rY / count : 0,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { getRandomItems } from '@/tools';
|
import getRandomItems from '@/tools/getRandomItems';
|
||||||
|
|
||||||
const alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';
|
const alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||||
|
|
||||||
export const generateID = (length: number = 6) => {
|
const generateID = (length: number = 6) => {
|
||||||
return getRandomItems(alphabet.split(''), length).join('');
|
return getRandomItems(alphabet.split(''), length).join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default generateID;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export function throttle(func: Function, threshold: number) {
|
export default function throttle(func: Function, threshold: number) {
|
||||||
let lastCall = 0;
|
let lastCall = 0;
|
||||||
|
|
||||||
return (...args: any[]) => {
|
return (...args: any[]) => {
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Tilt } from '@/types';
|
|
||||||
|
|
||||||
export const validTilt = (tilt: Tilt) => {
|
|
||||||
if (!tilt) return false;
|
|
||||||
|
|
||||||
const { percentX, percentY, rotateX, rotateY } = tilt;
|
|
||||||
|
|
||||||
return percentX >= 0 && percentY >= 0 && !!rotateX && !!rotateY;
|
|
||||||
};
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
@@ -16,7 +12,7 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "preserve",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
@@ -24,20 +20,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["./*"]
|
||||||
"./*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"strictNullChecks": true
|
"strictNullChecks": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules"]
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".next/types/**/*.ts",
|
|
||||||
".next/dev/types/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,8 +115,6 @@ export interface Layout {
|
|||||||
|
|
||||||
export interface Tilt {
|
export interface Tilt {
|
||||||
playerID?: string;
|
playerID?: string;
|
||||||
percentX: number;
|
|
||||||
percentY: number;
|
|
||||||
rotateX: number;
|
rotateX: number;
|
||||||
rotateY: number;
|
rotateY: number;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user