From 57e88b59e7c99afc7eadcff1e6e1c2d93769f1cb Mon Sep 17 00:00:00 2001 From: jahidem Date: Sat, 31 Dec 2022 12:12:38 +0600 Subject: [PATCH] added coach mode fixes #2 --- core/homeWindow.ts | 16 +++++------ core/prisma/sqlite.db | Bin 53248 -> 53248 bytes package.json | 6 ++--- src/redux/slice/contest-slice.ts | 19 +++++++++++++ src/screen/components/Setting.tsx | 43 +++++++++++++++++------------- src/screen/homeScreen/Home.tsx | 5 +++- 6 files changed, 59 insertions(+), 30 deletions(-) diff --git a/core/homeWindow.ts b/core/homeWindow.ts index fe4cd4f..23aab92 100644 --- a/core/homeWindow.ts +++ b/core/homeWindow.ts @@ -34,10 +34,10 @@ export default class HomeWindow { }, }); if (HomeWindow.thisWindow != null) { - // HomeWindow.thisWindow.loadURL( - // 'file://' + __dirname + '/../index.html#/home' - // ); - HomeWindow.thisWindow.loadURL("http://localhost:3000/#/home"); + HomeWindow.thisWindow.loadURL( + 'file://' + __dirname + '/../index.html#/home' + ); + // HomeWindow.thisWindow.loadURL("http://localhost:3000/#/home"); HomeWindow.thisWindow.on("closed", HomeWindow.onClose); } @@ -87,8 +87,8 @@ export default class HomeWindow { }); if (HomeWindow.logWindow != null) { - // HomeWindow.logWindow.loadURL('file://' + __dirname + '/../index.html#/log'); - HomeWindow.logWindow.loadURL("http://localhost:3000/#/log"); + HomeWindow.logWindow.loadURL('file://' + __dirname + '/../index.html#/log'); + // HomeWindow.logWindow.loadURL("http://localhost:3000/#/log"); } } @@ -138,8 +138,8 @@ export default class HomeWindow { ]; const menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(menu); - // HomeWindow.potmWindow.loadURL('file://' + __dirname + '/../index.html#/potm'); - HomeWindow.potmWindow.loadURL("http://localhost:3000/#/potm"); + HomeWindow.potmWindow.loadURL('file://' + __dirname + '/../index.html#/potm'); + // HomeWindow.potmWindow.loadURL("http://localhost:3000/#/potm"); // HomeWindow.potmWindow.on("closed", HomeWindow.closePotmWindow); } } diff --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rCtuhPpXQ$DT*MEGgBOj6c@be+WooDkx;1 zA+HspY?YQv;}VT8$4Gerq{V!ciGbGE= zs3$zEV8$BvXSK6b?DyyJ?ff|4ci~?=DOeWB!NEoo3mc0bv^clM5+xJ2)}=)MT=#0c z&$(rd_ty#R%1grb-HUm{D~d0em{{|8bha#TB#>{spk?6vksZJ*eFW_!-IM8BpVl>ev~^OKAX+GRB>oFSU< zWL2`76VAe0;S}_F7vb^~ZtSZr!aR2YzEjnPFL?d2fPV z-N{5`_?pByXgA3FN& z6ZS4k$=JYkP19R>jr_)&f={kVj^7}^pk)fL9Oax?-Q53!cwmdyRdlm=PR55%_~R28 z_x5ZQ(>V6B8>h`Y-19>d2TfB9lE1BKCU8t}7A^lPhGY zvCVPDvCuYQdrUtQb&bZXT343KK$sYdo@pJIHTJZ0G8))%Tf?W%{pfT52U*hMS^6uj CGO~RD diff --git a/package.json b/package.json index 6bcaf41..c27aefe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "potm", - "productName": "potm", - "version": "1.1.0", + "productName": "potm 1.2.0", + "version": "1.2.0", "homepage": ".", "private": true, "main": "build/core/main.js", @@ -73,7 +73,7 @@ }, "build": { "appId": "com.jahidem.potm", - "productName": "POTM", + "productName": "POTM 1.2.0", "publish": [ { "provider": "github", diff --git a/src/redux/slice/contest-slice.ts b/src/redux/slice/contest-slice.ts index 50a0ad2..2763b0d 100644 --- a/src/redux/slice/contest-slice.ts +++ b/src/redux/slice/contest-slice.ts @@ -118,6 +118,7 @@ interface ContestState { reportRow: ReportRow[]; reportGenerate: GenerateReport; listLogs: StandingLogs[]; + adminMode: Boolean; } const initialState: ContestState = { list: [], @@ -128,6 +129,7 @@ const initialState: ContestState = { reportRow: [], reportGenerate: GenerateReport.IDLE, listLogs: [], + adminMode: true, }; const ContestSlice = createSlice({ @@ -136,6 +138,19 @@ const ContestSlice = createSlice({ reducers: { filterAllContest(state) { let filtered = state.list.filter((contest: Contest) => { + if (state.adminMode) { + return ( + new Date(contest.startTimeSeconds * 1000) < + new Date(state.epochEnd) && + new Date(state.epochStart) <= + new Date(contest.startTimeSeconds * 1000) && + contest.phase == ContestPhase.FINISHED && + (contest.name.includes("Div. 3") || + contest.name.includes("Div. 2") || + contest.name.includes("Codeforces Global Round")) + ); + } + return ( new Date(contest.startTimeSeconds * 1000) < new Date(state.epochEnd) && @@ -182,6 +197,9 @@ const ContestSlice = createSlice({ updateAllowOC(state, arr: PayloadAction<(string | number)[]>) { state.allowOC = arr.payload; }, + toggleAdmin(state) { + state.adminMode = !state.adminMode; + }, updateReportRow( state, contestStanding: PayloadAction @@ -257,5 +275,6 @@ export const { saveAllContest, generateRanking, loadLogList, + toggleAdmin, } = ContestSlice.actions; export default ContestSlice.reducer; diff --git a/src/screen/components/Setting.tsx b/src/screen/components/Setting.tsx index 0af2d4a..c4cc025 100644 --- a/src/screen/components/Setting.tsx +++ b/src/screen/components/Setting.tsx @@ -8,6 +8,7 @@ import { Checkbox, CheckboxGroup, Stack, + Switch, } from "@chakra-ui/react"; import { ChevronDownIcon } from "@chakra-ui/icons"; import { useEffect, useState } from "react"; @@ -18,6 +19,7 @@ import { setEpochStart, setEpochEnd, updateAllowDiv, + toggleAdmin, } from "../../redux/slice/contest-slice"; interface ChooserState { @@ -34,6 +36,7 @@ const initials = { const Setting = () => { const contestLoading = useAppSelector((state) => state.cfapi.contestLoading); + const adminMode = useAppSelector((state) => state.contest.adminMode); const dispatch = useAppDispatch(); const [start, setStart] = useState(initials); @@ -102,22 +105,23 @@ const Setting = () => { return ( <> - + - Choose the period for POTM + Choose the period and division - + + - + From: { /> - - - Filter: + + + Coach mode - - - - Division:{" "} + dispatch(toggleAdmin())} + colorScheme="teal" + /> + + + + + Division: setCheckedDiv(value)} + isDisabled={adminMode ? true : false} > @@ -272,7 +279,7 @@ const Setting = () => {