Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
63 changes: 44 additions & 19 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
import React, { useState } from 'react';
import { BrowserRouter as Router, Route, Routes, useNavigate, useLocation } from 'react-router-dom';
import Home from './Components/Home';
import LogIn from './Components/LogIn';
import ContactUs from './Components/ContactUs';
import AboutUs from './Components/AboutUs';
import FAQ from './Components/FAQ';
import Profile from './Components/Profile';
import Inventory from './Components/Inventory';
import View from './Components/View';
import SignUp from './Components/SignUp';
import Progress from './Components/Progress';

import "@fontsource/inter"
import "@fontsource/inter/700.css";
import { BrowserRouter as Router, Route, Routes, useNavigate } from 'react-router-dom';
import View from './Components/View';

const hard_clicking_sound = new Audio(require('./Audios/clicking_hard.mp3'));
const soft_clicking_sound = new Audio(require('./Audios/clicking_soft.mp3'));

function App() {
const [mute, setMute] = useState(false);

const toggleSound = () => {
setMute(!mute);
}

const playClickSound = (hard = false) => {
if (mute) return;
const clicking_sound = hard ? hard_clicking_sound : soft_clicking_sound;
clicking_sound.play();
}

const location = useLocation();

const usePageNavigation = () => {
const navigate = useNavigate();
Expand All @@ -22,42 +39,52 @@ function App() {

const setPage = usePageNavigation();

const getPageName = () => {
const path = location.pathname;
if (path === '/') return '';
return path.slice(1);
}

const goToLogin = () => {
playClickSound(getPageName() === 'login' ? true : false);
setPage('login');
}

const backToHome = () => {
playClickSound(getPageName() === '' ? true : false);
setPage('');
}

const toContactPage = () => {
playClickSound(getPageName() === 'contact' ? true : false);
setPage('contact');
}

const toAboutUsPage = () => {
playClickSound(getPageName() === 'about' ? true : false);
setPage('about');
}

const toFAQPage = () => {
playClickSound(getPageName() === 'faq' ? true : false);
setPage('faq');
}

const toProfilePage = () => {
playClickSound(getPageName() === 'profile' ? true : false);
setPage('profile');
}

const toInventoryPage = () => {
playClickSound(getPageName() === 'inventory' ? true : false);
setPage('inventory');
}

const toViewPage = () => {
playClickSound(getPageName() === 'inventory/view' ? true : false);
setPage('inventory/view');
}

const toProgressPage = () => {
setPage('Progress');
}

return (
<div>
<Routes>
Expand All @@ -67,11 +94,13 @@ function App() {
contactHandler={toContactPage}
FAQHandler={toFAQPage}
ProfileHandler={toProfilePage}
toggleSoundHandler={toggleSound}
mute={mute}
/>} />

<Route path="/login" element={<LogIn
backToHomeHandler={backToHome}
/>} />
<Route path="/signUp" element={<SignUp backToLoginHandler={goToLogin}/>} />
<Route path="/contact" element={<ContactUs
aboutUsHandler={toAboutUsPage}
contactHandler={toContactPage}
Expand All @@ -95,7 +124,9 @@ function App() {
getStartedHandler={goToLogin}
InventoryHandler={toInventoryPage}
backToHomeHandler={backToHome}
ProgressHandler={toProgressPage}
ProgressHandler={toProfilePage}
toggleSoundHandler={toggleSound}
mute={mute}
/>} />
<Route path="/inventory" element={<Inventory
ProfileHandler={toProfilePage}
Expand All @@ -106,7 +137,9 @@ function App() {
ViewHandler={toViewPage}
InventoryHandler={toInventoryPage}
backToHomeHandler={backToHome}
ProgressHandler={toProgressPage}
ProgressHandler={toProfilePage}
toggleSoundHandler={toggleSound}
mute={mute}
/>} />
<Route path="/inventory/view" element={<View
ProfileHandler={toProfilePage}
Expand All @@ -117,16 +150,8 @@ function App() {
ViewHandler={toViewPage}
InventoryHandler={toInventoryPage}
backToHomeHandler={backToHome}
/>} />
<Route path="/progress" element={<Progress
ProfileHandler={toProfilePage}
aboutUsHandler={toAboutUsPage}
contactHandler={toContactPage}
FAQHandler={toFAQPage}
getStartedHandler={goToLogin}
InventoryHandler={toInventoryPage}
ProgressHandler={toProgressPage}
backToHomeHandler={backToHome}
toggleSoundHandler={toggleSound}
mute={mute}
/>} />
</Routes>
</div>
Expand Down
Binary file added src/Audios/clicking_hard.mp3
Binary file not shown.
Binary file added src/Audios/clicking_soft.mp3
Binary file not shown.
11 changes: 10 additions & 1 deletion src/Components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ interface Props {
contactHandler: () => void;
FAQHandler: () => void;
ProfileHandler: () => void;
toggleSoundHandler:() => void;
mute: boolean;
}

function Home({getStartedHandler, aboutUsHandler, contactHandler, FAQHandler, ProfileHandler}: Props) {
function Home({getStartedHandler,
aboutUsHandler,
contactHandler,
FAQHandler,
ProfileHandler,
toggleSoundHandler,
mute}: Props) {
return (
<div>
<div id="website-title">Website.com</div>
Expand All @@ -26,6 +34,7 @@ function Home({getStartedHandler, aboutUsHandler, contactHandler, FAQHandler, Pr
<button className="info-button" onClick={contactHandler}> Contact </button>
<button className="info-button" onClick={FAQHandler}> FAQ </button>
<button className="info-button" onClick={ProfileHandler}> Profile </button>
<button className="info-button" onClick={toggleSoundHandler}>{mute ? 'Turn On Sound' : 'Turn Off Sound'}</button>
</div>
<img id="icon" src={user_4_fill} alt="user icon" />
<img id="cover" src={humaaansGraph} alt="front page image" />
Expand Down
9 changes: 7 additions & 2 deletions src/Components/Inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ interface Props {
ViewHandler: () => void;
backToHomeHandler:() => void;
InventoryHandler:() => void;
toggleSoundHandler:() => void;
mute: boolean;
}

function Inventory({ProfileHandler,
Expand All @@ -32,7 +34,9 @@ function Inventory({ProfileHandler,
ProgressHandler,
InventoryHandler,
ViewHandler,
backToHomeHandler} : Props) {
backToHomeHandler,
toggleSoundHandler,
mute} : Props) {
return (
<div style={{ margin: 0, padding: 0, height: '100vh', position: 'relative' }}>
<div className="blue-half" style={{ width: '20%', height: '100%', backgroundColor: '#3127A0', position: 'fixed', left: 0}}>
Expand All @@ -57,7 +61,7 @@ function Inventory({ProfileHandler,
<img src={theme_icon} alt="Theme Icon"/>
Theme
</button>
<button id="sidebar-selected-inventory-button">
<button id="sidebar-selected-inventory-button" onClick={InventoryHandler}>
<img src={selected_inventory_icon} alt="Selected Inventory Icon"/>
Inventory
</button>
Expand All @@ -78,6 +82,7 @@ function Inventory({ProfileHandler,
<button className="info-button" onClick={contactHandler}> Contact </button>
<button className="info-button" onClick={FAQHandler}> FAQ </button>
<button className="info-button" onClick={ProfileHandler}> Profile </button>
<button className="info-button" onClick={toggleSoundHandler}>{mute ? 'Turn On Sound' : 'Turn Off Sound'}</button>
</div>
<button id = "red-name-button">Kelvin</button>
<div id="top-area">
Expand Down
9 changes: 7 additions & 2 deletions src/Components/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface Props {
InventoryHandler: () => void;
ProgressHandler: () => void;
backToHomeHandler:() => void;
toggleSoundHandler:() => void;
mute: boolean;
}

function Profile({ProfileHandler,
Expand All @@ -28,7 +30,9 @@ function Profile({ProfileHandler,
FAQHandler,
InventoryHandler,
ProgressHandler,
backToHomeHandler} : Props) {
backToHomeHandler,
toggleSoundHandler,
mute} : Props) {
return (
<div style={{ margin: 0, padding: 0, height: '100vh', position: 'relative' }}>
<div className="blue-half" style={{ width: '20%', height: '100%', backgroundColor: '#3127A0', position: 'absolute', left: 0 }}>
Expand All @@ -37,7 +41,7 @@ function Profile({ProfileHandler,
<img src={learning_icon} alt="Learning icon"/>
Learning Progress
</button>
<button id="sidebar-selected-profile-button">
<button id="sidebar-selected-profile-button" onClick={ProfileHandler}>
<img src={selected_profile_icon} alt="Selected Profile Icon"/>
Profile
</button>
Expand Down Expand Up @@ -84,6 +88,7 @@ function Profile({ProfileHandler,
<button className="info-button" onClick={contactHandler}> Contact </button>
<button className="info-button" onClick={FAQHandler}> FAQ </button>
<button className="info-button" onClick={ProfileHandler}> Profile </button>
<button className="info-button" onClick={toggleSoundHandler}>{mute ? 'Turn On Sound' : 'Turn Off Sound'}</button>
</div>
<button id = "red-name-button">Kelvin</button>

Expand Down
17 changes: 11 additions & 6 deletions src/Components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface Props {
ViewHandler: () => void;
backToHomeHandler:() => void;
InventoryHandler: () => void;
toggleSoundHandler:() => void;
mute: boolean;
}

function View({ProfileHandler,
Expand All @@ -27,7 +29,9 @@ function View({ProfileHandler,
FAQHandler,
ViewHandler,
InventoryHandler,
backToHomeHandler} : Props) {
backToHomeHandler,
toggleSoundHandler,
mute} : Props) {
return (
<div style={{ margin: 0, padding: 0, height: '100vh', position: 'relative' }}>
<div className="blue-half" style={{ width: '20%', height: '100%', backgroundColor: '#3127A0', position: 'fixed', left: 0}}>
Expand Down Expand Up @@ -69,11 +73,12 @@ function View({ProfileHandler,
<span id="page-title-button" onClick={InventoryHandler}> Inventory {'>'} </span>
<span id="page-title-button" onClick={ViewHandler}> View </span>
</div>
<div id="inventory-top-buttons">
<button className="inventory-info-button" onClick={aboutUsHandler}> About Us </button>
<button className="inventory-info-button" onClick={contactHandler}> Contact </button>
<button className="inventory-info-button" onClick={FAQHandler}> FAQ </button>
<button className="inventory-info-button" onClick={ProfileHandler}> Profile </button>
<div id="top-buttons">
<button className="info-button" onClick={aboutUsHandler}> About Us </button>
<button className="info-button" onClick={contactHandler}> Contact </button>
<button className="info-button" onClick={FAQHandler}> FAQ </button>
<button className="info-button" onClick={ProfileHandler}> Profile </button>
<button className="info-button" onClick={toggleSoundHandler}>{mute ? 'Turn On Sound' : 'Turn Off Sound'}</button>
</div>
<button id = "red-name-button">Kelvin</button>

Expand Down