Skip to content

Commit

Permalink
format files with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed May 20, 2024
1 parent 68acea1 commit d459fa1
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 107 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
4 changes: 2 additions & 2 deletions src/api/endpoints/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ILoginResponse {

export async function login(
username: string,
password: string
password: string,
): Promise<ILoginResponse> {
const data: ILoginRequest = {
username: username,
Expand All @@ -37,7 +37,7 @@ export interface ICreateUserResponse {

export async function createUser(
username: string,
password: string
password: string,
): Promise<ICreateUserResponse> {
const data: ILoginRequest = {
username: username,
Expand Down
10 changes: 5 additions & 5 deletions src/api/endpoints/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface IPostStartRequest {

export async function postStart(
tokens: string[],
official: boolean
official: boolean,
): Promise<IGameState> {
const data: IPostStartRequest = {
tokens: tokens,
Expand Down Expand Up @@ -59,7 +59,7 @@ export interface ICard {
export async function postUpdate(gameState: IGameState): Promise<void> {
return await client.post(
`/api/games/${gameState.id}/update_state/`,
gameState
gameState,
);
}

Expand Down Expand Up @@ -89,7 +89,7 @@ export interface IResumableGame {
}

export async function getResumableGames(
token: string
token: string,
): Promise<IResumableGame[]> {
const response = await client.get<IResumableGame[]>("/api/games/resumable/", {
headers: {
Expand All @@ -102,7 +102,7 @@ export async function getResumableGames(

export async function postResumeGame(
token: string,
gameId: number
gameId: number,
): Promise<IGameState> {
const response = await client.post(
`/api/games/${gameId}/resume/`,
Expand All @@ -111,7 +111,7 @@ export async function postResumeGame(
headers: {
Authorization: `Token ${token}`,
},
}
},
);

return response.data;
Expand Down
9 changes: 4 additions & 5 deletions src/api/endpoints/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ export interface IRankedCardResponse {
}

export async function getRankedCards(): Promise<IRankedCardResponse[]> {
const response = await client.get<IRankedCardResponse[]>(
"/api/ranked_cards/"
);
const response =
await client.get<IRankedCardResponse[]>("/api/ranked_cards/");
return response.data;
}

Expand All @@ -31,10 +30,10 @@ export interface IUserStatsResponse {
}

export async function getUserStats(
userId: number
userId: number,
): Promise<IUserStatsResponse> {
const response = await client.get<IUserStatsResponse>(
`/api/stats/${userId}/`
`/api/stats/${userId}/`,
);
return response.data;
}
2 changes: 1 addition & 1 deletion src/api/inteceptors/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export function TokenInteceptor(inst: AxiosInstance) {
},
(error) => {
Promise.reject(error);
}
},
);
}
2 changes: 1 addition & 1 deletion src/components/CardFlash/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface CardFlashDialogProps {

const CardFlashDialog: FunctionComponent<CardFlashDialogProps> = (props) => {
const [cardImageURI, setCardImageURI] = useState<string | undefined>(
undefined
undefined,
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CardFlash/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface flashCardOptions {
}

export const CardFlashProvider: FunctionComponent<CardFlashProviderProps> = (
props
props,
) => {
const [show, setShow] = useState(false);
const [card, setCard] = useState<Card>();
Expand Down
4 changes: 2 additions & 2 deletions src/components/SettingsDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -81,7 +81,7 @@ const SettingsDialog: FunctionComponent = () => {
checked={settings.themeMode === "dark"}
onChange={() => {
settings.SetThemeMode(
settings.themeMode === "dark" ? "light" : "dark"
settings.themeMode === "dark" ? "light" : "dark",
);
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Terminal/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const customCommands: Command[] = [
setTimeout(() => {
window.open(
"https://www.youtube.com/watch?v=q6EoRBvdVPQ&list=PLFsQleAWXsj_4yDeebiIADdH5FMayBiJo",
"_blank"
"_blank",
);
}, 1000);
},
Expand Down
9 changes: 5 additions & 4 deletions src/components/Terminal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Terminal: FunctionComponent<TerminalProps> = (props) => {
}

const commandObj = [...builtInCommands, ...customCommands].find(
(c) => c.name === cmd
(c) => c.name === cmd,
);

if (commandObj === undefined) {
Expand All @@ -86,7 +86,7 @@ const Terminal: FunctionComponent<TerminalProps> = (props) => {
[...builtInCommands, customCommands[0], customCommands[1]].forEach(
(c) => {
buffer.write(` ${rightPad(c.name, 10)} ${c.description || ""}`);
}
},
);

buffer.write(" and maybe more...");
Expand Down Expand Up @@ -120,14 +120,15 @@ const Terminal: FunctionComponent<TerminalProps> = (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");
},
Expand Down
6 changes: 4 additions & 2 deletions src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<SettingsDialog />
</CardFlashProvider>
</ThemeProvider>
</BrowserRouter>
</BrowserRouter>,
);
10 changes: 5 additions & 5 deletions src/stores/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface GameActions {
sipsInABeer: number;
numberOfRounds: number;
offline: boolean;
}
},
) => Promise<void>;
Draw: () => Card;
Exit: () => void;
Expand Down Expand Up @@ -85,7 +85,7 @@ const useGame = create<GameState & GameActions>()(
sipsInABeer: 14,
numberOfRounds: 13,
offline: false,
}
},
) => {
console.debug("[Game]", "Starting game");

Expand Down Expand Up @@ -154,7 +154,7 @@ const useGame = create<GameState & GameActions>()(
mapToRemote({
...state,
...updates,
})
}),
);
}

Expand All @@ -178,8 +178,8 @@ const useGame = create<GameState & GameActions>()(
}),
{
name: "game",
}
)
},
),
);

export default useGame;
Expand Down
4 changes: 2 additions & 2 deletions src/stores/gamesPlayed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const useGamesPlayed = create<ComputerGamesCountState>()(
}),
{
name: "computer-game-counts",
}
)
},
),
);

export default useGamesPlayed;
8 changes: 4 additions & 4 deletions src/stores/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ const MetricsStore = create<MetricsState & MetricsActions>()((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));
Expand Down
4 changes: 2 additions & 2 deletions src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const useSettings = create<SettingsState & SettingsActions>()(
}),
{
name: "settings",
}
)
},
),
);

