Skip to content

Commit ae166c9

Browse files
committed
Reformat files to match prettier settings
1 parent 2908bc0 commit ae166c9

File tree

10 files changed

+282
-171
lines changed

10 files changed

+282
-171
lines changed
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import { fetchQuestion } from '@/api/gateway';
1+
import { fetchQuestion } from "@/api/gateway";
22
import { Question as QnType, StatusBody, isError } from "@/api/structs";
3-
import styles from '@/style/question.module.css';
4-
import ErrorBlock from '@/components/shared/ErrorBlock';
5-
import React from 'react'
6-
import QuestionBlock from './question';
3+
import styles from "@/style/question.module.css";
4+
import ErrorBlock from "@/components/shared/ErrorBlock";
5+
import React from "react";
6+
import QuestionBlock from "./question";
77

88
type Props = {
99
params: {
10-
question: string
11-
}
12-
}
10+
question: string;
11+
};
12+
};
1313

1414
async function Question({ params }: Props) {
1515
const question = await fetchQuestion(params.question);
1616

1717
return (
1818
<div className={styles.wrapper}>
19-
{
20-
isError(question)
21-
? <ErrorBlock err={question as StatusBody}/>
22-
: <QuestionBlock question={question as QnType}/>
23-
}
19+
{isError(question) ? (
20+
<ErrorBlock err={question as StatusBody} />
21+
) : (
22+
<QuestionBlock question={question as QnType} />
23+
)}
2424
</div>
25-
)
25+
);
2626
}
2727

28-
export default Question;
28+
export default Question;
Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
'use client';
1+
"use client";
22
import { Question, Difficulty } from "@/api/structs";
33
import Chip from "@/components/shared/Chip";
44
import PeerprepButton from "@/components/shared/PeerprepButton";
5-
import styles from '@/style/question.module.css';
5+
import styles from "@/style/question.module.css";
66

77
interface Props {
8-
question : Question;
8+
question: Question;
99
}
1010

1111
interface DifficultyChipProps {
12-
diff: Difficulty
12+
diff: Difficulty;
1313
}
1414

1515
function DifficultyChip({ diff }: DifficultyChipProps) {
16-
return (
17-
diff === Difficulty.Easy
18-
? <Chip className={styles.easy}>Easy</Chip>
19-
: diff === Difficulty.Medium
20-
? <Chip className={styles.med}>Med</Chip>
21-
: <Chip className={styles.hard}>Hard</Chip>
16+
return diff === Difficulty.Easy ? (
17+
<Chip className={styles.easy}>Easy</Chip>
18+
) : diff === Difficulty.Medium ? (
19+
<Chip className={styles.med}>Med</Chip>
20+
) : (
21+
<Chip className={styles.hard}>Hard</Chip>
2222
);
2323
}
2424

@@ -28,7 +28,9 @@ function QuestionBlock({ question }: Props) {
2828
const createRow = (key: string) => (
2929
<tr key={key}>
3030
<td className={`${styles.table} ${styles.cell}`}>{key}</td>
31-
<td className={`${styles.table} ${styles.cell}`}>{question.test_cases[key]}</td>
31+
<td className={`${styles.table} ${styles.cell}`}>
32+
{question.test_cases[key]}
33+
</td>
3234
</tr>
3335
);
3436

@@ -37,41 +39,56 @@ function QuestionBlock({ question }: Props) {
3739
<div className={styles.qn_container}>
3840
<div className={styles.title_wrapper}>
3941
<div className={styles.label_wrapper}>
40-
<h1 className={styles.title}>Q{question.id}: {question.title}</h1>
42+
<h1 className={styles.title}>
43+
Q{question.id}: {question.title}
44+
</h1>
4145
<DifficultyChip diff={question.difficulty} />
4246
</div>
43-
<PeerprepButton className={` ${styles.button}`}
44-
onClick={/* TODO: Replace this function with gateway.delete*/() => console.log("Delete Me!")}>
47+
<PeerprepButton
48+
className={` ${styles.button}`}
49+
onClick={
50+
/* TODO: Replace this function with gateway.delete*/ () =>
51+
console.log("Delete Me!")
52+
}
53+
>
4554
Delete
4655
</PeerprepButton>
4756
</div>
4857
<div className={styles.label_wrapper}>
4958
<p>Categories: </p>
50-
{question.categories.length == 0
51-
? (<p>No categories listed.</p>)
52-
: question.categories.map((elem, idx) => (
53-
<p key={idx}>{elem}</p>
54-
))}
59+
{question.categories.length == 0 ? (
60+
<p>No categories listed.</p>
61+
) : (
62+
question.categories.map((elem, idx) => <p key={idx}>{elem}</p>)
63+
)}
5564
</div>
5665
<p>{question.description}</p>
57-
<br/>
66+
<br />
5867
{question.test_cases && (
5968
<table className={styles.table}>
6069
<tbody>
6170
<tr>
62-
<th className={`${styles.table} ${styles.header} ${styles.input}`}>Input</th>
63-
<th className={`${styles.table} ${styles.header} ${styles.output}`}>Expected Output</th>
71+
<th
72+
className={`${styles.table} ${styles.header} ${styles.input}`}
73+
>
74+
Input
75+
</th>
76+
<th
77+
className={`${styles.table} ${styles.header} ${styles.output}`}
78+
>
79+
Expected Output
80+
</th>
6481
</tr>
6582
{keys.map(createRow)}
6683
</tbody>
6784
</table>
6885
)}
6986
</div>
7087
<form className={styles.editor_container}>
71-
<textarea className={styles.code_editor}/>
88+
<textarea className={styles.code_editor} />
7289
</form>
7390
</>
7491
);
7592
}
7693

77-
export default QuestionBlock;
94+
export default QuestionBlock;

0 commit comments

Comments
 (0)