-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp verdict: expand verdict code and make general info compact
- Loading branch information
Showing
17 changed files
with
154 additions
and
176 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
judgels-client/src/components/GradingVerdictTag/GradingVerdictTag.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Tag } from '@blueprintjs/core'; | ||
import classNames from 'classnames'; | ||
|
||
import { VerdictTag } from '../VerdictTag/VerdictTag'; | ||
import { VerdictCode } from '../../modules/api/gabriel/verdict'; | ||
|
||
import './GradingVerdictTag.scss'; | ||
|
||
export function GradingVerdictTag({ grading, wide }) { | ||
const verdict = grading.verdict; | ||
|
||
const getScore = () => { | ||
if (verdict.code === VerdictCode.PND || verdict.code === VerdictCode.CE || verdict.code === VerdictCode.ERR) { | ||
return null; | ||
} else if (verdict.code === VerdictCode.AC) { | ||
return grading.score !== 100 ? grading.score : null; | ||
} else { | ||
return grading.score !== 0 ? grading.score : null; | ||
} | ||
}; | ||
|
||
const renderScore = () => { | ||
const score = getScore(); | ||
if (score === null) { | ||
return null; | ||
} | ||
|
||
return <Tag className="grading-verdict-tag__score">{score}</Tag>; | ||
}; | ||
|
||
return ( | ||
<div className={classNames('grading-verdict-tag', { 'grading-verdict-tag--wide': wide })}> | ||
{verdict && <VerdictTag verdictCode={verdict.code} />} | ||
{renderScore()} | ||
</div> | ||
); | ||
} |
12 changes: 12 additions & 0 deletions
12
judgels-client/src/components/GradingVerdictTag/GradingVerdictTag.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.grading-verdict-tag { | ||
display: inline-flex; | ||
gap: 10px; | ||
|
||
.grading-verdict-tag__score { | ||
margin-left: auto; | ||
} | ||
|
||
&--wide { | ||
width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
judgels-client/src/components/SubmissionsTable/Programming/SubmissionsTable.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { Tag } from '@blueprintjs/core'; | ||
import { Time } from '@blueprintjs/icons'; | ||
|
||
import { getVerdictDisplayCode, getVerdictIntent, VerdictCode } from '../../modules/api/gabriel/verdict'; | ||
import { getVerdictDisplayName, getVerdictIntent } from '../../modules/api/gabriel/verdict'; | ||
|
||
export const VerdictTag = ({ verdictCode }) => { | ||
const tag = verdictCode === VerdictCode.PND ? <Time /> : getVerdictDisplayCode(verdictCode); | ||
return ( | ||
<Tag round intent={getVerdictIntent(verdictCode)}> | ||
{tag} | ||
{getVerdictDisplayName(verdictCode)} | ||
</Tag> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.