Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bingsu99 committed Dec 12, 2023
1 parent 200de67 commit 2b62f40
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 34 deletions.
6 changes: 3 additions & 3 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/css/main.12d852b1.css",
"main.js": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.c3b7729e.js",
"main.js": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.8b94b85f.js",
"static/media/garage_gang_pic.jpg": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/media/garage_gang_pic.05e4f5e3d144f588b8dc.jpg",
"static/media/PROFILE PIC.png": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/media/PROFILE PIC.798457f7c8eec972d467.png",
"static/media/Garage_Gang_Pic.png": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/media/Garage_Gang_Pic.d9cc2493b522d787db5e.png",
Expand All @@ -16,10 +16,10 @@
"index.html": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/index.html",
"static/media/noise.svg": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/media/noise.047c0d2fa455122226961c4b6ae3ffe8.svg",
"main.12d852b1.css.map": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/css/main.12d852b1.css.map",
"main.c3b7729e.js.map": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.c3b7729e.js.map"
"main.8b94b85f.js.map": "https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.8b94b85f.js.map"
},
"entrypoints": [
"static/css/main.12d852b1.css",
"static/js/main.c3b7729e.js"
"static/js/main.8b94b85f.js"
]
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/Garage_Icon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="GEEEnius Investment"/><link rel="apple-touch-icon" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/Garage_Icon.png"/><link rel="manifest" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/manifest.json"/><title>GEEEnius</title><script defer="defer" src="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.c3b7729e.js"></script><link href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/css/main.12d852b1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/Garage_Icon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="GEEEnius Investment"/><link rel="apple-touch-icon" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/Garage_Icon.png"/><link rel="manifest" href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/manifest.json"/><title>GEEEnius</title><script defer="defer" src="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/js/main.8b94b85f.js"></script><link href="https://Garage-at-EEE.github.io/geeenius-pitch-voting/static/css/main.12d852b1.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions docs/static/js/main.8b94b85f.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/static/js/main.c3b7729e.js.map

This file was deleted.

3 changes: 2 additions & 1 deletion src/components/MainPage/AccountCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const RotationWrapper = styled(motion.div)`

export default function AccountCard(props) {
// handle mouse move on document
const storedObject = JSON.parse(localStorage.getItem("geeenius"));

return (
<Box {...props}>
Expand Down Expand Up @@ -140,7 +141,7 @@ export default function AccountCard(props) {
color: "#294283",
}}
>
Ricky Winarko
{storedObject.name}
</Typography>
<Typography
variant="h5"
Expand Down
37 changes: 35 additions & 2 deletions src/pages/Home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,42 @@ import GreetingCard from "components/MainPage/InnovatorCard";
import { AnimatePresence, motion } from "framer-motion";
import moment from "moment";
import { Parallax } from "react-parallax";
import { APP_SCRIPT } from "../../utils/constants";

const fetchData = async (matric_num) => {
try {
const response = await fetch(APP_SCRIPT, {
method: "POST",
body: JSON.stringify({
action: "profile",
value: { matric: matric_num },
}),
});

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const result = await response.json();

if (result.state === 200) {
console.log(result);
localStorage.setItem("geeenius", JSON.stringify(result.profile));
}
} catch (error) {
console.error("Error:", error.message);
}
};

const HeroComponent = () => {
const storedObject = JSON.parse(localStorage.getItem("geeenius"));
const [portfolio, setPortfolio] = useState(storedObject);

useEffect(() => {
console.log("sending request");
fetchData(portfolio.matric);
}, []);

return (
<Parallax
bgImage={BACKGROUND_IMG}
Expand Down Expand Up @@ -90,7 +124,7 @@ const HeroComponent = () => {
fontWeight="800"
color="white"
>
$69.69
{"$" + portfolio["total_balance"]}
</Typography>
<Button
variant="contained"
Expand Down Expand Up @@ -131,7 +165,6 @@ const HomePage = () => {
const metadata = useMetadataContext();
const Navigate = useNavigate();
const [isLoading, setLoading] = useState(true);
const [page, setPage] = useState(1);

useEffect(() => {
// Simulate a delay using setTimeout
Expand Down
44 changes: 23 additions & 21 deletions src/pages/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ import Container from "@mui/material/Container";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";

import { APP_SCRIPT } from "./constants";
import { APP_SCRIPT } from "../../utils/constants";
import { useNavigate } from "react-router-dom";

const LoginPage = () => {
const navigate = useNavigate();
const [isLoading, setLoading] = useState(true);
const [matricNumber, setMatricNumber] = useState("");
const [birthday, setBirthday] = useState("");
const [name, setName] = useState("");

if (localStorage.getItem("geeenius") != null) {
navigate("/home");
}

const handleMatricNumberChange = (event) => {
setMatricNumber(event.target.value);
};
Expand All @@ -35,35 +41,31 @@ const LoginPage = () => {
setName(event.target.value);
};

const value = useMetadataContext();

console.log(value);

const handleSubmit = async () => {
console.log(matricNumber);
console.log(birthday);
setLoading(true);
try {
const response = await fetch(
"https://script.google.com/macros/s/AKfycbwjQT61gAbZ0JlnHOMKkWm4EgCyuHHvyf2h6jepAv1v5JCOvszqsjSdNhhtN83iZlLN/exec",
{
method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
body: JSON.stringify({
action: "login",
value: { matric: matricNumber, name: name, passcode: birthday },
}),
}
);
const response = await fetch(APP_SCRIPT, {
method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
body: JSON.stringify({
action: "login",
value: { matric: matricNumber, name: name, passcode: birthday },
}),
});

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const result = await response.json();
console.log("Response:", result);
localStorage.setItem(
"geeenius",
JSON.stringify(result.investment_portfolio)
);
console.log(result.investment_portfolio);
navigate("/home");
} catch (error) {
console.error("Error:", error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const GRAPHQL = HOST + "/graphql";
export const HEADER_HEIGHT = "76px";

export const APP_SCRIPT =
"https://script.google.com/macros/s/AKfycbwjQT61gAbZ0JlnHOMKkWm4EgCyuHHvyf2h6jepAv1v5JCOvszqsjSdNhhtN83iZlLN/exec";
"https://script.google.com/macros/s/AKfycbz-OVIyhzHK9yt4qXnZ7zzAbAwzjH2sp0stmfSJzdMPOytWi4Sij6yg7dRrhtLeuau8/exec";

const GearAnimation = () => {
return (
Expand Down
1 change: 0 additions & 1 deletion src/utils/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import RoutePaths from "utils/routes";
const WebRoute = () => {
const getRoutes = (allRoutes) =>
allRoutes.map((route) => {
console.log(route.route);
return (
<Route path={route.route} element={route.component} key={route.key} />
);
Expand Down

0 comments on commit 2b62f40

Please sign in to comment.