Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the fts star to the scoreboard #140

Merged
merged 9 commits into from
Jan 31, 2024
Merged

Added the fts star to the scoreboard #140

merged 9 commits into from
Jan 31, 2024

Conversation

Mond1c
Copy link
Contributor

@Mond1c Mond1c commented Jan 27, 2024

No description provided.

@Mond1c Mond1c changed the title Added the fts star in the scoreboard Added the fts star to the scoreboard Jan 27, 2024
Comment on lines 123 to 124
width: 33px;
height: 33px;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to make this value constant? (maybe STAR_SIZE in config.js?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please extract to config.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

};

const AttemptsOrScoreLabelWrapper = styled.div`
position: relative;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a rouge position: relative?

Copy link
Contributor

@irdkwmnsb irdkwmnsb Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it work without the position: relative?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove it, the star will above the text

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the order of the elements in the html tree

Copy link
Contributor Author

@Mond1c Mond1c Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed position: relative to position: absolute in the AttemptsOrScoreLabelWrapper div and removed position: absolute from the StarIcon div.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then just leave it

{problemResult.type === "ICPC" && <ICPCTaskResultLabel2 problemResult={problemResult} {...props}/>}
{problemResult.type === "IOI" && <IOITaskResultLabel2 problemResult={problemResult} minScore={minScore} maxScore={maxScore} {...props}/>}
{problemResult.type === "ICPC" && <ICPCTaskResultLabel2 problemColor={problemColor} problemResult={problemResult} {...props}/>}
{problemResult.type === "IOI" && <IOITaskResultLabel2 problemColor={problemColor} problemResult={problemResult} minScore={minScore} maxScore={maxScore} {...props}/>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to extract problemColor or problemResult or minScore or maxScore from the {...props}.
Just leave {...props}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't extract problemResult because:

problemResult.type === "ICPC"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minScore, maxScore, problemColor are now in props

</TaskResultLabelWrapper2>
</>;
};

const IOITaskResultLabel2 = ({ problemResult: r, minScore, maxScore, ...props }) => {
const IOITaskResultLabel2 = ({ problemColor, problemResult: r, minScore, maxScore, ...props }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really necessary to rename problemResult to r?

Copy link
Contributor Author

@Mond1c Mond1c Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do it. That was before I started pr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I guess we will refactor it some time in the future.

@@ -119,7 +119,7 @@ export const ScoreboardRow = ({ teamId, hideTasks, optimismLevel }) => {
formatPenalty(scoreboardData?.penalty)
} />}
{!hideTasks && scoreboardData?.problemResults.map((result, i) =>
<ScoreboardTaskResultLabel problemResult={result} key={i}
<ScoreboardTaskResultLabel problemResult={result} key={i} problemColor={contestData.problems[i].color}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should create a contest-aware component that will look up the colors from the store, but all we had to do is pass it the problem number?
Something like

export const ProblemLabel = ({problemIndex, className}) => {
    const problemData = useSelector((state) => state ...... );
    return <TaskResultLabel problemColor={problemData.color} ..... >
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we are already getting minScore, maxScore, etc. here. Do we want to create a new component for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Here we are also getting a lot of other useless data. We should be more specific to make things more pure

@Mond1c Mond1c requested a review from irdkwmnsb January 31, 2024 12:33
1. delete green color check
2. change default color to yellow
@@ -119,7 +119,7 @@ export const ScoreboardRow = ({ teamId, hideTasks, optimismLevel }) => {
formatPenalty(scoreboardData?.penalty)
} />}
{!hideTasks && scoreboardData?.problemResults.map((result, i) =>
<ScoreboardTaskResultLabel problemResult={result} key={i} problemColor={contestData.problems[i].color}
<ScoreboardTaskResultLabel problemResult={result} key={i} problemColor={contestData?.problems[i]?.color}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the thing I don't like. Passing too many props from the state in the context that is not suitable. I could understand if this was a specialized component that is extracting data from the store and displaying the data, but when it's used here - I'm not sure how I feel about that.

@irdkwmnsb irdkwmnsb merged commit 9dac2b1 into icpc:main Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants