Skip to content

Commit

Permalink
Big refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
irdkwmnsb committed Aug 5, 2023
1 parent a3d2df5 commit 0dd9ad3
Show file tree
Hide file tree
Showing 42 changed files with 894 additions and 1,473 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ kotlin.code.style=official

build_version=dev
#change this to `false` to use system installed npm
npm.download=true
org.gradle.parallel=true
npm.download=false
org.gradle.parallel=true
6 changes: 1 addition & 5 deletions src/backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ tasks {
from(project(":frontend").tasks["npm_run_buildOverlay"])
destinationDir = jsBuildPath.resolve("overlay")
}
val copyJsOverlay2 = register<Copy>("copyJsOverlay2") {
from(project(":frontend").tasks["npm_run_buildOverlay2"])
destinationDir = jsBuildPath.resolve("overlay2")
}
register("buildJs") {
dependsOn(copyJsAdmin, copyJsOverlay, copyJsOverlay2)
dependsOn(copyJsAdmin, copyJsOverlay)
outputs.dir(jsBuildPath)
}
}
Expand Down
Binary file added src/frontend/admin/public/icon-192x192.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 src/frontend/admin/public/icon-256x256.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 src/frontend/admin/public/icon-384x384.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 src/frontend/admin/public/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/frontend/admin/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000000"/>
<meta name="description" content="Web site created using create-react-app"/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="icon" type="image/png" href="%PUBLIC_URL%/icon-192x192.png" sizes="192x192">
<title>ICPC Live 3 Admin</title>
</head>
<body>
Expand Down
27 changes: 27 additions & 0 deletions src/frontend/admin/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"display": "browser",
"name": "ICPC Live admin",
"short_name": "ICPC Live admin",
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
7 changes: 0 additions & 7 deletions src/frontend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ tasks {
inputs.file("overlay/package.json")
outputs.dir("overlay/build")
}
named<NpmTask>("npm_run_buildOverlay2") {
environment.set(mapOf("PUBLIC_URL" to "/overlay2", "BUILD_PATH" to "build2", "VITE_VERSION" to "2"))
inputs.dir("overlay/src")
inputs.file("overlay/index.html")
inputs.file("overlay/package.json")
outputs.dir("overlay/build2")
}
named<NpmTask>("npm_run_buildAdmin") {
environment.set(mapOf("PUBLIC_URL" to "/admin"))
inputs.dir("admin/src")
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/overlay/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000000"/>
<link rel="manifest" href="/src/assets/manifest.json">
<link rel="icon" type="image/png" href="/src/assets/icon-192x192.png" sizes="192x192">
<title>ICPC Live</title>
</head>
<body>
Expand Down
Binary file added src/frontend/overlay/src/assets/icon-192x192.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 src/frontend/overlay/src/assets/icon-256x256.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 src/frontend/overlay/src/assets/icon-384x384.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 src/frontend/overlay/src/assets/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/frontend/overlay/src/assets/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"display": "browser",
"name": "ICPC Live",
"short_name": "ICPC Live",
"icons": [
{
"src": "/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
116 changes: 0 additions & 116 deletions src/frontend/overlay/src/components/atoms/Box2.jsx

This file was deleted.

4 changes: 4 additions & 0 deletions src/frontend/overlay/src/components/atoms/Cell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const flash = keyframes`
`;

// FIXME: too overloaded with props.
/**
* @deprecated Do not use this component or inherit from this component. If you need styles - use them ad hoc.
* @type {StyledComponent<"div", AnyIfEmpty<DefaultTheme>, {}, never>}
*/
export const Cell = styled.div`
width: ${props => props.width};
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react";
import styled from "styled-components";
import { QUEUE_PROBLEM_LABEL_FONT_SIZE, CIRCLE_PROBLEM_LINE_WIDTH, CIRCLE_PROBLEM_SIZE } from "../../config";
import { FlexedBox2 } from "./Box2";
import { isShouldUseDarkColor } from "../../utils/colors";

const CircleCellProblemWrap = styled(FlexedBox2)`
const CircleCellProblemWrap = styled.div`
position: relative;
width: ${props => props.radius ?? CIRCLE_PROBLEM_SIZE};
height: ${props => props.radius ?? CIRCLE_PROBLEM_SIZE};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
VERDICT_UNKNOWN2,
} from "../../config";
import { isShouldUseDarkColor } from "../../utils/colors";
import { Box2, FlexedBox2, ShrinkingBox2 } from "./Box2";
import { ShrinkingBox } from "./ShrinkingBox";
import { formatScore, ICPCResult, IOIResult } from "./ContestCells";
import {
TeamTaskColor2,
TeamTaskColor,
TeamTaskSymbol,
TeamTaskStatus,
getStatus2,
getTeamTaskColor2,
} from "../../utils/statusInfo2";
getStatus,
getTeamTaskColor,
} from "../../utils/statusInfo";
import { CircleCell } from "./CircleCellsProblem";

export const ICPCTaskResult = PropTypes.shape({
Expand All @@ -32,7 +32,7 @@ export const IOITaskResult = PropTypes.shape({
score: PropTypes.number,
});

const VerdictLabel = styled(ShrinkingBox2)`
const VerdictLabel = styled(ShrinkingBox)`
background-color: ${({ color }) => color};
font-size: 14px;
font-weight: 700;
Expand Down Expand Up @@ -63,8 +63,8 @@ const getIOIScoreText = (difference) => {
const IOIVerdictLabel = ({ runResult: { wrongVerdict, difference }, ...props }) => {
const [diffText, diffColor] = getIOIScoreText(difference);
return <>
{wrongVerdict !== undefined && <ShrinkingBox2 text={wrongVerdict ?? "??"} color={VERDICT_NOK2} {...{ Wrapper: FlexedBox2, ...props }}/>}
{wrongVerdict === undefined && <ShrinkingBox2 text={diffText ?? "??"} color={diffColor} {...{ Wrapper: FlexedBox2, ...props }}/>}
{wrongVerdict !== undefined && <ShrinkingBox text={wrongVerdict ?? "??"} color={VERDICT_NOK2} {...{ Wrapper: FlexedBox2, ...props }}/>}
{wrongVerdict === undefined && <ShrinkingBox text={diffText ?? "??"} color={diffColor} {...{ Wrapper: FlexedBox2, ...props }}/>}
</>;
};
IOIVerdictLabel.propTypes = {
Expand Down Expand Up @@ -134,34 +134,33 @@ VerdictCellInProgress2.propTypes = {
percentage: PropTypes.number.isRequired
};

export const RunStatusLabel2 = ({ runInfo, className }) => {
export const RunStatusLabel = ({ runInfo, className }) => {
return <>
{runInfo.result === undefined && <VerdictCellInProgress2 percentage={runInfo.percentage} className={className}/>}
{runInfo.result !== undefined && <VerdictLabel2 runResult={runInfo.result} score={runInfo.result.result} className={className}/>}
</>;
};

RunStatusLabel2.propTypes = {
...Box2.propTypes,
RunStatusLabel.propTypes = {
runInfo: PropTypes.shape({
result: PropTypes.oneOf([IOIResult, IOIResult]),
percentage: PropTypes.number.isRequired,
}),
};

const TaskResultLabelWrapper2 = styled(Box2)`
const TaskResultLabelWrapper2 = styled.div`
font-weight: bold;
background-color: ${({ color }) => color};
color: #fff;
`;

// TODO: fts start
const ICPCTaskResultLabel2 = ({ problemResult: r, ...props }) => {
const status = getStatus2(r.isFirstToSolve, r.isSolved, r.pendingAttempts, r.wrongAttempts);
const status = getStatus(r.isFirstToSolve, r.isSolved, r.pendingAttempts, r.wrongAttempts);
const attempts = r.wrongAttempts + r.pendingAttempts;
return <>
{/*{status === TeamTaskStatus.first && <StarIcon/>}*/}
<TaskResultLabelWrapper2 color={TeamTaskColor2[status]} {...props}>
<TaskResultLabelWrapper2 color={TeamTaskColor[status]} {...props}>
{TeamTaskSymbol[status]}
{status !== TeamTaskStatus.untouched && attempts > 0 && attempts}
</TaskResultLabelWrapper2>
Expand All @@ -173,7 +172,7 @@ ICPCTaskResultLabel2.propTypes = {
};

const IOITaskResultLabel2 = ({ problemResult: r, minScore, maxScore, ...props }) => {
return <TaskResultLabelWrapper2 color={getTeamTaskColor2(r.score, minScore, maxScore)} { ...props}>
return <TaskResultLabelWrapper2 color={getTeamTaskColor(r.score, minScore, maxScore)} { ...props}>
{formatScore(r?.score)}
</TaskResultLabelWrapper2>;
};
Expand All @@ -184,17 +183,9 @@ IOITaskResultLabel2.propTypes = {
maxScore: PropTypes.number,
};

export const TaskResultLabel2 = ({ problemResult, minScore, maxScore, ...props }) => {
export const TaskResultLabel = ({ problemResult, minScore, maxScore, ...props }) => {
return <>
{problemResult.type === "ICPC" && <ICPCTaskResultLabel2 problemResult={problemResult} {...props}/>}
{problemResult.type === "IOI" && <IOITaskResultLabel2 problemResult={problemResult} minScore={minScore} maxScore={maxScore} {...props}/>}
</>;
};

export const ProblemCircleLabel = ({ letter, problemColor }) => {
return (
<Box2 width={"30px"} marginBottom={"8px"} paddingTop={"4px"}>
<CircleCell content={letter ?? "??"} backgroundColor={problemColor ?? "#000000"} />
</Box2>
);
};
Loading

0 comments on commit 0dd9ad3

Please sign in to comment.