Skip to content

Commit

Permalink
things we presented in DW (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Sicat authored Dec 19, 2023
2 parents 6af47d8 + 796d9e7 commit 5c42226
Show file tree
Hide file tree
Showing 15 changed files with 266 additions and 238 deletions.
2 changes: 1 addition & 1 deletion backend/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,4 @@ def index():

if __name__ == '__main__':
scheduler.start()
app.run(host='0.0.0.0', debug=True)
app.run(host='0.0.0.0', debug=True)
8 changes: 2 additions & 6 deletions frontend/app/(site)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Butt from "../components/button";
import Link from "next/link";
import { useRouter } from "next/navigation";


// export const metadata: Metadata = {
// title: "Brew & Brain",
// description: "Brew * Brain",
Expand Down Expand Up @@ -85,12 +84,9 @@ export default function Home() {
<section>
<About />
</section>
<section>
<Discounts />
</section>
<footer>
{/* <footer>
<Footer />
</footer>
</footer> */}
</div>
);
}
32 changes: 9 additions & 23 deletions frontend/app/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import TemporaryDrawer from "../components/side_bar";
function page() {
const [username, setUsername] = useState("");
useEffect(() => {
const accessToken = localStorage.getItem('user');
setUsername(accessToken ? JSON.parse(accessToken).Username : "")
const accessToken = localStorage.getItem("user");
setUsername(accessToken ? JSON.parse(accessToken).Username : "");
document.title = "Account";
}, []);

Expand Down Expand Up @@ -61,16 +61,6 @@ function page() {
</Link>
<Line></Line>
</div>

<div className="text-sm mt-4">
<Link href="#">
<Dropdown
title="Rewards"
LeftArrow={<KeyboardArrowRightIcon style={{ fontSize: 23 }} />}
/>
</Link>
<Line></Line>
</div>
</div>

<div className="mt-7">
Expand All @@ -97,21 +87,17 @@ function page() {
</Link>
<Line></Line>
</div>

<div className="text-sm mt-4">
<Link href="#">
<Dropdown
title="Notifications"
LeftArrow={<KeyboardArrowRightIcon style={{ fontSize: 23 }} />}
/>
</Link>
<Line></Line>
</div>
</div>

<div className="mt-20"></div>

<Butt title="Log Out" Bgcolor="#FFF1E4" width="325px" height="34px" onClick={handleLogout} />
<Butt
title="Log Out"
Bgcolor="#FFF1E4"
width="325px"
height="34px"
onClick={handleLogout}
/>
</div>
);
}
Expand Down
38 changes: 20 additions & 18 deletions frontend/app/admin_accounts/[userId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client';
"use client";
import React, { useState, useEffect } from "react";
import Teste from "@/app/components/account";
import CloseIcon from "@mui/icons-material/Close";
Expand All @@ -7,18 +7,15 @@ import CircleIcon from "@mui/icons-material/Circle";
import TextInput from "@/app/components/text_input";
import Drop from "@/app/components/dropdown_button";
import Butt from "@/app/components/button";


import Link from "next/link";

function Page() {

const handleBackButtonClick = () => {
console.log("back button clicked")
}
console.log("back button clicked");
};


const userId = localStorage.getItem('user_id')
console.log(userId)
const userId = localStorage.getItem("user_id");
console.log(userId);

const [formData, setFormData] = useState({
userName: "",
Expand All @@ -33,10 +30,12 @@ function Page() {

const fetchUserData = async () => {
try {
const response = await fetch(`http://localhost:5000/api/get-user/${userId}`);
const response = await fetch(
`http://localhost:5000/api/get-user/${userId}`
);
if (response.ok) {
const userData = await response.json();
const datas = userData.user
const datas = userData.user;
console.log("User Data:", userData); // Log the received user data
console.log("User Data1:", datas); // Log the received user data
setFormData({
Expand Down Expand Up @@ -83,6 +82,7 @@ function Page() {
if (response.ok) {
const updatedUserData = await response.json();
console.log("Profile updated successfully:", updatedUserData);
alert("Customer's profile updated.");
} else {
console.error("Error updating profile:", await response.json());
}
Expand Down Expand Up @@ -163,13 +163,15 @@ function Page() {

<div className="mt-16"></div>

<Butt
title="Update Profile"
Bgcolor="#FFF1E4"
width="325px"
height="34px"
onClick={handleUpdateProfile}
/>
<Link href="/admin_accounts">
<Butt
title="Update Profile"
Bgcolor="#FFF1E4"
width="325px"
height="34px"
onClick={handleUpdateProfile}
/>
</Link>
</div>
);
}
Expand Down
4 changes: 0 additions & 4 deletions frontend/app/admin_accounts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ function Page() {
</div>

<div className="container flex items-center justify-center space-x-5 text-xs text-black font-bold mt-2">
<Link href="/admin_dashboard">
<p>Dashboard</p>
</Link>
<Link href="/admin_areamap">
<p>Area Map</p>
</Link>
Expand All @@ -95,7 +92,6 @@ function Page() {
</div>

<div className="container flex items-center justify-center space-x-8 text-xs text-black font-bold mb-2">
<p className="text-backcolor">_________</p>
<p className="text-backcolor">________</p>
<p className="text-backcolor">____________</p>
<p className="text-amber-500">____________</p>
Expand Down
Loading

0 comments on commit 5c42226

Please sign in to comment.