Skip to content

Commit

Permalink
feat(client): indicate problem review more clearly by tag (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar authored Oct 23, 2023
1 parent dd0008e commit f88fbb5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Intent, Tag } from '@blueprintjs/core';
import { ContentCard } from '../../../ContentCard/ContentCard';
import { KatexText } from '../../../KatexText/KatexText';

export function ProblemReviewCard({ alias, statement: { title }, editorial: { text } }) {
return (
<div class="programming-problem-worksheet">
<ContentCard>
<Tag intent={Intent.SUCCESS}>REVIEW</Tag>
<h2 className="programming-problem-statement__name">
{alias ? `${alias}. ` : ''}
{title}
</h2>

<div className="programming-problem-statement__text">
<KatexText key={alias}>{text}</KatexText>
</div>
</ContentCard>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { KatexText } from '../../../KatexText/KatexText';

import './ProblemStatementCard.scss';

export function ProblemStatementCard({ alias, statement: { title, text }, limits: { timeLimit, memoryLimit } }) {
export function ProblemStatementCard({
alias,
statement: { title, text },
limits: { timeLimit, memoryLimit },
showTitle = true,
}) {
const renderTimeLimit = timeLimit => {
if (!timeLimit) {
return '-';
Expand All @@ -29,8 +34,8 @@ export function ProblemStatementCard({ alias, statement: { title, text }, limits
return (
<ContentCard>
<h2 className="programming-problem-statement__name">
{alias ? `${alias}. ` : ''}
{title}
{showTitle && alias ? `${alias}. ` : ''}
{showTitle && title}
</h2>
<HTMLTable condensed className="programming-problem-statement__limits">
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import './ProblemWorksheetCard.scss';
export function ProblemWorksheetCard({
alias,
worksheet: { statement, limits, submissionConfig, reasonNotAllowedToSubmit },
showTitle,
submissionWarning,
gradingLanguage,
onSubmit,
}) {
const renderStatement = () => {
return <ProblemStatementCard alias={alias} statement={statement} limits={limits} />;
return <ProblemStatementCard alias={alias} statement={statement} limits={limits} showTitle={showTitle} />;
};

const renderSubmission = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import StatementLanguageWidget from '../../../../../../../../../../components/La
import { selectCourse } from '../../../../../../../modules/courseSelectors';
import { selectCourseChapter } from '../../../../../modules/courseChapterSelectors';
import { ProblemWorksheetCard } from '../../../../../../../../../../components/ProblemWorksheetCard/Programming/ProblemWorksheetCard';
import { ProblemEditorialCard } from '../../../../../../../../../../components/ProblemWorksheetCard/Programming/ProblemEditorialCard/ProblemEditorialCard';
import { ProblemReviewCard } from '../../../../../../../../../../components/ProblemWorksheetCard/Programming/ProblemReviewCard/ProblemReviewCard';

import './ChapterProblemStatementPage.scss';

Expand All @@ -27,14 +27,12 @@ export function ChapterProblemStatementPage({ worksheet }) {
);
};

const renderEditorial = () => {
const renderReview = () => {
const { problem, editorial } = worksheet;
if (!editorial) {
return null;
}
return (
<ProblemEditorialCard alias={problem.alias} statement={worksheet.worksheet.statement} editorial={editorial} />
);
return <ProblemReviewCard alias={problem.alias} statement={worksheet.worksheet.statement} editorial={editorial} />;
};

const renderStatement = () => {
Expand All @@ -44,9 +42,9 @@ export function ChapterProblemStatementPage({ worksheet }) {
return (
<details>
<summary>
<small>Click to view original problem statement</small>
<small>View problem statement</small>
</summary>
<ProblemWorksheetCard alias={problem.alias} worksheet={worksheet.worksheet} />
<ProblemWorksheetCard alias={problem.alias} worksheet={worksheet.worksheet} showTitle={false} />
</details>
);
}
Expand All @@ -57,7 +55,7 @@ export function ChapterProblemStatementPage({ worksheet }) {
return (
<ContentCard className="chapter-programming-problem-statement-page">
{renderStatementLanguageWidget()}
{renderEditorial()}
{renderReview()}
{renderStatement()}
</ContentCard>
);
Expand Down

0 comments on commit f88fbb5

Please sign in to comment.