Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bat-kryptonyte committed Jul 20, 2023
1 parent 38e9eb0 commit cfd6af5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

Check failure on line 1 in .github/workflows/lint.yml

View workflow job for this annotation

GitHub Actions / Prettier

.github/workflows/lint.yml#L1

There are issues with this file's formatting, please run Prettier to fix the errors

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install Node.js dependencies
run: yarn install --immutable --immutable-cache --check-cache

- name: Run linters
uses: wearerequired/lint-action@v2
with:
eslint: true
prettier: true
14 changes: 6 additions & 8 deletions src/screens/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function Home() {
const [randomEndpoint, setRandomEndpoint] = useState("");
const [problemType, setProblemType] = useState("");
const [problemStatement, setProblemStatement] = useState<string>("");
const [finalAnswer, setFinalAnswer] = useState<string>("");
const [answerCandidates, setAnswerCandidates] = useState<string[]>([]);

const endpoints = {
Expand All @@ -59,13 +60,8 @@ export default function Home() {
.then((response) => response.json())
.then((data) => {
console.log(data);
console.log(
"Problem Statement: ",
data["randomProblem"]["Problem Statement"] ||
data["randomProblem"].Problem_Statement
);

setProblem(data["randomProblem"]);

});
};

Expand All @@ -78,6 +74,8 @@ export default function Home() {
setProblemStatement(problem["Problem Statement"]);
setAnswerCandidates(problem["Answer Candidates"]);
}
setFinalAnswer(problem["Final Answer"]);

}
}, [problem]);

Expand Down Expand Up @@ -128,7 +126,7 @@ export default function Home() {
<br />
<br />
<div>
<strong>Answer Candidates:</strong>
{!isNumericalProblem(problem) && <strong>Answer Candidates:</strong>}
{!isNumericalProblem(problem) &&
answerCandidates &&
answerCandidates.map((answer, index) => {
Expand Down Expand Up @@ -156,7 +154,7 @@ export default function Home() {
<br />
<br />
<div>
<strong>Final Answer:</strong> {problem["Final Answer"]}
<strong>Final Answer:</strong> {finalAnswer}
</div>
</div>
</div>
Expand Down

0 comments on commit cfd6af5

Please sign in to comment.