diff --git a/app/react-simple-chatbot.d.ts b/app/react-simple-chatbot.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/app/src/App.jsx b/app/src/App.jsx index 7e2a833..9fe4251 100644 --- a/app/src/App.jsx +++ b/app/src/App.jsx @@ -9,12 +9,18 @@ import Noncense from './components/blockchain/Noncense.jsx'; import Intro2 from './components/blockchain/intro2.jsx'; import Window from './components/Window.jsx'; import Result from './components/Result.jsx'; +import HelpBot from './components/HelpBot.jsx'; function App(){ return ( - } /> + + + + } /> {/* } /> } /> } /> diff --git a/app/src/components/HelpBot.jsx b/app/src/components/HelpBot.jsx index 63a8565..f00390d 100644 --- a/app/src/components/HelpBot.jsx +++ b/app/src/components/HelpBot.jsx @@ -1,9 +1,13 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import ChatBot from "react-simple-chatbot"; import alluArjun from "../assets/alluArjun.png"; import ohMyGoddo from "../assets/ohMyGoddo.png"; +import { useNavigate } from 'react-router-dom'; const HelpBot = ({ level = 1 }) => { + + const navigate = useNavigate(); + const getInitialSteps = (level) => { if (level === 1) { return [ @@ -100,17 +104,27 @@ const HelpBot = ({ level = 1 }) => { id: "hacker-input", user: true, trigger: (inputValue) => { - if (inputValue === 'bad munda') { - return 'next-level'; + console.log(inputValue.value); + console.log(inputValue.value === 'bad'); + if (inputValue.value === 'bad') { + console.log('correct'); + return 'congo-msg'; } else { return 'wrong-ans'; } }, + }, + { + id: "congo-msg", + message: "Correct answer! You found the hacker!", + trigger: 'next-level', }, { id: "next-level", - message: "Congrats, you found the hacker! Let's move on to blockchain now.", - trigger: 2, + component: ( + + ), + end: true, }, { id: "wrong-ans", @@ -177,4 +191,17 @@ const HelpBot = ({ level = 1 }) => { ); }; + +const RedirectComponent = ({ navigate }) => { + useEffect(() => { + const timer = setTimeout(() => { + navigate('/intro2'); + }, 2000); + + return () => clearTimeout(timer); + }, [navigate]); + + return
Redirecting to the next level...
; +}; + export default HelpBot;