diff --git a/index.html b/index.html
index b91c1e7..d26664d 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/src/api/endpoints/authentication.ts b/src/api/endpoints/authentication.ts
index 425ae18..9fbcb0a 100644
--- a/src/api/endpoints/authentication.ts
+++ b/src/api/endpoints/authentication.ts
@@ -13,7 +13,7 @@ export interface ILoginResponse {
export async function login(
username: string,
- password: string
+ password: string,
): Promise {
const data: ILoginRequest = {
username: username,
@@ -37,7 +37,7 @@ export interface ICreateUserResponse {
export async function createUser(
username: string,
- password: string
+ password: string,
): Promise {
const data: ILoginRequest = {
username: username,
diff --git a/src/api/endpoints/game.ts b/src/api/endpoints/game.ts
index f2f4a07..d6f370c 100644
--- a/src/api/endpoints/game.ts
+++ b/src/api/endpoints/game.ts
@@ -7,7 +7,7 @@ export interface IPostStartRequest {
export async function postStart(
tokens: string[],
- official: boolean
+ official: boolean,
): Promise {
const data: IPostStartRequest = {
tokens: tokens,
@@ -59,7 +59,7 @@ export interface ICard {
export async function postUpdate(gameState: IGameState): Promise {
return await client.post(
`/api/games/${gameState.id}/update_state/`,
- gameState
+ gameState,
);
}
@@ -89,7 +89,7 @@ export interface IResumableGame {
}
export async function getResumableGames(
- token: string
+ token: string,
): Promise {
const response = await client.get("/api/games/resumable/", {
headers: {
@@ -102,7 +102,7 @@ export async function getResumableGames(
export async function postResumeGame(
token: string,
- gameId: number
+ gameId: number,
): Promise {
const response = await client.post(
`/api/games/${gameId}/resume/`,
@@ -111,7 +111,7 @@ export async function postResumeGame(
headers: {
Authorization: `Token ${token}`,
},
- }
+ },
);
return response.data;
diff --git a/src/api/endpoints/stats.ts b/src/api/endpoints/stats.ts
index e4b9fe7..9a7ad0d 100644
--- a/src/api/endpoints/stats.ts
+++ b/src/api/endpoints/stats.ts
@@ -9,9 +9,8 @@ export interface IRankedCardResponse {
}
export async function getRankedCards(): Promise {
- const response = await client.get(
- "/api/ranked_cards/"
- );
+ const response =
+ await client.get("/api/ranked_cards/");
return response.data;
}
@@ -31,10 +30,10 @@ export interface IUserStatsResponse {
}
export async function getUserStats(
- userId: number
+ userId: number,
): Promise {
const response = await client.get(
- `/api/stats/${userId}/`
+ `/api/stats/${userId}/`,
);
return response.data;
}
diff --git a/src/api/inteceptors/token.ts b/src/api/inteceptors/token.ts
index e2eeba1..4c1c3e2 100644
--- a/src/api/inteceptors/token.ts
+++ b/src/api/inteceptors/token.ts
@@ -17,6 +17,6 @@ export function TokenInteceptor(inst: AxiosInstance) {
},
(error) => {
Promise.reject(error);
- }
+ },
);
}
diff --git a/src/components/CardFlash/dialog.tsx b/src/components/CardFlash/dialog.tsx
index 9805482..f20e714 100644
--- a/src/components/CardFlash/dialog.tsx
+++ b/src/components/CardFlash/dialog.tsx
@@ -9,7 +9,7 @@ interface CardFlashDialogProps {
const CardFlashDialog: FunctionComponent = (props) => {
const [cardImageURI, setCardImageURI] = useState(
- undefined
+ undefined,
);
useEffect(() => {
diff --git a/src/components/CardFlash/provider.tsx b/src/components/CardFlash/provider.tsx
index cf1b91c..c2f1e82 100644
--- a/src/components/CardFlash/provider.tsx
+++ b/src/components/CardFlash/provider.tsx
@@ -27,7 +27,7 @@ export interface flashCardOptions {
}
export const CardFlashProvider: FunctionComponent = (
- props
+ props,
) => {
const [show, setShow] = useState(false);
const [card, setCard] = useState();
diff --git a/src/components/SettingsDialog/index.tsx b/src/components/SettingsDialog/index.tsx
index 9ef91fb..8986fb1 100644
--- a/src/components/SettingsDialog/index.tsx
+++ b/src/components/SettingsDialog/index.tsx
@@ -13,7 +13,7 @@ import {
Select,
Slider,
Stack,
- Switch
+ Switch,
} from "@mui/material";
import { BsSpeakerFill } from "react-icons/bs";
import { FaGamepad, FaPencilRuler } from "react-icons/fa";
@@ -81,7 +81,7 @@ const SettingsDialog: FunctionComponent = () => {
checked={settings.themeMode === "dark"}
onChange={() => {
settings.SetThemeMode(
- settings.themeMode === "dark" ? "light" : "dark"
+ settings.themeMode === "dark" ? "light" : "dark",
);
}}
/>
diff --git a/src/components/Terminal/commands.ts b/src/components/Terminal/commands.ts
index ede1a97..90d9d2b 100644
--- a/src/components/Terminal/commands.ts
+++ b/src/components/Terminal/commands.ts
@@ -68,7 +68,7 @@ export const customCommands: Command[] = [
setTimeout(() => {
window.open(
"https://www.youtube.com/watch?v=q6EoRBvdVPQ&list=PLFsQleAWXsj_4yDeebiIADdH5FMayBiJo",
- "_blank"
+ "_blank",
);
}, 1000);
},
diff --git a/src/components/Terminal/index.tsx b/src/components/Terminal/index.tsx
index e22b78c..04d63a8 100644
--- a/src/components/Terminal/index.tsx
+++ b/src/components/Terminal/index.tsx
@@ -62,7 +62,7 @@ const Terminal: FunctionComponent = (props) => {
}
const commandObj = [...builtInCommands, ...customCommands].find(
- (c) => c.name === cmd
+ (c) => c.name === cmd,
);
if (commandObj === undefined) {
@@ -86,7 +86,7 @@ const Terminal: FunctionComponent = (props) => {
[...builtInCommands, customCommands[0], customCommands[1]].forEach(
(c) => {
buffer.write(` ${rightPad(c.name, 10)} ${c.description || ""}`);
- }
+ },
);
buffer.write(" and maybe more...");
@@ -120,14 +120,15 @@ const Terminal: FunctionComponent = (props) => {
files.forEach((f) => {
let perm = f.name.endsWith("/") ? "drwxr-xr-x" : "-rw-r--r--";
buffer.write(
- `${perm} root root ${rightPad(f.size || "", 5)} ${f.name}`
+ `${perm} root root ${rightPad(f.size || "", 5)} ${f.name}`,
);
});
},
},
{
name: "whoami",
- description: "print the user name associated with the current effective user ID.",
+ description:
+ "print the user name associated with the current effective user ID.",
execute: (args: string[], buffer: Buffer) => {
buffer.write("an idiot");
},
diff --git a/src/index.scss b/src/index.scss
index a10780a..12739f2 100644
--- a/src/index.scss
+++ b/src/index.scss
@@ -3,7 +3,8 @@
@font-face {
font-family: AUPassata;
src: url(https://www.aucdn.dk/fonts/aupassata_rg-webfont.eot);
- src: url(https://www.aucdn.dk/fonts/aupassata_rg-webfont.eot?#iefix)
+ src:
+ url(https://www.aucdn.dk/fonts/aupassata_rg-webfont.eot?#iefix)
format("embedded-opentype"),
url(https://www.aucdn.dk/fonts/aupassata_rg-webfont.woff2) format("woff2"),
url(https://www.aucdn.dk/fonts/aupassata_rg-webfont.woff) format("woff"),
@@ -16,7 +17,8 @@
@font-face {
font-family: AUPassata;
src: url(https://www.aucdn.dk/fonts/aupassata_bold-webfont.eot);
- src: url(https://www.aucdn.dk/fonts/aupassata_bold-webfont.eot?#iefix)
+ src:
+ url(https://www.aucdn.dk/fonts/aupassata_bold-webfont.eot?#iefix)
format("embedded-opentype"),
url(https://www.aucdn.dk/fonts/aupassata_bold-webfont.woff2) format("woff2"),
url(https://www.aucdn.dk/fonts/aupassata_bold-webfont.woff) format("woff"),
diff --git a/src/main.tsx b/src/main.tsx
index 6a7e790..dd7e3b3 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -23,5 +23,5 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
-
+ ,
);
diff --git a/src/stores/game.ts b/src/stores/game.ts
index 4c1845e..b2cc6bd 100644
--- a/src/stores/game.ts
+++ b/src/stores/game.ts
@@ -47,7 +47,7 @@ interface GameActions {
sipsInABeer: number;
numberOfRounds: number;
offline: boolean;
- }
+ },
) => Promise;
Draw: () => Card;
Exit: () => void;
@@ -85,7 +85,7 @@ const useGame = create()(
sipsInABeer: 14,
numberOfRounds: 13,
offline: false,
- }
+ },
) => {
console.debug("[Game]", "Starting game");
@@ -154,7 +154,7 @@ const useGame = create()(
mapToRemote({
...state,
...updates,
- })
+ }),
);
}
@@ -178,8 +178,8 @@ const useGame = create()(
}),
{
name: "game",
- }
- )
+ },
+ ),
);
export default useGame;
diff --git a/src/stores/gamesPlayed.ts b/src/stores/gamesPlayed.ts
index a23cfe3..41a1d14 100644
--- a/src/stores/gamesPlayed.ts
+++ b/src/stores/gamesPlayed.ts
@@ -19,8 +19,8 @@ const useGamesPlayed = create()(
}),
{
name: "computer-game-counts",
- }
- )
+ },
+ ),
);
export default useGamesPlayed;
diff --git a/src/stores/metrics.ts b/src/stores/metrics.ts
index f04bbb9..a2208c3 100644
--- a/src/stores/metrics.ts
+++ b/src/stores/metrics.ts
@@ -101,20 +101,20 @@ const MetricsStore = create()((set, get) => ({
const playerIndex = index % game.players.length;
acc[playerIndex].push(
- (acc[playerIndex][acc[playerIndex].length - 1] || 0) + card.value
+ (acc[playerIndex][acc[playerIndex].length - 1] || 0) + card.value,
);
return acc;
},
- Array.from({ length: game.players.length }, () => [0])
+ Array.from({ length: game.players.length }, () => [0]),
);
const totalSips = cumulativeSips.map(
- (cumulativeSips) => cumulativeSips[cumulativeSips.length - 1]
+ (cumulativeSips) => cumulativeSips[cumulativeSips.length - 1],
);
const numberOfBeers = totalSips.map((totalSips) =>
- Math.floor(totalSips / game.sipsInABeer)
+ Math.floor(totalSips / game.sipsInABeer),
);
const leadingPlayerIndex = totalSips.indexOf(Math.max(...totalSips));
diff --git a/src/stores/settings.ts b/src/stores/settings.ts
index a551715..c7ee331 100644
--- a/src/stores/settings.ts
+++ b/src/stores/settings.ts
@@ -45,8 +45,8 @@ const useSettings = create()(
}),
{
name: "settings",
- }
- )
+ },
+ ),
);
export default useSettings;
diff --git a/src/utilities/deck.ts b/src/utilities/deck.ts
index d269150..2254261 100644
--- a/src/utilities/deck.ts
+++ b/src/utilities/deck.ts
@@ -4,7 +4,7 @@ import { randInt } from "./random";
const GenerateDeck = (
shuffleIndices: number[],
- numberOfPlayers: number
+ numberOfPlayers: number,
): Card[] => {
if (shuffleIndices.length !== numberOfPlayers * CardValues.length) {
throw new Error("Number of players and shuffle indices mismatch!");
diff --git a/src/utilities/memes.ts b/src/utilities/memes.ts
index 47daf75..3b8152e 100644
--- a/src/utilities/memes.ts
+++ b/src/utilities/memes.ts
@@ -2,7 +2,7 @@ const API_KEY = "9KNValB7h2YKToE3kHZ9HKQepPH9KqFY";
export async function GetRandomMemeByTag(tag: string): Promise {
const resp = await fetch(
- "https://api.giphy.com/v1/gifs/random?api_key=" + API_KEY + "&tag=" + tag
+ "https://api.giphy.com/v1/gifs/random?api_key=" + API_KEY + "&tag=" + tag,
);
const { data, errors } = await resp.json();
diff --git a/src/views/Game/components/CardInventory.tsx b/src/views/Game/components/CardInventory.tsx
index d240960..e890d59 100644
--- a/src/views/Game/components/CardInventory.tsx
+++ b/src/views/Game/components/CardInventory.tsx
@@ -49,7 +49,7 @@ interface CardInventoryCardProps {
}
const CardInventoryCard: FunctionComponent = (
- props
+ props,
) => {
return (
= (props) => {
>
{player.username}
-
+
);
diff --git a/src/views/Game/components/ExitGameDialog.tsx b/src/views/Game/components/ExitGameDialog.tsx
index 3cccab8..f5ff87f 100644
--- a/src/views/Game/components/ExitGameDialog.tsx
+++ b/src/views/Game/components/ExitGameDialog.tsx
@@ -15,7 +15,7 @@ const ExitGameDialog: FunctionComponent = (props) => {
{
ok: false,
},
- "backdropClick"
+ "backdropClick",
)
}
onConfirm={() =>
@@ -23,7 +23,7 @@ const ExitGameDialog: FunctionComponent = (props) => {
{
ok: true,
},
- "backdropClick"
+ "backdropClick",
)
}
/>
diff --git a/src/views/Game/components/Header.tsx b/src/views/Game/components/Header.tsx
index 6c362f6..c251ef4 100644
--- a/src/views/Game/components/Header.tsx
+++ b/src/views/Game/components/Header.tsx
@@ -125,7 +125,7 @@ const Header: FunctionComponent = () => {
sound.play("click");
settings.SetThemeMode(
- settings.themeMode === "light" ? "dark" : "light"
+ settings.themeMode === "light" ? "dark" : "light",
);
}}
>
diff --git a/src/views/Game/index.tsx b/src/views/Game/index.tsx
index b7222fc..cce0451 100644
--- a/src/views/Game/index.tsx
+++ b/src/views/Game/index.tsx
@@ -40,7 +40,7 @@ const GameView: FunctionComponent = () => {
useEffect(() => {
console.log(
- "To open the game terminal, press the ` key. (top left of keyboard, no not escape... the one below escape)"
+ "To open the game terminal, press the ` key. (top left of keyboard, no not escape... the one below escape)",
);
window.addEventListener("keydown", handleKeyDown);
diff --git a/src/views/Login/Continue/index.tsx b/src/views/Login/Continue/index.tsx
index 0e12762..150f897 100644
--- a/src/views/Login/Continue/index.tsx
+++ b/src/views/Login/Continue/index.tsx
@@ -36,7 +36,7 @@ const ContinueGameView: FunctionComponent = () => {
GameAPI.IResumableGame[]
>([]);
const [selectedGame, setSelectedGame] = useState(
- null
+ null,
);
const fetchResumableGames = async () => {
diff --git a/src/views/Login/New/stores/new.ts b/src/views/Login/New/stores/new.ts
index f49fba8..b1f5136 100644
--- a/src/views/Login/New/stores/new.ts
+++ b/src/views/Login/New/stores/new.ts
@@ -26,65 +26,63 @@ const initialState: NewGameState = {
playerReady: [],
};
-const useNewGameForm = create()(
- (set, get) => ({
- ...initialState,
+const useNewGameForm = create()((set, get) => ({
+ ...initialState,
- SetNumberOfPlayers: (value: number) => {
- const { players, playerReady } = get();
+ SetNumberOfPlayers: (value: number) => {
+ const { players, playerReady } = get();
- set((state) => ({ numberOfPlayers: value }));
+ set((state) => ({ numberOfPlayers: value }));
- if (value < players.length) {
- set((state) => ({ players: players.slice(0, value) }));
- set((state) => ({ playerReady: playerReady.slice(0, value) }));
- } else {
- set((state) => ({
- players: [
- ...players,
- ...Array(value - players.length).fill({
- name: "",
- }),
- ],
- }));
- set((state) => ({
- playerReady: [
- ...playerReady,
- ...Array(value - playerReady.length).fill(false),
- ],
- }));
- }
- },
+ if (value < players.length) {
+ set((state) => ({ players: players.slice(0, value) }));
+ set((state) => ({ playerReady: playerReady.slice(0, value) }));
+ } else {
+ set((state) => ({
+ players: [
+ ...players,
+ ...Array(value - players.length).fill({
+ name: "",
+ }),
+ ],
+ }));
+ set((state) => ({
+ playerReady: [
+ ...playerReady,
+ ...Array(value - playerReady.length).fill(false),
+ ],
+ }));
+ }
+ },
- SetGameMode: (value: GameMode) => {
- set((state) => ({ gameMode: value }));
- },
+ SetGameMode: (value: GameMode) => {
+ set((state) => ({ gameMode: value }));
+ },
- SetPlayer: (index: number, player: Player) => {
- set((state) => {
- const players = [...state.players];
- players[index] = player;
- return { players };
- });
- },
+ SetPlayer: (index: number, player: Player) => {
+ set((state) => {
+ const players = [...state.players];
+ players[index] = player;
+ return { players };
+ });
+ },
- RemovePlayer: (index: number) => {
- set((state) => {
- const players = [...state.players];
- players.splice(index, 1);
- return { players };
- });
- },
+ RemovePlayer: (index: number) => {
+ set((state) => {
+ const players = [...state.players];
+ players.splice(index, 1);
+ return { players };
+ });
+ },
- SetPlayerReady: (index: number, ready: boolean) => {
- set((state) => {
- const playerReady = [...state.playerReady];
- playerReady[index] = ready;
-
- return { playerReady, ready: playerReady.every((ready) => ready) };
- });
- },
- })
-);
+ SetPlayerReady: (index: number, ready: boolean) => {
+ set((state) => {
+ const playerReady = [...state.playerReady];
+ playerReady[index] = ready;
+
+ return { playerReady, ready: playerReady.every((ready) => ready) };
+ });
+ },
+}));
export default useNewGameForm;
diff --git a/src/views/Login/components/ContinueGameDialog.tsx b/src/views/Login/components/ContinueGameDialog.tsx
index b719982..b1947fc 100644
--- a/src/views/Login/components/ContinueGameDialog.tsx
+++ b/src/views/Login/components/ContinueGameDialog.tsx
@@ -9,7 +9,7 @@ interface ContinueGameDialogProps extends DialogProps {
}
const ContinueGameDialog: FunctionComponent = (
- props
+ props,
) => {
return (
= (
message={`Are you sure you want to continue game ${
props.game.id
} started at ${datetimeToddmmHHMMSS(
- props.game.start_datetime
+ props.game.start_datetime,
)} with ${props.game.players.map((p) => p.username).join(", ")}?`}
onCancel={() =>
props.onClose?.(
{
ok: false,
},
- "backdropClick"
+ "backdropClick",
)
}
onConfirm={() =>
@@ -33,7 +33,7 @@ const ContinueGameDialog: FunctionComponent = (
{
ok: true,
},
- "backdropClick"
+ "backdropClick",
)
}
/>
diff --git a/src/views/Login/components/NumberOfPlayersSelector.tsx b/src/views/Login/components/NumberOfPlayersSelector.tsx
index e1a5675..b761283 100644
--- a/src/views/Login/components/NumberOfPlayersSelector.tsx
+++ b/src/views/Login/components/NumberOfPlayersSelector.tsx
@@ -17,7 +17,7 @@ const NumberOfPlayersSelector: FunctionComponent<
{Array.from(
{ length: props.max - props.min + 1 },
- (_, i) => i + props.min
+ (_, i) => i + props.min,
).map((i) => (
= (
- props
+ props,
) => {
const [value, setValue] = useState("total");