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/final hack #91

Merged
merged 6 commits into from
Apr 21, 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
13 changes: 10 additions & 3 deletions src/api/supabase/queries/user_queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import { convertButtonNumberToCategory } from './button_queries';
*/
export async function fetchUser(): Promise<User> {
const {
data: { user },
data: { session },
error,
} = await supabase.auth.getUser();
} = await supabase.auth.getSession();

if (error) {
throw new Error(`Error fetching user: ${error.message}`);
throw new Error(`Error fetching session: ${error.message}`);
}

if (!session) {
throw new Error(`Session is null`);
}

const { user } = session;

if (user !== null) {
const { data, error: error1 } = await supabase
.from('profiles')
Expand Down
2 changes: 1 addition & 1 deletion src/app/[productId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function ItemDisplay({
<img
src={Item?.photo}
alt={Item?.name}
style={{ width: '400px', height: '400px' }}
style={{ width: '400px', height: '400px', objectFit: 'cover' }}
/>
</ImageContainer>
<TextContainer>
Expand Down
3 changes: 3 additions & 0 deletions src/app/favorites/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const BackDiv = styled.button`
export const OutterBox = styled.div`
width: 800px;
height: 100%;

margin-top: 50px;
margin-bottom: 50px;
`;

export const Backtext = styled.p`
Expand Down
4 changes: 3 additions & 1 deletion src/app/orderHistory/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ function OrderHistory() {
<NavBarMovedUP />
<OutterBox>
<BackButton destination="./profileScreen" />
<Heading1>Order History</Heading1>
<div style={{ marginTop: '40px', marginBottom: '20px' }}>
<Heading1>Order History</Heading1>
</div>
<OrderHistoryContainer>
{orderIds.length > 0 ? (
orderIds.map((orderId: number) => (
Expand Down
17 changes: 11 additions & 6 deletions src/app/orderHistory/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// styles.ts (for styled-components)
import styled from 'styled-components';
import COLORS from '@/styles/colors';
import NavBar from '../../components/NavBarFolder/NavBar';

import Footer from '../../components/FooterFolder/Footer';
Expand All @@ -13,22 +14,22 @@ export const NavBarMovedUP = styled(NavBar)`
`;

export const OutterBox = styled.div`
width: 900px;
margin: 0 auto; // This will center the OutterBox
width: 800px;
margin-top: 40px;
margin-bottom: 70px;
`;

export const OrderHistoryContainer = styled.div`
display: flex;
flex-direction: column;
align-items: center;
border-radius: 10px;
background: var(--White, #fff);
background: ${COLORS.white};
box-shadow: 0px 1px 4px 1px rgba(0, 0, 0, 0.2);
width: 800px; // Width of the outer box
height: 700px;
overflow: scroll;
height: auto;
margin-top: 10px;
padding: 0; // Ensure there's no padding pushing the internal boxes inward
padding-top: 40px;
`;

export const OrderHistoryBox = styled.div`
Expand All @@ -46,4 +47,8 @@ export const OrderHistoryBox = styled.div`
export const Fullscreen = styled.div`
width: 100%;
height: 100%;
display: flex;
align-items: center;
flex-direction: column;
background-color: ${COLORS.offWhite};
`;
20 changes: 11 additions & 9 deletions src/app/profileScreen/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
fetchOrderProductById,
fetchProductWithQuantityById,
} from '@/api/supabase/queries/order_queries';
import { Check, CheckCircle, X } from 'react-feather';
import { Check, CheckCircle, X, Send } from 'react-feather';
import BackButton from '../../components/BackButton/BackButton';
import {
LogOutButton,
Expand Down Expand Up @@ -170,15 +170,15 @@ function OrderHistorySection(props: { Orders: Order[] }) {
if (firstOrderProducts.length > 0) {
let backgroundColor = 'transparent';
if (Orders[0].order_status === 'Submitted') {
backgroundColor = '#CEE8BE';
backgroundColor = 'var(--Greyish, #E6E6E6)';
} else if (Orders[0].order_status === 'Rejected') {
backgroundColor = '#FFDDDD';
} else if (Orders[0].order_status === 'Confirmed') {
backgroundColor = '#C7DDFF';
}
let icon;
if (Orders[0].order_status === 'Submitted') {
icon = <CheckCircle />;
icon = <Send />;
} else if (Orders[0].order_status === 'Rejected') {
icon = <X />;
} else if (Orders[0].order_status === 'Confirmed') {
Expand Down Expand Up @@ -329,12 +329,7 @@ function AccountDetailSectionPickUp(props: { user: User }) {
<main>
<AccountDetails>
<Heading2>Account Details</Heading2>
<HeadingSpacing>
<Body1Bold>Email</Body1Bold>
</HeadingSpacing>
<TextSpacing>
<Body2>{user?.email}</Body2>
</TextSpacing>

<HeadingSpacing>
<Body1Bold>Name</Body1Bold>
</HeadingSpacing>
Expand All @@ -343,6 +338,13 @@ function AccountDetailSectionPickUp(props: { user: User }) {
{user?.first_name} {user?.last_name}
</Body2>
</TextSpacing>
<HeadingSpacing>
<Body1Bold>Email</Body1Bold>
</HeadingSpacing>
<TextSpacing>
<Body2>{user?.email}</Body2>
</TextSpacing>

<HeadingSpacing>
<Body1Bold>Phone Number</Body1Bold>
</HeadingSpacing>
Expand Down
5 changes: 3 additions & 2 deletions src/app/profileScreen/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const LogOutButton = styled.button`
border: transparent;
border-radius: 5px;
width: 405px;
height: 70px;
height: 50px;
`;
/* transform: translateY(200px); */

Expand Down Expand Up @@ -112,7 +112,8 @@ export const HeartIcon = styled(Heart)`
`;

export const BackButtonDiv = styled.div`
margin-bottom: 40px;
margin-bottom: 30px;
margin-top: 50px;
`;

export const HeaderDiv = styled.div`
Expand Down
4 changes: 2 additions & 2 deletions src/components/BackButton/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Body1 } from '@/styles/fonts';
import { Body1Bold } from '@/styles/fonts';
import { BackLink, ArrowLeftIcon } from './styles';

export default function BackButton(props: { destination: string }) {
const { destination } = props;
return (
<BackLink href={destination}>
<ArrowLeftIcon />
<Body1>Back</Body1>
<Body1Bold>Back</Body1Bold>
</BackLink>
);
}
6 changes: 3 additions & 3 deletions src/components/BackButton/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export const BackLink = styled(Link)`
justify-content: space-between;
color: ${COLORS.black};
width: 75px;
gap: 5px;

&:hover {
text-decoration: underline;
}
`;

export const ArrowLeftIcon = styled(ArrowLeft)`
width: 24px;
height: 24px;
width: 20px;
height: 20px;
`;
4 changes: 2 additions & 2 deletions src/components/OrderHistory/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ export const GalleryImage = styled.img`

export const RowDiv = styled.div`
width: 700px;
height: 400px;
margin-bottom: 50px;
height: 300px;
margin-bottom: 20px;
`;

export const OrderStatusDiv = styled.div`
Expand Down
Loading