Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5546a5e
fix: empty cart message
IlinJoy Jun 16, 2025
0d9132c
fix: empty contact info text
IlinJoy Jun 16, 2025
dc3b109
feat: add confirm reset cart dialog
IlinJoy Jun 16, 2025
2bd50ce
feat: add styles for promo bar
IlinJoy Jun 16, 2025
80cbd07
fix: remove unused code
IlinJoy Jun 16, 2025
206a52a
feat: add buttons on product page (#109)
OlgaIndykova Jun 16, 2025
7edbebb
fix: refetching data
IlinJoy Jun 18, 2025
5692395
feat: update about us design
IlinJoy Jun 21, 2025
2a3367e
feat: add footer
IlinJoy Jun 21, 2025
cc441e0
refactor: form pages
IlinJoy Jun 22, 2025
6258640
fix: not-found-page styles
IlinJoy Jun 22, 2025
89b098b
refactor: remame camel case files
IlinJoy Jun 22, 2025
b528805
Merge branch 'develop' of https://github.com/IlinJoy/e-commerce-appli…
IlinJoy Jun 22, 2025
ca1ca3f
refactor: update tests
IlinJoy Jun 22, 2025
41fae20
refactor: pagination styles
IlinJoy Jun 22, 2025
1045b8e
feat: add gh links to the footer
IlinJoy Jun 22, 2025
01c0ff0
feat: add follow us block
IlinJoy Jun 22, 2025
be00f33
feat: add error boundary
IlinJoy Jun 22, 2025
5d1f71c
fix: footer links
IlinJoy Jun 22, 2025
147fec8
refactor: cookie config
IlinJoy Jun 22, 2025
a97472f
refactor: cookie config
IlinJoy Jun 22, 2025
79d492c
feat: add severity choosing for toasts
IlinJoy Jun 22, 2025
39bd901
fix: add key to footer links
IlinJoy Jun 22, 2025
affdf96
fix: cart handling during registration
IlinJoy Jun 22, 2025
c2cc711
fix: background for forms styles
IlinJoy Jun 22, 2025
0b53606
style: remove console.log
IlinJoy Jun 22, 2025
b060125
fix: styles for pagination and product page
IlinJoy Jun 22, 2025
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
43 changes: 28 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"clsx": "^2.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-error-boundary": "^6.0.0",
"react-hook-form": "^7.56.2",
"react-router": "^7.1.1",
"yet-another-react-lightbox": "^3.23.2",
Expand Down
Binary file added public/images/follow-us-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/follow-us-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/follow-us-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/follow-us-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/follow-us-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/follow-us-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/mariya.jpg
Binary file not shown.
Binary file added public/images/mariya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/olya.jpg
Binary file not shown.
Binary file added public/images/olya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/yana.jpg
Binary file not shown.
Binary file added public/images/yana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 12 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CustomerProvider } from './context/provider/customer-provider';
import { ToastContextProvider } from './context/toast-provider';
import { useEffect } from 'react';
import { useLocation } from 'react-router';
import { ErrorBoundary } from 'react-error-boundary';