export default useSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/deck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/memes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const API_KEY = "9KNValB7h2YKToE3kHZ9HKQepPH9KqFY";

export async function GetRandomMemeByTag(tag: string): Promise<string> {
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();
Expand Down
2 changes: 1 addition & 1 deletion src/views/Game/components/CardInventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface CardInventoryCardProps {
}

const CardInventoryCard: FunctionComponent<CardInventoryCardProps> = (
props
props,
) => {
return (
<Box
Expand Down
2 changes: 1 addition & 1 deletion src/views/Game/components/DNFDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const DNFDialog: FunctionComponent<DNFDialogProps> = (props) => {
>
{player.username}
</Typography>

<PlayerCross />
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions src/views/Game/components/ExitGameDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const ExitGameDialog: FunctionComponent<ExitGameDialogProps> = (props) => {
{
ok: false,
},
"backdropClick"
"backdropClick",
)
}
onConfirm={() =>
props.onClose?.(
{
ok: true,
},
"backdropClick"
"backdropClick",
)
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Game/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const Header: FunctionComponent = () => {
sound.play("click");

settings.SetThemeMode(
settings.themeMode === "light" ? "dark" : "light"
settings.themeMode === "light" ? "dark" : "light",
);
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/views/Login/Continue/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ContinueGameView: FunctionComponent = () => {
GameAPI.IResumableGame[]
>([]);
const [selectedGame, setSelectedGame] = useState<GameAPI.IGameState | null>(
null
null,
);

const fetchResumableGames = async () => {
Expand Down
Loading

0 comments on commit d459fa1

Please sign in to comment.