Skip to content

Commit

Permalink
Merge branch 'main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSammyM committed Oct 26, 2024
2 parents 8ccdaa7 + 25b50bf commit 64633b2
Show file tree
Hide file tree
Showing 55 changed files with 31,719 additions and 31,258 deletions.
61,432 changes: 30,754 additions & 30,678 deletions client/package-lock.json

Large diffs are not rendered by default.

102 changes: 52 additions & 50 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.0",
"@types/marked": "^5.0.0",
"@types/dompurify": "^3.0.2",
"@types/node": "^18.15.5",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"dompurify": "^3.0.3",
"marked": "^5.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"typescript": "^4",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --passWithNoTests",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/dompurify": "^3.0.2",
"@types/jest": "^29.5.0",
"@types/marked": "^5.0.0",
"@types/node": "^18.15.5",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"dompurify": "^3.0.3",
"marked": "^5.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-scripts": "^5.0.1",
"typescript": "^4",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2",
"@types/react-helmet": "^6.1.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --passWithNoTests",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file removed client/public/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/icon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/icon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/icon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/images/icon/favicon.ico
Binary file not shown.
10 changes: 6 additions & 4 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href=%PUBLIC_URL%/mafia_logo.ico />
<!-- icons generated using https://favicon.io/favicon-converter/ -->
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/images/icon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/images/icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/images/icon/favicon-16x16.png">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
<meta
name="description"
content="A game about deception and manipulation"
/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
Binary file removed client/public/mafia_logo.ico
Binary file not shown.
Binary file removed client/public/mafia_logo192.png
Binary file not shown.
Binary file removed client/public/mafia_logo512.png
Binary file not shown.
43 changes: 17 additions & 26 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
{
"short_name": "Midnight Machinations",
"name": "Midnight Machinations",
"icons": [
{
"src": "mafia_logo.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon",
"purpose": "maskable"
},
{
"src": "mafia_logo192.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "mafia_logo512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#2d3646"
"short_name": "Midnight Machinations",
"name": "Midnight Machinations",
"icons":[
{
"src":"/android-chrome-192x192.png",
"sizes":"192x192",
"type":"image/png"
},
{
"src":"/android-chrome-512x512.png",
"sizes":"512x512",
"type":"image/png"
}
],
"theme_color":"#ffffff",
"background_color":"#2d3646",
"display":"standalone"
}
4 changes: 2 additions & 2 deletions client/src/components/RoleSpecific.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ export default function RoleSpecificSection(){
case "mortician":
return <Counter
max={3}
current={3-roleState.obscuredPlayers.length}
current={roleState.cremationsRemaining}
>
<StyledText>{translate("role.mortician.roleDataText", (3-roleState.obscuredPlayers.length))}</StyledText>
<StyledText>{translate("role.mortician.roleDataText", roleState.cremationsRemaining)}</StyledText>
</Counter>
case "death":
return <Counter
Expand Down
172 changes: 172 additions & 0 deletions client/src/components/TextAreaDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import { ReactElement, useEffect, useMemo, useState } from "react";
import StyledText from "./StyledText";
import { sanitizePlayerMessage } from "./ChatMessage";
import GAME_MANAGER, { replaceMentions } from "..";
import React from "react";
import { Button } from "./Button";
import Icon from "./Icon";
import translate from "../game/lang";
import "./textAreaDropdown.css";

export function TextDropdownArea(props: Readonly<{
titleString: string,
savedText: string,
open?: boolean,
onAdd?: () => void,
onSubtract?: () => void,
onSave: (text: string) => void,
cantPost: boolean
}>): ReactElement {
const [field, setField] = useState<string>(props.savedText);

useEffect(() => {
setField(props.savedText)
}, [props.savedText])

const unsaved = useMemo(() => {
return props.savedText !== field
}, [field, props.savedText]);

function send(field: string){
save(field);
GAME_MANAGER.sendSendMessagePacket('\n' + field);
}

function save(field: string) {
props.onSave(field);
}

return (
<details className="text-area-dropdown" open={props.open ?? false}>
<summary>
<TextDropdownLabel
titleString={props.titleString}
savedText={props.savedText}
field={field}
onAdd={props.onAdd}
onSubtract={props.onSubtract}
onSave={save}
cantPost={props.cantPost}
/>
</summary>
{unsaved ? "Unsaved" : ""}
<PrettyTextArea
field={field}
setField={setField}
save={save}
send={send}
/>
</details>
)
}

function TextDropdownLabel(
props: Readonly<{
titleString: string,
savedText: string,
field: string,
open?: boolean,
onAdd?: () => void,
onSubtract?: () => void,
onSave: (text: string) => void,
cantPost: boolean
}>
): ReactElement {

const unsaved = useMemo(() => {
return props.savedText !== props.field
}, [props.field, props.savedText]);

function save(field: string) {
props.onSave(field);
}

function send(field: string){
save(field);
GAME_MANAGER.sendSendMessagePacket('\n' + field);
}

return <div>
<StyledText>{props.titleString}</StyledText>
<span>
{props.onSubtract ? <Button
onClick={() => {
if(props.onSubtract)
props.onSubtract();
}}
pressedChildren={() => <Icon size="small">done</Icon>}
aria-label={translate("menu.will.subtract")}
>
<Icon size="small">remove</Icon>
</Button> : null}
{props.onAdd ? <Button
onClick={() => {
if(props.onAdd)
props.onAdd();
}}
pressedChildren={() => <Icon size="small">done</Icon>}
aria-label={translate("menu.will.add")}
>
<Icon size="small">add</Icon>
</Button> : null}
<Button
highlighted={unsaved}
onClick={() => {
save(props.field);
return true;
}}
pressedChildren={() => <Icon size="small">done</Icon>}
aria-label={translate("menu.will.save")}
>
<Icon size="small">save</Icon>
</Button>
<Button
disabled={props.cantPost}
onClick={() => {
send(props.field);
return true;
}}
pressedChildren={() => <Icon size="small">done</Icon>}
aria-label={translate("menu.will.post")}
>
<Icon size="small">send</Icon>
</Button>
</span>
</div>
}

function PrettyTextArea(props: Readonly<{
field: string,
setField: (field: string) => void,
save: (field: string) => void,
send: (field: string) => void,
}>): ReactElement {
const [writing, setWriting] = useState<boolean>(false);
const [hover, setHover] = useState<boolean>(false);

return <div
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
onFocus={() => setWriting(true)}
onBlur={() => setWriting(false)}
>
{(!writing && !hover)
? <div className="textarea">
<StyledText noLinks={true}>{sanitizePlayerMessage(replaceMentions(props.field))}</StyledText>
</div>
: <textarea
value={props.field}
onChange={e => props.setField(e.target.value)}
onKeyDown={(e) => {
if (e.ctrlKey) {
if (e.key === 's') {
e.preventDefault();
props.save(props.field);
} else if (e.key === "Enter") {
props.send(props.field);
}
}
}}>
</textarea>}
</div>
}
Loading

0 comments on commit 64633b2

Please sign in to comment.