const queryClient = new QueryClient({
queryCache: new QueryCache({
Expand All @@ -29,14 +30,16 @@ export function App() {
}, [pathname]);

return (
<ToastContextProvider>
<QueryClientProvider client={queryClient}>
<CustomerProvider>
<ThemeAppProvider theme={responseTheme}>
<AppRouter />
</ThemeAppProvider>
</CustomerProvider>
</QueryClientProvider>
</ToastContextProvider>
<ErrorBoundary fallback={<p>⚠️Something went wrong</p>}>
<ToastContextProvider>
<QueryClientProvider client={queryClient}>
<CustomerProvider>
<ThemeAppProvider theme={responseTheme}>
<AppRouter />
</ThemeAppProvider>
</CustomerProvider>
</QueryClientProvider>
</ToastContextProvider>
</ErrorBoundary>
);
}
File renamed without changes.
2 changes: 1 addition & 1 deletion src/api/cart.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getRequestToken } from '@/utils/request-token-handler';
import { fetchFromApi } from './platformApi';
import { fetchFromApi } from './platform-api';
import type { Cart, CartUpdateAction } from '@commercetools/platform-sdk';

export const getCartWithoutToken = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/api/catalog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchFromApi } from '@/api/platformApi';
import { fetchFromApi } from '@/api/platform-api';
import { getRequestToken } from '@/utils/request-token-handler';
import type {
Category,
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/api/clientAuth.test.ts → src/api/client-auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { loginCustomer } from './clientAuth';
import { fetchFromApi, getCustomerToken } from '@/api/platformApi';
import { loginCustomer } from './client-auth';
import { fetchFromApi, getCustomerToken } from '@/api/platform-api';
import { getRequestToken } from '@/utils/request-token-handler';

vi.mock('@/api/platformApi', () => ({
vi.mock('@/api/platform-api', () => ({
fetchFromApi: vi.fn(),
getCustomerToken: vi.fn(),
}));
Expand All @@ -11,7 +11,7 @@ vi.mock('@/utils/request-token-handler', () => ({
getRequestToken: vi.fn(),
}));

vi.mock('@/utils/mapApiErrorToMessage', () => ({
vi.mock('@/utils/map-api-error-to-message', () => ({
mapApiErrorToMessage: vi.fn(),
}));

Expand Down
4 changes: 2 additions & 2 deletions src/api/clientAuth.ts → src/api/client-auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address, CustomerDraft, CustomerSignInResult } from '@commercetools/platform-sdk';
import type { ErrorResponse } from '@commercetools/platform-sdk';
import { getCustomerToken, fetchFromApi } from '@/api/platformApi';
import { mapApiErrorToMessage } from '@/utils/mapApiErrorToMessage';
import { getCustomerToken, fetchFromApi } from '@/api/platform-api';
import { mapApiErrorToMessage } from '@/utils/map-api-error-to-message';
import { getRequestToken } from '@/utils/request-token-handler';

export type RegisterCustomerOptions = {
Expand Down
File renamed without changes.
8 changes: 1 addition & 7 deletions src/api/promo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { getRequestToken } from '@/utils/request-token-handler';
import { fetchFromApi } from './platformApi';
import { fetchFromApi } from './platform-api';
import type {
CartDiscountPagedQueryResponse,
CartUpdateAction,
DiscountCode,
DiscountCodePagedQueryResponse,
} from '@commercetools/platform-sdk';
import { updateCart } from './cart';
Expand All @@ -15,11 +14,6 @@ export const getCardDiscounts = async () => {
return result.results;
};

export const getDiscountCodeByKey = async (key: string) => {
const token = await getRequestToken();
return await fetchFromApi<DiscountCode>(`/discount-codes/key=${key}`, token);
};

export const getDiscountCodes = async () => {
const token = await getRequestToken();
const result = await fetchFromApi<DiscountCodePagedQueryResponse>(`/discount-codes`, token);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/api/update-customer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Customer, MyCustomerUpdateAction } from '@commercetools/platform-sdk';
import { fetchFromApi } from './platformApi';
import { fetchFromApi } from './platform-api';

export const updateCustomer = async (token: string, body: { version: number; actions: MyCustomerUpdateAction[] }) => {
return await fetchFromApi<Customer>('/me', token, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function AddressBlockForm({
queryClient.setQueryData(['customer', token], data);
},
onError: (err) => {
showToast({ message: err.message, isError: true });
showToast({ message: err.message, severity: 'error' });
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function AddressList({ addresses, type, defaultAddressId, handleUpdateAdd
showToast({ message: SUCCESS_MESSAGES.DELETE_ADDRESS });
},
onError: (err) => {
showToast({ message: err.message, isError: true });
showToast({ message: err.message, severity: 'error' });
},
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/cart-card/cart-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import styles from './cart-card.module.scss';
import { useNavigate } from 'react-router';
import { ROUTES } from '@/router/routes';
import { useMutation } from '@tanstack/react-query';
import { removeProductFromCart } from '@/api/removeProductFromCart';
import { removeProductFromCart } from '@/api/remove-product-from-cart';
import { useCart } from '@/context/cart-context';
import { useToast } from '@/context/toast-provider';
import { SUCCESS_MESSAGES } from '@/utils/constants/messages';
Expand Down Expand Up @@ -38,7 +38,7 @@ export function CartRow({ product }: CartRowProps) {
showToast({ message: SUCCESS_MESSAGES.REMOVE_PRODUCT });
},
onError: (err) => {
showToast({ message: err.message, isError: true });
showToast({ message: err.message, severity: 'error' });
},
});

Expand Down
50 changes: 50 additions & 0 deletions src/components/footer/footer.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@use '../../styles/mixins' as *;

.footer {
position: sticky;
bottom: 0;

margin-top: -20px;
padding: var(--spacing-10) var(--spacing-4);

background: linear-gradient(to bottom, var(--mui-palette-grey-900), var(--mui-palette-background-default));
}

.footer-content {
text-align: center;

@include flex(column, var(--spacing-4), $justify: center);

& h3 {
margin-bottom: var(--spacing-2);
}
}

.link-wrapper {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-1) var(--spacing-3);
justify-content: center;

& a {
font-size: 0.9rem;
color: var(--mui-palette-primary-main);
text-decoration: none;

@include transition;

&:hover {
opacity: 0.7;
}
}
}

.link {
display: inline-flex;
align-items: center;

& svg {
width: 0.8em;
margin-right: var(--spacing-1);
}
}
32 changes: 32 additions & 0 deletions src/components/footer/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Typography from '@mui/material/Typography';
import { teamMembers } from '@/utils/constants/ui';
import GitHubIcon from '@mui/icons-material/GitHub';
import styles from './footer.module.scss';

export function Footer() {
return (
<footer className={styles.footer}>
<div className={styles.footerContent}>
<div>
<Typography variant="h5" component="h3">
Contact Us
</Typography>

<div className={styles.linkWrapper}>
{teamMembers.map((member) => (
<Typography key={member.name} component="a" href={member.github} className={styles.link} target="_blank">
<GitHubIcon />
{member.name}
</Typography>
))}
</div>
</div>

<div>
<Typography>Non-commercial project built for educational purposes.</Typography>
<Typography>2025 Frontend First</Typography>
</div>
</div>
</footer>
);
}
35 changes: 35 additions & 0 deletions src/components/form-wrapper/form-wrapper.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@use '../../styles/mixins' as *;

.page {
width: 100%;
padding: var(--spacing-5) var(--spacing-1) var(--spacing-10);
}

.background {
position: absolute;
z-index: -1;
inset: 0;

width: 110%;
border-radius: 0 0 var(--border-radius-3) var(--border-radius-3);

background-image: url('/images/login-bg.webp');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: left;
background-size: cover;
}

.form-wrapper {
width: 100%;
max-width: 500px;
margin: auto;
padding: var(--spacing-7);
border-radius: var(--spacing-1);

background-color: var(--pallet-color-dark);

& h6 {
text-align: center;
}
}
15 changes: 15 additions & 0 deletions src/components/form-wrapper/form-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { ReactNode } from 'react';
import styles from './form-wrapper.module.scss';

type FormWrapperProps = {
children: ReactNode;
};

export function FormWrapper({ children }: FormWrapperProps) {
return (
<div className={styles.page}>
<div className={styles.formWrapper}>{children}</div>
<div className={styles.background}></div>
</div>
);
}
Loading