Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buyankhuu/quick fix #83

Merged
merged 4 commits into from
Apr 15, 2024
Merged
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
7 changes: 7 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
const nextConfig = {}

module.exports = nextConfig

module.exports = {
compiler: {
// Enables the styled-components SWC transform
styledComponents: true
}
}
28 changes: 20 additions & 8 deletions src/app/[productId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use client';

import { useEffect, useState } from 'react';
import { convertButtonNumberToCategory } from '@/api/supabase/queries/button_queries';
import { Body1, Heading1, Body2Light } from '@/styles/fonts';
import { fetchProductByID } from '../../api/supabase/queries/product_queries';
import BackButton from '../../components/BackButton/BackButton';
import 'react-toastify/dist/ReactToastify.css';
Expand Down Expand Up @@ -28,6 +30,9 @@ export default function ItemDisplay({
async function fetchProducts() {
try {
const response = await fetchProductByID(params.productId);
response.category = await convertButtonNumberToCategory(
response.category,
);
if (response) {
setItem(response);
}
Expand All @@ -48,24 +53,31 @@ export default function ItemDisplay({
limit={1}
hideProgressBar
/>
<BackButton destination="./storefront" />
<div style={{ marginLeft: '250px', marginTop: '50px' }}>
<BackButton destination="./storefront" />
</div>

<DescriptionContainer>
<ImageContainer>
<img
src={Item?.photo}
alt={Item?.name}
style={{ width: '350px', height: '350px' }}
style={{ width: '400px', height: '400px' }}
/>
</ImageContainer>
<TextContainer>
<h1>{Item?.name}</h1>
<h4 style={{ fontWeight: 'normal', paddingTop: '5px' }}>
<Heading1>{Item?.name}</Heading1>
<Body1 style={{ fontWeight: 'normal', paddingTop: '5px' }}>
{Item?.category}
</h4>
</Body1>
<Buttons productNumber={params.productId} />
<p style={{ paddingTop: '50px' }}>Product ID: {Item?.id}</p>
<p style={{ paddingTop: '20px' }}>Product Details:</p>
<p>{Item?.description}</p>
<Body2Light style={{ paddingTop: '50px' }}>
Product ID: {Item?.id}
</Body2Light>
<Body2Light style={{ paddingTop: '20px' }}>
Product Details:
</Body2Light>
<Body2Light>{Item?.description}</Body2Light>
</TextContainer>
</DescriptionContainer>
</Fullscreen>
Expand Down
15 changes: 10 additions & 5 deletions src/app/[productId]/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,29 @@ export const BackButton = styled.button`

export const DescriptionContainer = styled.div`
display: flex;
margin: 50px;
margin-left: 50px;
margin-right: 50px;
width: 1440px;
height: 400px;
`;

export const ImageContainer = styled.div`
margin: 50px;
width: 350px;
height: 350 px;
width: 500px;
height: 500px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-left: 200px;
margin-right: 200px;
background-color: ${COLORS.lightGrey};
`;

export const TextContainer = styled.div`
margin-left: 70px;
width: 440px;
height: 350px;
margin-top: 50px;
`;

export const ButtonsWrapper = styled.div`
Expand Down Expand Up @@ -83,7 +88,7 @@ export const AddToCartButton = styled.button`
export const ToastPopUP = styled(ToastContainer)`
position: fixed;
z-index: 100;
transform: translatey(130px);
transform: translatey(90px);
`;

export const Fullscreen = styled.div`
Expand Down
64 changes: 32 additions & 32 deletions src/app/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,39 @@ export default function OrderPage() {
};

return (
<div>
<PageDiv>
<NavBar />

<PageDiv>
<div style={{ marginTop: '30px', marginLeft: '50px' }}>
<BackButton destination="./storefront" />
<ContentDiv>
<LeftColumnDiv>
<Heading1>Cart</Heading1>
<CartItemsDiv>
{cart.map(cartItem => (
<CartItem
key={cartItem.id}
cartItemProduct={cartItem}
setCart={setCart}
cart={cart}
setNumberOfItems={setNumberOfItems}
numberOfItems={numberOfItems}
/>
))}
</CartItemsDiv>
</LeftColumnDiv>
<RightColumnDiv>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<CheckoutButton
// change this function so that the flow makes sense and that there is items within the cart
onClick={() => checkDelivery()}
disabled={numberOfItems === 0}
>
Check Out
</CheckoutButton>
</RightColumnDiv>
</ContentDiv>
</PageDiv>
</div>
</div>

<ContentDiv>
<LeftColumnDiv>
<Heading1>Cart</Heading1>
<CartItemsDiv>
{cart.map(cartItem => (
<CartItem
key={cartItem.id}
cartItemProduct={cartItem}
setCart={setCart}
cart={cart}
setNumberOfItems={setNumberOfItems}
numberOfItems={numberOfItems}
/>
))}
</CartItemsDiv>
</LeftColumnDiv>
<RightColumnDiv>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<CheckoutButton
// change this function so that the flow makes sense and that there is items within the cart
onClick={() => checkDelivery()}
disabled={numberOfItems === 0}
>
Check Out
</CheckoutButton>
</RightColumnDiv>
</ContentDiv>
</PageDiv>
);
}
13 changes: 9 additions & 4 deletions src/app/cart/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const CartItemsDiv = styled.div`
width: 750px;
overflow: auto;
gap: 32px;
margin-top: 20px;
`;

export const ImageDiv = styled.div`
Expand Down Expand Up @@ -130,7 +131,9 @@ export const ContentDiv = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 32px;
gap: 100px;
padding-left: 50px;
background-color: ${COLORS.offWhite};
`;

export const BackButtonDiv1 = styled.div`
Expand Down Expand Up @@ -242,17 +245,18 @@ export const PShiftLeft = styled.p`
`;

export const PageDiv = styled.div`
height: 100%;
height: auto;
width: 100%;
display: flex;
flex-direction: column;
padding: 32px;
gap: 32px;

background-color: ${COLORS.offWhite};
`;

export const LeftColumnDiv = styled.div`
flex: 1;
padding-right: 20px;
margin-top: 20px;
`;

export const InformationText = styled.div`
Expand Down Expand Up @@ -334,6 +338,7 @@ export const OrderContainer = styled.div`

export const RightColumnDiv = styled.div`
flex: 1;
margin-top: 30px;
padding-left: 20px;
`;

Expand Down
2 changes: 1 addition & 1 deletion src/app/orderConfirmationDelivery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function OrderConfirmationDelivery() {
<ShippingDetailsDiv>
<Heading3Bold>Delivery Information</Heading3Bold>
<DetailsHeader>Estimated Date</DetailsHeader>
<Body1>date</Body1>
<Body1>{user?.delivery_group}</Body1>
<DetailsHeader>Location</DetailsHeader>
<Body1>
{userAddress?.street}, {userAddress?.city},{' '}
Expand Down
Loading