Skip to content
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

cses problem url support added #55

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/component/QuestionsPane/ProblemList/ProblemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ const ProblemList: React.FC<AppProps> = ({
const NextButton = () => {
const getQuestionData = async () => {
const { hostname } = new Url(url);
if (hostname !== "codeforces.com" && hostname !== "atcoder.jp") {
if (hostname !== "codeforces.com" && hostname !== "atcoder.jp" && hostname !== "cses.fi") {
setErrorText({
error: true,
comment: "Domain should either be codeforces or atcoder",
comment: "Domain should either be codeforces/atcoder/CSES problem set",
});
} else {
const { data }: AxiosResponse<{ error: boolean; htmlString: string }> = await axios({
Expand Down Expand Up @@ -162,7 +162,7 @@ const ProblemList: React.FC<AppProps> = ({
<>
<Grid container className={styles.root}>
<Grid item className={styles["request-field"]}>
<label>Enter Codeforces Or Atcoder Question URL:</label>
<label>Enter Codeforces/ Atcoder/ CSES Problem Set Question URL:</label>
<CssTextField
onChange={(e) => {
setUrl(e.target.value as string);
Expand Down
11 changes: 9 additions & 2 deletions src/component/QuestionsPane/ProblemPage/CodeForces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const LeetCode = ({ scrappedData }: { scrappedData: ScrappedDataType }) => {
{ left: "\\[", right: "\\]", display: true },
{ left: "%%", right: "%%", display: true },
{ left: "\\(", right: "\\)", display: false },
{ left: "$", right: "$", display: true },
],
});
}
Expand All @@ -31,11 +32,17 @@ const LeetCode = ({ scrappedData }: { scrappedData: ScrappedDataType }) => {
<div className={"codeforces"} ref={MathRef}>
{parse(htmlString)}
</div>
) : (
) : ""}
{hostname === "atcoder.com" ? (
<div className={"atcoder"} ref={MathRef}>
{parse(htmlString)}
</div>
)}
) : ""}
{hostname === "cses.fi" ? (
<div className={"cses"} ref={MathRef}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, where does cses className come from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if problem is of cses than div will have className="cses" as it is in "atcoder" and "codeforces"?
is that you are asking for?? i didn't get you are asking for

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, where does cses className come from?

You didn't select cses className, you should select that and add proper style for related element

{parse(htmlString)}
</div>
) : ""}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't separate the conditions, they are all related to each other, for better code looking change this to as it was and add new condition

<Divider />
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface QuestionDataSS {
}
export interface ScrappedDataType {
htmlString: string;
hostname: "codeforces.com" | "atcoder.jp";
hostname: "codeforces.com" | "atcoder.jp" | "cses.fi";
}

export interface TabsContextTypes {
Expand Down