Skip to content

Commit

Permalink
deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
bat-kryptonyte committed Jul 21, 2023
1 parent 474915e commit a967eec
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 45 deletions.
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[functions]
directory = "netlify/functions"
timeout = 26
2 changes: 1 addition & 1 deletion src/screens/Home/Components/Mathjax.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MathJaxComponent: React.FC<MathJaxProps> = ({ problemStatement }) => {
useEffect(() => {
let content = problemStatement;

const regex = /\$(.*?)\$|\\(iint|int|lim)\{(.*?)\}/g;
const regex = /\$(.*?)\$|\\(iint|int|lim|section)\{(.*?)\}/g;
let result;
let lastIndex = 0;

Expand Down
92 changes: 48 additions & 44 deletions src/screens/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";

Check failure on line 1 in src/screens/Home/Home.tsx

View workflow job for this annotation

GitHub Actions / Prettier

src/screens/Home/Home.tsx#L1

There are issues with this file's formatting, please run Prettier to fix the errors
import styles from "./Home.module.css";
import { Box, Button, Flex, Heading, Select, Text } from "@chakra-ui/react";
import MathJaxComponent from "./Components/Mathjax";

interface LawProblem {
Expand Down Expand Up @@ -109,55 +109,59 @@ export default function Home() {
console.log("Final Answer:", finalAnswer);

return (
<div className={styles.container}>
<h1>Select Problem Type</h1>
<select value={problemType} onChange={handleProblemTypeChange}>
<Flex direction="column" align="center" minHeight="100vh" p={2}>
<Heading mb={5}>Select Problem Type</Heading>
<Select value={problemType} onChange={handleProblemTypeChange} mb={4}>
{Object.keys(endpoints).map((problemType, index) => (
<option key={index} value={problemType}>
{problemType}
</option>
))}
</select>
</Select>

<Button mt={2} mb={5} onClick={() => fetchProblem(randomEndpoint)}>
Fetch New Problem
</Button>

<h1>{problemType}</h1>
<div className={styles.problem}>
<div className={styles.problemStatement}>
{<MathJaxComponent problemStatement={problemStatement} />}
</div>
<br />
<br />
<div>
{!isNumericalProblem(problem) && <strong>Answer Candidates:</strong>}
{!isNumericalProblem(problem) &&
answerCandidates &&
answerCandidates.map((answer, index) => {
let prefix;
switch (index) {
case 0:
prefix = "A";
break;
case 1:
prefix = "B";
break;
case 2:
prefix = "C";
break;
case 3:
prefix = "D";
break;
default:
prefix = String.fromCharCode(index + 65);
}
return <div key={index}>{`${prefix}. ${answer}`}</div>;
})}
</div>
<Box w="full" borderWidth="1px" borderRadius="md" p={4} mb={5}>
<Box fontWeight="bold" mb={4}>
<MathJaxComponent problemStatement={problemStatement} />
</Box>

<br />
<br />
<div>
<strong>Final Answer:</strong> {finalAnswer}
</div>
</div>
</div>
{!isNumericalProblem(problem) && (
<Box mt={5}>
<Text fontWeight="bold" mb={2}>Answer Candidates:</Text>
{answerCandidates &&
answerCandidates.map((answer, index) => {
let prefix;
switch (index) {
case 0:
prefix = "A";
break;
case 1:
prefix = "B";
break;
case 2:
prefix = "C";
break;
case 3:
prefix = "D";
break;
default:
prefix = String.fromCharCode(index + 65);
}
return (
<Text key={index}>{`${prefix}. ${answer}`}</Text>
);
})}
</Box>
)}

<Box mt={5}>
<Text fontWeight="bold" mb={2}>Final Answer:</Text>
<MathJaxComponent problemStatement={finalAnswer} />
</Box>
</Box>
</Flex>
);
}

0 comments on commit a967eec

Please sign in to comment.