quick fixes

This commit is contained in:
Elijah Steres 2021-01-17 17:14:02 -05:00
parent 0e6cc6e464
commit 1fee637608
9 changed files with 39 additions and 29 deletions

1
.gitignore vendored
View file

@ -357,3 +357,4 @@ Pipfile
env env
/data/leagues /data/leagues
/simmadome/build /simmadome/build
/simmadome/.eslintcache

View file

@ -93,7 +93,7 @@ def create_league():
new_league = league_structure(config['name']) new_league = league_structure(config['name'])
new_league.setup( new_league.setup(
league_dic, league_dic,
division_games=config['division_series'], # need to add a check that makes sure these values are ok division_games=config['division_series'],
inter_division_games=config['inter_division_series'], inter_division_games=config['inter_division_series'],
inter_league_games=config['inter_league_series'], inter_league_games=config['inter_league_series'],
) )

View file

@ -1 +0,0 @@
[{"/Users/elijah/Documents/Projects/matteo/simmadome/src/index.tsx":"1","/Users/elijah/Documents/Projects/matteo/simmadome/src/reportWebVitals.ts":"2","/Users/elijah/Documents/Projects/matteo/simmadome/src/GamesPage.tsx":"3","/Users/elijah/Documents/Projects/matteo/simmadome/src/GamePage.tsx":"4","/Users/elijah/Documents/Projects/matteo/simmadome/src/CreateLeague.tsx":"5","/Users/elijah/Documents/Projects/matteo/simmadome/src/GamesUtil.tsx":"6","/Users/elijah/Documents/Projects/matteo/simmadome/src/util.tsx":"7","/Users/elijah/Documents/Projects/matteo/simmadome/src/Game.tsx":"8"},{"size":2368,"mtime":1610663769654,"results":"9","hashOfConfig":"10"},{"size":425,"mtime":1610566206674,"results":"11","hashOfConfig":"10"},{"size":4725,"mtime":1610664926203,"results":"12","hashOfConfig":"10"},{"size":1836,"mtime":1610677519051,"results":"13","hashOfConfig":"10"},{"size":18825,"mtime":1610778204901,"results":"14","hashOfConfig":"10"},{"size":1116,"mtime":1610677473305,"results":"15","hashOfConfig":"10"},{"size":961,"mtime":1610694553519,"results":"16","hashOfConfig":"10"},{"size":3089,"mtime":1610572714752,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1bvn6qu",{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/elijah/Documents/Projects/matteo/simmadome/src/index.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/reportWebVitals.ts",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/GamesPage.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/GamePage.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/CreateLeague.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/GamesUtil.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/util.tsx",[],"/Users/elijah/Documents/Projects/matteo/simmadome/src/Game.tsx",[]]

View file

@ -16,15 +16,5 @@
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body> </body>
</html> </html>

View file

@ -171,6 +171,8 @@
.update_text { .update_text {
text-align: start; text-align: start;
margin-top: 0.2rem;
margin-bottom: 0.2rem;
} }
.field { .field {

View file

@ -70,10 +70,5 @@
@media only screen and (max-device-width: 800px) { @media only screen and (max-device-width: 800px) {
.container { .container {
display: grid;
grid-template-columns: repeat(1, minmax(700px, 90%));
position: absolute;
left: 50%;
transform: translate(-50%, 0);
} }
} }

View file

@ -5,23 +5,29 @@ import './GamesPage.css';
import Game from './Game'; import Game from './Game';
function GamesPage() { function GamesPage() {
let gameList = useRef<(string | null)[]>([]);
let [search, setSearch] = useState(window.location.search); let [search, setSearch] = useState(window.location.search);
useEffect(() => { useEffect(() => {
setSearch(window.location.search); setSearch(window.location.search);
gameList.current = [];
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [window.location.search]) }, [window.location.search])
// get filter term
let searchparams = new URLSearchParams(search); let searchparams = new URLSearchParams(search);
let filter = searchparams.get('league') ?? "" let filter = searchparams.get('league') ?? ""
// set up socket listener
let [games, setGames] = useState<[string, GameState][]>([]); let [games, setGames] = useState<[string, GameState][]>([]);
useListener(setGames); useListener(setGames);
// build filter list
let filters = useRef(filter !== "" ? [filter] : []); let filters = useRef(filter !== "" ? [filter] : []);
games.forEach((game) => { if (game[1].is_league && !filters.current.includes(game[1].leagueoruser)) { filters.current.push(game[1].leagueoruser) }}); games.forEach((game) => { if (game[1].is_league && !filters.current.includes(game[1].leagueoruser)) { filters.current.push(game[1].leagueoruser) }});
filters.current = filters.current.filter((f) => games.find((game) => game && game[1].is_league && game[1].leagueoruser === f) || f === filter); filters.current = filters.current.filter((f) => games.find((game) => game && game[1].is_league && game[1].leagueoruser === f) || f === filter);
let gameList = useRef<(string | null)[]>([]); // update game list
let filterGames = games.filter((game, i) => filter === "" || game[1].leagueoruser === filter); let filterGames = games.filter((game, i) => filter === "" || game[1].leagueoruser === filter);
updateList(gameList.current, filterGames, searchparams.get('game')); updateList(gameList.current, filterGames, searchparams.get('game'));

View file

@ -55,6 +55,12 @@ h2 {
margin: auto; margin: auto;
} }
#links {
display: flex;
width: 100%;
justify-content: space-between;
}
#link_div { #link_div {
text-align: right; text-align: right;
position: absolute; position: absolute;
@ -63,6 +69,12 @@ h2 {
display: flex; display: flex;
} }
#nav_links {
position: absolute;
top: 1rem;
left: 2rem;
}
.github_logo, .twitter_logo, .patreon_container { .github_logo, .twitter_logo, .patreon_container {
height: 2rem; height: 2rem;
width: 2rem; width: 2rem;
@ -97,15 +109,18 @@ a:hover {
color: white; color: white;
} }
#utility_links {
position: absolute;
top: 1rem;
left: 2rem;
}
img.emoji { img.emoji {
height: 1em; height: 1em;
width: 1em; width: 1em;
margin: 0 .05em 0 .1em; margin: 0 .05em 0 .1em;
vertical-align: -0.1em; vertical-align: -0.1em;
} }
@media only screen and (max-width: 800px) {
#link_div, #nav_links {
position: static;
margin-top: 0.5rem;
margin-left: 2rem;
margin-right: 2rem;
}
}

View file

@ -29,6 +29,10 @@ ReactDOM.render(
function Header() { function Header() {
return ( return (
<div id="header"> <div id="header">
<div id="links">
<div id="nav_links">
<Link to="/create_league">Create a League</Link>
</div>
<div id="link_div"> <div id="link_div">
<a href="https://www.patreon.com/sixteen" className="patreon_link" target="_blank" rel="noopener noreferrer"> <a href="https://www.patreon.com/sixteen" className="patreon_link" target="_blank" rel="noopener noreferrer">
<div className="patreon_container"> <div className="patreon_container">
@ -42,11 +46,9 @@ function Header() {
<img className="twitter_logo" src={twitterLogo} alt="Twitter"/> <img className="twitter_logo" src={twitterLogo} alt="Twitter"/>
</a> </a>
</div> </div>
<div id="utility_links"> </div>
<Link to="/create_league">Create a League</Link> <a href="/" className="page_header"><h2 className="page_header" style={{fontSize:"50px"} as React.CSSProperties}>THE SIMMADOME</h2></a>
</div> <h2 className="page_header">Join SIBR on <a href="https://discord.gg/UhAajY2NCW" className="link"><img src={discordlogo} alt="" height="30"/></a> to start your own games!</h2>
<a href="/" className="page_header"><h2 className="page_header" style={{fontSize:"50px"} as React.CSSProperties}>THE SIMMADOME</h2></a>
<h2 className="page_header">Join SIBR on <a href="https://discord.gg/UhAajY2NCW" className="link"><img src={discordlogo} alt="" height="30"/></a> to start your own games!</h2>
</div> </div>
); );
} }