From 25fea2b0061e1f48425797cc0cca7c8dd3d1492e Mon Sep 17 00:00:00 2001 From: Ibrahim-Halil-Kuray <71791007+Ibrahim-Halil-Kuray@users.noreply.github.com> Date: Sun, 29 Oct 2023 11:11:56 +0100 Subject: [PATCH 1/3] Update .eslintrc.js --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3886fdd..12f894d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,6 @@ module.exports = { 'eslint:recommended', // Use the recommened rules from eslint 'plugin:@typescript-eslint/recommended', // Use the recommended rules from @typescript-eslint/eslint-plugin 'plugin:react/recommended', // Use the recommended rules from eslint-plugin-react - 'prettier/@typescript-eslint', 'prettier', ], parser: '@typescript-eslint/parser', // Specifies the ESLint parser From b26769f201e87770f78c1251022a37c5817c51cd Mon Sep 17 00:00:00 2001 From: Ibrahim-Halil-Kuray <71791007+Ibrahim-Halil-Kuray@users.noreply.github.com> Date: Sun, 29 Oct 2023 11:12:00 +0100 Subject: [PATCH 2/3] Update App.tsx --- src/App.tsx | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4567499..6a840e0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,16 +1,55 @@ -import React from 'react'; +import React, {useState} from 'react'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import logo from './logo.svg'; import baselhack from './assests/images/logohack.png'; import './App.css'; +import Language from './components/Language'; +import Difficulty from './components/Difficulty'; +import Questions from './components/Questions'; + const App: React.FunctionComponent = () => { + const [selectedLanguage, setSelectedLanguage] = useState(null); + const [selectedDifficulty, setSelectedDifficulty] = useState( + null + ); + const [apiUrl, setApiUrl] = useState(null); + + const handleLanguageSelect = (language: string) => { + setSelectedLanguage(language); + }; + + const handleDifficultySelect = (difficulty: string) => { + setSelectedDifficulty(difficulty); + + // difficulty lvl depending on users choice + if (difficulty === 'Beginner') { + setApiUrl('http://localhost:3000/expert.json'); + } else if (difficulty === 'Advanced') { + setApiUrl('http://localhost:3000/advanced.json'); + } else if (difficulty === 'Expert') { + setApiUrl('https://www.api.org/sda125'); + } + }; return (
Logo HackBasel
Certifever help
- +
+ {!selectedLanguage ? ( + + ) : !selectedDifficulty ? ( + + ) : apiUrl ? ( + + ) : ( +
+

Uploading...

+
+ )} +

Welcome to Certifever

From ee95df10cf6d52c5aa6fa508517402e278db6999 Mon Sep 17 00:00:00 2001 From: Ibrahim-Halil-Kuray <71791007+Ibrahim-Halil-Kuray@users.noreply.github.com> Date: Sun, 29 Oct 2023 11:18:13 +0100 Subject: [PATCH 3/3] Update Questions.tsx --- src/components/Questions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Questions.tsx b/src/components/Questions.tsx index fb8589f..17f7462 100644 --- a/src/components/Questions.tsx +++ b/src/components/Questions.tsx @@ -92,7 +92,7 @@ const Questions: React.FC = ({ apiUrl }) => { {isAnswered && (

- Correct:{' '} + Correct Response is:{' '} { questions[currentQuestionIndex].options[ questions[currentQuestionIndex].correct_answer