Initial commit \o/

This commit is contained in:
oitsjustjose 2023-01-16 15:29:44 -05:00
commit f6838c0140
87 changed files with 9726 additions and 0 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
build/**
.idea/
node_modules/
vs_code/
Dockerfile

28
.eslintrc.json Normal file
View file

@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"es6": true,
"jest": true
},
"extends": ["plugin:react/recommended", "airbnb"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"import/no-cycle": 0,
"no-unused-expressions": 0,
"react/jsx-props-no-spreading": 0,
"react/prop-types": 0,
"react/function-component-definition": 0,
"react/no-alert": 0
}
}

26
.gitignore vendored Normal file
View file

@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode/
.vscode/*

6
.prettierrc Normal file
View file

@ -0,0 +1,6 @@
{
"arrowParens": "avoid",
"trailingComma": "es5",
"singleQuote": true,
"semi": true
}

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM node:16-alpine AS builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:16-alpine AS server
ENV NODE_ENV=production
RUN npm install -g serve
WORKDIR /app
COPY package*.json ./
COPY --from=builder /app/build ./build
ENV PORT=3001
EXPOSE 3001
USER node
CMD ["serve", "-s", "build"]

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Slamon' Run Bingo
## No, that's not a typo
This is a simple bingo card generator (which saves and can conditionally reset if you ask it to) for your weapons while playing Salmon Run in Splatoon 3. Have fun - it's open source, weapon art from [the wiki](https://splatoonwiki.org/wiki/List_of_weapons_in_Splatoon_3), all other art is by [my wife](https://linktr.ee/ambroxer)

17
index.html Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.png" type="image/x-icon">
<title>Salmon Run Bingo</title>
</head>
<body>
<table id="bingo-card"></table>
<script src="./index.js" />
</body>
</html>

45
package.json Normal file
View file

@ -0,0 +1,45 @@
{
"name": "perfectfyt-ui",
"version": "1.0.0",
"private": true,
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"semantic-ui-react": "^2.1.3",
"semantic-ui-css": "git+https://github.com/Semantic-Org/Semantic-UI-CSS.git",
"web-vitals": "^2.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"eslint": "^8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.1.2"
},
"proxy": "http://localhost:3030",
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

BIN
public/app-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
public/img/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
public/img/splats/Blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
public/img/splats/Cyan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
public/img/splats/Pink.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
public/img/splats/Teal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
public/img/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

22
public/index.html Normal file
View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/app-icon.png" />
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="theme-color" content="#81ba40" />
<link rel="shortcut icon" href="./app-icon.png" type="image/x-icon" />
<meta name="description" content="Play Bing with a Night's Worth of Salmon Run Weapons!" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/app-icon.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Slamin' Run Bingo</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

15
public/manifest.json Normal file
View file

@ -0,0 +1,15 @@
{
"short_name": "HiFi Guides",
"name": "A Website for Solving All your HiFi Needs",
"icons": [
{
"src": "favicon.png",
"type": "image/png",
"sizes": "128x128"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#00b5ad",
"background_color": "#252525"
}

3
public/robots.txt Normal file
View file

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

22
semantic.json Normal file
View file

@ -0,0 +1,22 @@
{
"base": "semantic/",
"paths": {
"source": {
"config": "src/theme.config",
"definitions": "src/definitions/",
"site": "src/site/",
"themes": "src/themes/"
},
"output": {
"packaged": "dist/",
"uncompressed": "dist/components/",
"compressed": "dist/components/",
"themes": "dist/themes/"
},
"clean": "dist/"
},
"permission": false,
"autoInstall": false,
"rtl": false,
"version": "2.8.8"
}

22
src/App.css Normal file
View file

@ -0,0 +1,22 @@
body {
background: url('/public/img/bg.png') repeat;
background-size: cover;
}
.footer {
font-size: 1.5rem;
text-align: center;
margin: 1rem auto;
color: white;
}
.footer a {
color: #7a724b !important;
}
.bingoslot {
-webkit-filter: drop-shadow(1.15px 1.15px 0 black)
drop-shadow(-1.15px -1.15px 0 black);
filter: drop-shadow(1.15px 1.15px 0 black)
drop-shadow(-1.15px -1.15px 0 black);
}

4
src/App.jsx Normal file
View file

@ -0,0 +1,4 @@
import React from 'react';
import Routes from './Routes';
export default () => (<Routes />);

29
src/Routes.jsx Normal file
View file

@ -0,0 +1,29 @@
import React from 'react';
import { BrowserRouter, Route, Routes as RouterRoutes } from 'react-router-dom';
import Home from './views/Home';
export const Pages = [
{
name: 'Home',
path: '/',
element: (<Home />),
},
];
export default () => (
<BrowserRouter>
<RouterRoutes>
{
Pages.map((page) => (
<Route
key={page.name}
exact
path={page.path}
element={page.element}
/>
))
}
</RouterRoutes>
</BrowserRouter>
);

View file

@ -0,0 +1,46 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import React, { useState } from 'react';
import { PickSplat } from '../data/Loader';
export default ({ src, hitIn, propagateChanges }) => {
const [hit, setHit] = useState(hitIn);
const onClick = () => {
const newState = !hit;
propagateChanges(newState);
setHit(newState);
};
return (
<div
onClick={onClick}
style={{
position: 'relative',
border: '2px solid #7a724b',
userSelect: 'none',
}}
>
{hit && (
<img
src={`/img/splats/${PickSplat()}`}
alt="splatted"
style={{
position: 'absolute',
top: 0,
left: 0,
zIndex: 10000,
maxWidth: '100%',
opacity: '85%',
}}
/>
)}
<img
className={src === 'freespaec.png' ? '' : 'bingoslot'}
src={`/img/weapons/${src}`}
alt="splatoon gun"
style={{ maxWidth: '100%' }}
/>
</div>
);
};

31
src/data/Loader.js Normal file
View file

@ -0,0 +1,31 @@
import Weapons from './weapons.json';
import Splats from './splats.json';
export const Shuffle = (arr) => {
const arrayIndices = new Set();
const ret = [];
while (arrayIndices.size < arr.length) {
arrayIndices.add(Math.floor((Math.random() * 100) % arr.length));
}
arrayIndices.forEach((x) => ret.push(arr[x]));
return ret;
};
export const PickSplat = () => Splats[Math.floor(Math.random() * Splats.length)];
export const LoadDataOrFallback = () => {
const stored = window.localStorage.getItem('splatoon_card');
return stored ? JSON.parse(stored) : Shuffle(Weapons).map((x) => ({
src: x,
hit: false,
}));
};
export const SaveDataToAppStorage = (bingoCard) => {
window.localStorage.setItem('splatoon_card', JSON.stringify(bingoCard));
};
export const ClearSavedData = () => {
window.localStorage.removeItem('splatoon_card');
window.location.reload();
};

8
src/data/splats.json Normal file
View file

@ -0,0 +1,8 @@
[
"Cyan.png",
"Orange.png",
"Teal.png",
"Yellow.png",
"Pink.png",
"Blue.png"
]

57
src/data/weapons.json Normal file
View file

@ -0,0 +1,57 @@
[
"Blaster_LightLong_00.png",
"Blaster_LightShort_00.png",
"Blaster_Light_00.png",
"Blaster_Long_00.png",
"Blaster_Middle_00.png",
"Blaster_Short_00.png",
"Brush_Mini_00.png",
"Brush_Normal_00.png",
"Charger_Keeper_00.png",
"Charger_Light_00.png",
"Charger_Long_00.png",
"Charger_Normal_00.png",
"Charger_Pencil_00.png",
"Charger_Quick_00.png",
"Maneuver_Dual_00.png",
"Maneuver_Gallon_00.png",
"Maneuver_Normal_00.png",
"Maneuver_Short_00.png",
"Maneuver_Stepper_00.png",
"Roller_Compact_00.png",
"Roller_Heavy_00.png",
"Roller_Hunter_00.png",
"Roller_Normal_00.png",
"Roller_Wide_00.png",
"Saber_Lite_00.png",
"Saber_Normal_00.png",
"Shelter_Compact_00.png",
"Shelter_Normal_00.png",
"Shelter_Wide_00.png",
"Shooter_Blaze_00.png",
"Shooter_Expert_00.png",
"Shooter_First_00.png",
"Shooter_Flash_00.png",
"Shooter_Gravity_00.png",
"Shooter_Heavy_00.png",
"Shooter_Long_00.png",
"Shooter_Normal_00.png",
"Shooter_Precision_00.png",
"Shooter_QuickLong_00.png",
"Shooter_QuickMiddle_00.png",
"Shooter_Short_00.png",
"Shooter_TripleMiddle_00.png",
"Shooter_TripleQuick_00.png",
"Slosher_Bathtub_00.png",
"Slosher_Diffusion_00.png",
"Slosher_Launcher_00.png",
"Slosher_Strong_00.png",
"Slosher_Washtub_00.png",
"Spinner_Downpour_00.png",
"Spinner_Hyper_00.png",
"Spinner_Quick_00.png",
"Spinner_Serein_00.png",
"Spinner_Standard_00.png",
"Stringer_Normal_00.png",
"Stringer_Short_00.png"
]

18
src/index.js Normal file
View file

@ -0,0 +1,18 @@
import { createRoot } from 'react-dom/client';
import App from './App';
import 'semantic-ui-css/semantic.min.css';
import './App.css';
const container = document.getElementById('root');
const root = createRoot(container);
if (!window.localStorage.getItem('color')) {
window.localStorage.setItem('color', 'green');
}
if (!window.localStorage.getItem('uom')) {
window.localStorage.setItem('uom', 'inch');
}
root.render(App());

149
src/views/Home.jsx Normal file
View file

@ -0,0 +1,149 @@
/* eslint-disable no-plusplus */
import React from 'react';
import { Button, Popup } from 'semantic-ui-react';
import BingoSlot from '../components/BingoSlot';
import { LoadDataOrFallback, SaveDataToAppStorage, ClearSavedData } from '../data/Loader';
export default () => {
const data = LoadDataOrFallback();
SaveDataToAppStorage(data);
const boardDims = {
width: 7, height: 7,
};
const bingoSlots = data.map((x, idx) => (
<BingoSlot
src={x.src}
hitIn={x.hit}
// eslint-disable-next-line react/no-array-index-key
key={idx}
propagateChanges={(newState) => {
data[idx].hit = newState;
SaveDataToAppStorage(data);
}}
/>
));
let idx = 0;
const rows = [];
for (let row = 1; row <= boardDims.height; row++) {
const cols = [];
for (let col = 1; col <= boardDims.width; col++) {
if (!(row === Math.round(boardDims.height / 2)
&& col === Math.round(boardDims.width / 2))) {
cols.push(bingoSlots[idx]);
idx++;
} else {
// Special case for the freespace, which lives at the end of the data array
cols.push(
<BingoSlot
src="freespaec.png"
hitIn={data[data.length - 1].hit}
key="freespaec"
propagateChanges={(newState) => {
data[data.length - 1].hit = newState;
SaveDataToAppStorage(data);
}}
/>,
);
// cols.push(<Blank />);
}
}
const tblRow = (
<div
key={row}
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-evenly',
}}
>
{cols}
</div>
);
rows.push(tblRow);
}
return (
<div>
<div style={{ display: '2rem auto', textAlign: 'center' }}>
<img
src="/img/title.png"
alt="title"
style={{
userSelect: 'none',
// display: 'block',
textAlign: 'center',
maxWidth: '768px',
width: '50vw',
filter: 'invert(1)',
}}
/>
</div>
<div style={{
maxWidth: '768px',
margin: 'auto',
border: '2px solid #7a724b',
}}
>
<div style={{
backgroundColor: '#dfd39690',
display: 'flex',
flexDirection: 'column',
}}
>
{rows}
</div>
</div>
<Popup
flowing
hoverable
trigger={(
<Button
color="red"
circular
size="huge"
icon="repeat"
onClick={() => {
// eslint-disable-next-line no-alert
if (window.confirm('Reset Your Board and Re-Randomize Layout?')) {
ClearSavedData();
}
}}
style={{ position: 'fixed', bottom: '16px', left: '16px' }}
/>
)}
>
Clear Board
</Popup>
<Popup
flowing
hoverable
trigger={(
<Button
style={{
position: 'fixed', bottom: '16px', right: '16px', zIndex: '999999', backgroundColor: '#ecfe6c',
}}
size="huge"
icon="info"
circular
/>
)}
>
Weapon Icons from
{' '}
<a href="https://splatoonwiki.org/wiki/List_of_weapons_in_Splatoon_3" target="_blank" rel="noreferrer">The Wiki</a>
. All other art by my wife
{' '}
<a href="https://linktr.ee/ambroxer" target="_blank" rel="noreferrer">Ambroxer</a>
.
</Popup>
</div>
);
};

9144
yarn.lock Normal file

File diff suppressed because it is too large Load diff