Skip to content

Commit

Permalink
buyankhuu's rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
BuyankhuuTsCAl committed Apr 22, 2024
1 parent e16534a commit 31dd383
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/app/cart/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export const OrderContainer = styled.div`
export const RightColumnDiv = styled.div`
flex: 1;
margin-top: 30px;
padding-left: 20px;
margin-bottom: 30px;
`;

export const Heading = styled.h1`
Expand Down Expand Up @@ -379,5 +379,5 @@ export const CategorySpacing = styled.div`
`;

export const OrderSumSectionSpacing = styled.div`
margin-left: 135px;
margin-left: 65px;
`;
17 changes: 1 addition & 16 deletions src/app/favorites/individualItem.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';

import { useRouter } from 'next/navigation';

import { Body1Bold, Body2, Body3 } from '@/styles/fonts';

import { convertButtonNumberToCategory } from '@/api/supabase/queries/button_queries';
import {
HeartIcon,
Hover,
Expand All @@ -27,20 +26,6 @@ export default function IndividualItem(props: {
const router = useRouter();
const [hovering, setHovering] = useState(false);

useEffect(() => {
async function changeCategory() {
try {
favorite.category = await convertButtonNumberToCategory(
favorite.category,
);
} catch (error) {
// console.error(error);
}
}

changeCategory();
}, [favorite]);

async function clickFunctions(props2: { fav: Product }) {
const { fav } = props2;
addOrRemoveProductFromFavorite(fav, false);
Expand Down
12 changes: 11 additions & 1 deletion src/app/favorites/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useState, useEffect } from 'react';
import { Heading1 } from '@/styles/fonts';
import { convertButtonNumberToCategory } from '@/api/supabase/queries/button_queries';
import BackButton from '../../components/BackButton/BackButton';

import { arrayOfFavorites } from '../../api/supabase/queries/user_queries';
Expand All @@ -18,7 +19,16 @@ export default function FavoritesPage() {

async function fetchProducts() {
const data = (await arrayOfFavorites()) as Product[];
setFavorites(data);
const mapCategories = await Promise.all(
data.map(async product => {
const updateCategory = await convertButtonNumberToCategory(
product.category,
);
return { ...product, category: updateCategory };
}),
);

setFavorites(mapCategories);
}
useEffect(() => {
fetchProducts();
Expand Down
7 changes: 0 additions & 7 deletions src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ export default function App() {
}
};

async function applyFilter(e: React.KeyboardEvent<HTMLButtonElement>) {
const keypressed = e.code;
if (keypressed === 'Enter') {
handleLogin();
}
}

return (
<Fullscreen>
<Image
Expand Down
6 changes: 1 addition & 5 deletions src/app/orderConfirmationPickUp/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import {
Body2Light,
} from '@/styles/fonts';
import { useSearchParams } from 'next/navigation';
import {
fetchCartItemsWithQuantity,
fetchCartItemsWithQuantityByID,
} from '../../api/supabase/queries/cart_queries';
import { fetchCartItemsWithQuantityByID } from '../../api/supabase/queries/cart_queries';

import BackButton from '../../components/BackButton/BackButton';

Expand All @@ -34,7 +31,6 @@ import {
RightColumnDiv,
DetailsHeader,
ImageDiv,
Wrapper2,
PageDiv,
CenterDiv,
BackButtonDiv,
Expand Down
13 changes: 1 addition & 12 deletions src/app/orderPage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import {
Body2Light,
Heading3Bold,
Heading4Bold,
Body2,
Heading2,
Body1Bold,
} from '@/styles/fonts';
import { fetchUser } from '@/api/supabase/queries/user_queries';

import { useSearchParams } from 'next/navigation';
import { fetchPickupTimesByID } from '@/api/supabase/queries/pickup_queries';
import BackButton from '../../components/BackButton/BackButton';
Expand All @@ -33,7 +32,6 @@ import {
BottomColumnDiv,
ShippingDetailsDiv,
LabelBox,
TextDiv2,
LeftColumnDiv,
ScrollDiv,
PageDiv,
Expand Down Expand Up @@ -69,15 +67,6 @@ function formatDate(date: string | undefined): string {
return `${month} ${day}, ${year}`;
}

function formatTime(date: string | undefined): string {
if (!date) return '';

const hour = date.substring(11, 13);
const minute = date.substring(14, 16);

return `${hour}:${minute}`;
}

export default function OrderPage() {
const [orders, setOrders] = useState<ProductWithQuantity[]>([]);
const [pickupTime, setPickupTime] = useState<Pickup>();
Expand Down
15 changes: 2 additions & 13 deletions src/app/orderPageDelivery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Body2Light,
Heading2Bold,
Heading3Bold,
Heading4Bold,
} from '@/styles/fonts';
import { useSearchParams } from 'next/navigation';
import {
Expand All @@ -25,8 +24,6 @@ import {
} from '@/api/supabase/queries/order_queries';
import BackButton from '../../components/BackButton/BackButton';

import { fetchCartItemsWithQuantityByID } from '../../api/supabase/queries/cart_queries';

import NavBar from '../../components/NavBarFolder/NavBar';

import {
Expand All @@ -45,15 +42,8 @@ import {
StatusButton,
} from './styles';

import {
Product,
User,
Address,
ProductWithQuantity,
Order,
} from '../../schema/schema';
import { User, Address, ProductWithQuantity, Order } from '../../schema/schema';
import { Body1Bold } from '../orderPage/styles';
import { BackButtonDiv } from '../orderConfirmationPickUp/styles';

export default function OrderPageDelivery() {
const [orders, setOrders] = useState<ProductWithQuantity[]>([]);
Expand Down Expand Up @@ -135,12 +125,11 @@ export default function OrderPageDelivery() {

function organizeOrderTime() {
const Time = order?.created_at.toLocaleString();
console.log(Time);

let ampm = 'AM';
const date =
Time == null ? ['00', '00'] : Time?.substring(11, 16).split(':');

console.log(date);
if (parseInt(date[0], 10) >= 12) {
date[0] = (parseInt(date[0], 10) - 12).toLocaleString();
ampm = 'PM';
Expand Down
3 changes: 1 addition & 2 deletions src/app/profileScreen/individualItem.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';

import { Body1Bold, Body2, Body3 } from '@/styles/fonts';

import { convertButtonNumberToCategory } from '@/api/supabase/queries/button_queries';
import { HeartIcon, Hover, FavoriteDiv, ProductNameDiv } from './styles';

import { addOrRemoveProductFromFavorite } from '../../api/supabase/queries/user_queries';
Expand Down
1 change: 0 additions & 1 deletion src/app/profileScreen/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
AccountDetailsDeliv,
AccountDetailsPickUp,
HeadingBack,
Spacing,
HeadingSpacing,
TextSpacing,
OrderHistory,
Expand Down
1 change: 1 addition & 0 deletions src/app/profileScreen/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const LogOutDiv = styled.div`
justify-content: center;
width: 500px;
height: 350px;
margin-top: 40px;
`;

export const MessageDiv = styled.div`
Expand Down

0 comments on commit 31dd383

Please sign in to comment.