Skip to content

Commit

Permalink
Merge branch 'profile_page_new' of https://github.com/HungrySlugs-CSE…
Browse files Browse the repository at this point in the history
…115A/hungry-slugs-webapp into profile_page_new
  • Loading branch information
AkhilS2 committed Jun 3, 2024
2 parents d1b18ce + b431f94 commit dc4cd79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 11 additions & 10 deletions app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import React, { useEffect, useState } from "react";
import { googleLogout } from "@react-oauth/google";
import axios from "axios";
import { useCookies } from "react-cookie";
import { fetchLocations, fetchFoodReviewsBulk } from "../db";
//import { fetchUserInfo } from "@/app/user_info";
import {
fetchLocations,
fetchFoodReviewsBulk,
fetchUserInfo,
} from "@/app/requests";
import Image from "next/image";
import { FrontEndReviews } from "@/interfaces/Review";
import { Location } from "@/interfaces/Location";
import { fetchUserInfo } from "@/app/requests";

interface User {
name: string;
Expand All @@ -28,7 +29,7 @@ const Page = () => {
]);
const [reviews, setReviews] = useState<FrontEndReviews>({});
const [notificationsEnabled, setNotificationsEnabled] = useState(
cookies.notificationsEnabled === "true",
cookies.notificationsEnabled === "true"
);
const [foodNames, setFoodNames] = useState<string[]>([]);
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -64,9 +65,9 @@ const Page = () => {
const allFoodNames = locations.flatMap((location) =>
location.categories.flatMap((category) =>
category.sub_categories.flatMap((sub_category) =>
sub_category.foods.map((food) => food.name),
),
),
sub_category.foods.map((food) => food.name)
)
)
);
setFoodNames(allFoodNames);
console.log("Food Names:", allFoodNames);
Expand Down Expand Up @@ -100,8 +101,8 @@ const Page = () => {
});
const filteredReviews = Object.fromEntries(
Object.entries(reviews).filter(
([_, review]) => review.user_rating != null,
),
([_, review]) => review.user_rating != null
)
);
setReviews(filteredReviews);
setLoading(false);
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"prettier": "^3.2.5",
"react": "^18",
"react-cookie": "^7.1.4",
"react-dom": "^18",
"react-router-dom": "^6.23.0",
"supports-color": "8.1.1"
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
Expand Down

0 comments on commit dc4cd79

Please sign in to comment.