-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
width: 33px; | ||
height: 33px; |
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}/>} |
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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 }) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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} ..... >
}
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
@@ -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} |
There was a problem hiding this comment.
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.
No description provided.