Skip to content

Commit 44764f8

Browse files
committed
fix: hide problem difficulty in contest/competition
1 parent ea467c1 commit 44764f8

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/components/ProblemContent.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ export interface Props {
1818
data: IProblem;
1919
problemIndex?: number;
2020
problemAlias?: string;
21+
hideDifficulty?: boolean;
2122
}
2223

2324
export interface State {
2425
audioPlaying: boolean;
2526
}
2627

2728
class ProblemContent extends React.Component<Props, State> {
29+
static defaultProps: Partial<Props> = {
30+
hideDifficulty: false,
31+
};
32+
2833
constructor(props: Props) {
2934
super(props);
3035
this.state = {
@@ -148,12 +153,14 @@ class ProblemContent extends React.Component<Props, State> {
148153
className="text-center"
149154
style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
150155
>
151-
<ProblemDifficulty
152-
difficulty={data.difficulty}
153-
difficultyAigc={data.difficultyAigc}
154-
difficultyAiAuthor={data.difficultyAiAuthor}
155-
className="mr-md-lg"
156-
/>
156+
{!this.props.hideDifficulty && (
157+
<ProblemDifficulty
158+
difficulty={data.difficulty}
159+
difficultyAigc={data.difficultyAigc}
160+
difficultyAiAuthor={data.difficultyAiAuthor}
161+
className="mr-md-lg"
162+
/>
163+
)}
157164
<span>
158165
{titlePrefix}
159166
<span style={this.getFontStyle()}>{data.title}</span>

src/components/ProblemDetailPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const ProblemDetailPage: React.FC<Props> = ({
266266
</table>
267267
</Skeleton>
268268
</Card>
269-
{!competitionId && !loading && data.tags && !!data.tags.length && (
269+
{!contestId && !competitionId && !loading && data.tags && !!data.tags.length && (
270270
<Card bordered={false}>
271271
<Form layout="vertical" hideRequiredMark={true} className={gStyles.cardForm}>
272272
<Form.Item label="Tags">
@@ -325,6 +325,7 @@ const ProblemDetailPage: React.FC<Props> = ({
325325
data={data}
326326
problemIndex={problemIndex}
327327
problemAlias={problemAlias}
328+
hideDifficulty={!!contestId || !!competitionId}
328329
/>
329330
</Card>
330331
</PageAnimation>

0 commit comments

Comments
 (0)