Developed with the software and tools below.
βΊ this project is related to the start2Impact blockchain master specifically for the React-Typescript course. I will therefore use typescript and react mainly to create an app based on multiple-answer quizzes, the request is: You will create a web app in React to carry out a quiz dedicated to the topic of food and its impact on the environment and on people.
---
## π¦ Features and Decision
βΊ the app will open with the request to enter a username if not already present on local host. At that point we will start with the first set of multiple answer questions, there are 10 questions .
A final screen will give the score obtained, to which a "skill" level will be associated (for example, from 1 to 3 correct answers -> basic, from 4 to 7 correct answers -> intermediate, from 8 to 9 correct answers -> expert /a, 10 correct answers -> teacher)
you can share the result on a social network, currently Twitter - X .
For each correct or incorrect answer there will be a graphic pop up to provide feedback.
the questions will have to be inserted in the quiz.ts file in the src/level1 path and will have to be encrypted before putting the app online. to encrypt them, launch as per the instructions: npm run encrypt-answers, at which point you will find a new file "solutionEncrypted.json" in the same folder which will be decrypted by a custom hook.ovviamente il fie "originalAnswers" si potrebbe cancellare ma per motivi solo di chiarezza e in questa demo lo lascio nel repo. to encrypt and decrypt I use CriptoJS and a key that is in .env. for clarity I left a ".envfake" file to give an example of how to insert the key :all this to avoid giving users the chance to discover the correct answers without creating a backend.
non ho usato useReducer perchΓ©' il rpop drill non e' mai piΓΉ di un livello , per organizzare e pulire il codice ho usato un paio di custom hook.
-
---
## Repository Structure
```sh
βββ S2ImpactTriviaReactTSRefactor/
βββ README.md
βββ encryptAnswers.js
βββ favicon.ico
βββ index.html
βββ package-lock.json
βββ package.json
βββ postcss.config.js
βββ public
β βββ favicon.ico
β βββ font
β βββ ScriptSheep.ttf
β βββ ScriptofSheep.eot
β βββ ScriptofSheep.ttf
β βββ ScriptofSheep.woff
β βββ ScriptofSheep.woff2
βββ src
β βββ App.tsx
β βββ EndGame.tsx
β βββ Footer.tsx
β βββ Header.tsx
β βββ Layout.tsx
β βββ Logo.tsx
β βββ Modal.tsx
β βββ Quiz.tsx
β βββ QuizQuestion.tsx
β βββ ScorePopup.tsx
β βββ Success.tsx
β βββ UserInput.tsx
β βββ index.css
β βββ lib
β β βββ hooks
β β β βββ useDecryptedAnswers.ts
β β β βββ useGame.ts
β β β βββ useQuiz.ts
β β βββ types
β β βββ types.tsx
β βββ main.tsx
β βββ quiz
β β βββ level1
β β βββ originalAnsewer.json
β β βββ quiz.ts
β β βββ solutionEncrypted.json
β βββ vite-env.d.ts
βββ tailwind.config.js
βββ tsconfig.json
βββ tsconfig.node.json
βββ vite.config.ts
```
---
## 𧩠Modules
βΊ TS config files
|
| [index.html](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/index.html) | βΊ HTML main file
|
| [postcss.config.js](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/postcss.config.js) | βΊ postcss config
|
| [encryptAnswers.js](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/encryptAnswers.js) | βΊ utility for encrypted answer
|
| [vite.config.ts](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/vite.config.ts) | βΊ vite config file
|
| [package.json](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/package.json) | βΊ package json
|
| [tsconfig.node.json](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/tsconfig.node.json) | βΊ config file
|
| [tailwind.config.js](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/tailwind.config.js) | βΊ tailwind config
|
| [package-lock.json](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/package-lock.json) | βΊ lock
|
βΊ Ennd-game page
|
| [ScorePopup.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/ScorePopup.tsx) | βΊ Score pop-up component
|
| [Header.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Header.tsx) | βΊ Header component
|
| [Footer.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Footer.tsx) | βΊ Footer component
|
| [Success.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Success.tsx) | βΊ Succes component
|
| [Logo.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Logo.tsx) | βΊ logo component
|
| [Modal.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Modal.tsx) | βΊ Modal component
|
| [main.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/main.tsx) | βΊ main
|
| [vite-env.d.ts](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/vite-env.d.ts) | βΊ
|
| [UserInput.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/UserInput.tsx) | βΊ UserInput component
|
| [Layout.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Layout.tsx) | βΊ Main layout component
|
| [App.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/App.tsx) | βΊ App component
|
| [Quiz.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/Quiz.tsx) | βΊ Quiz component
|
| [index.css](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/index.css) | βΊ main style css file
|
| [QuizQuestion.tsx](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/QuizQuestion.tsx) | βΊ QuizQuestion component
|
βΊ level 1 solution encrypted
|
| [quiz.ts](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/quiz/level1/quiz.ts) | βΊ level 1 quiz
|
| [originalAnsewer.json](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/quiz/level1/originalAnsewer.json) | βΊ no encrypted answer
|
βΊ GmameStatus and TUser types declarations
|
βΊ custom hook useGame/code> |
| [useQuiz.ts](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/lib/hooks/useQuiz.ts) | βΊ custom hook useQuiz
|
| [useDecryptedAnswers.ts](https://github.com/boobaGreen/S2ImpactTriviaReactTSRefactor/blob/master/src/lib/hooks/useDecryptedAnswers.ts) | βΊ custom hook useDecryptedAnswers
|