-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/catalog enhancements #78
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
Conversation
…toification for adding product by snacknotification, add LS for anonID, improve logic for logout and login
| setNotification({ | ||
| severity: 'info', | ||
| open: true, | ||
| message: 'Adding game to cart...', | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эта часть кода повторяется три раза + она переиспользуемая в других файлах. Можно создать или вспомогательную функцию с параметрами:
const showNotification = (severity: 'success' | 'error' | 'info', message: string) => { setNotification({ severity, open: true, message, }); };
А затем использовать так:
showNotification('info', 'Adding game to cart...');
showNotification('success', 'The game added to cart');
showNotification('error', Failed to add game: ${err.message});
Ещё один вариант — использовать хук. Я взяла твою реализацию за основу и сделала удобный хук useNotification. С ним код получается компактнее. Плюс его можно переиспользовать.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Спасибо, хорошая идея, доделала:)
| <Button | ||
| size="small" | ||
| variant="outlined" | ||
| onClick={onCartClick} | ||
| color="secondary" | ||
| sx={{ | ||
| backgroundColor: theme.palette.primary.main, | ||
| color: theme.palette.primary.contrastText, | ||
| border: 'none', | ||
| transition: | ||
| 'transform 0.2s ease, background-color 0.2s ease, color 0.2s ease', | ||
| '&:hover': { | ||
| backgroundColor: theme.palette.primary.dark, | ||
| color: theme.palette.getContrastText( | ||
| theme.palette.primary.main | ||
| ), | ||
| transform: 'scale(1.05)', | ||
| }, | ||
| }} | ||
| > | ||
| <AddShoppingCartIcon /> add to cart | ||
| </Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Обе кнопки ("View details" и "Add in Cart") очень похожи — различие только в цвете фона. Такие компоненты лучше делать универсальными и переиспользуемыми.
Чтобы избежать дублирования, я создала в своей ветке компонент ActionButton. Кнопке можно передавать состояния, стили и т.д.
Думаю, использовать один компонент — это удобно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Изменила и перезалила с общим компонентом!
| import { getApiRoot } from '@/shared/api/commerceTools'; | ||
| import type { Cart } from '@commercetools/platform-sdk'; | ||
|
|
||
| export const addLineItem = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
отлично
| import { Alert, IconButton, Snackbar } from '@mui/material'; | ||
| import CloseIcon from '@mui/icons-material/Close'; | ||
|
|
||
| export const SnackNotification = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Супер)
Task:
Screenshot:

Deploy
Done 13.06.2025 / deadline 17.06.2025
Tasks:
✅ Acceptance Criteria
If the product is already in the shopping cart, the "Add to Cart" button is inactive or provides a relevant notice.
✅ Acceptance Criteria
🔒 Authentication Flows:
🔨 Implementation Details
🔨 Implementation Details
🎨 Visual Implementation Ideas