refactor: rename product to partyEvent in frontend components and views
This commit is contained in:
@@ -16,15 +16,15 @@ import { useCheckoutContext } from '../checkout/context';
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type Props = {
|
||||
product: IPartyEventItem;
|
||||
partyEvent: IPartyEventItem;
|
||||
detailsHref: string;
|
||||
};
|
||||
|
||||
export function ProductItem({ product, detailsHref }: Props) {
|
||||
export function ProductItem({ partyEvent, detailsHref }: Props) {
|
||||
const { onAddToCart } = useCheckoutContext();
|
||||
|
||||
const { id, name, coverUrl, price, colors, available, sizes, priceSale, newLabel, saleLabel } =
|
||||
product;
|
||||
partyEvent;
|
||||
|
||||
const handleAddCart = async () => {
|
||||
const newProduct = {
|
||||
|
@@ -10,18 +10,18 @@ import { ProductItemSkeleton } from './party-event-skeleton';
|
||||
|
||||
type Props = BoxProps & {
|
||||
loading?: boolean;
|
||||
products: IPartyEventItem[];
|
||||
partyEvents: IPartyEventItem[];
|
||||
};
|
||||
|
||||
export function PartyEventList({ products, loading, sx, ...other }: Props) {
|
||||
export function PartyEventList({ partyEvents, loading, sx, ...other }: Props) {
|
||||
const renderLoading = () => <ProductItemSkeleton />;
|
||||
|
||||
const renderList = () =>
|
||||
products.map((product) => (
|
||||
partyEvents.map((partyEvent) => (
|
||||
<ProductItem
|
||||
key={product.id}
|
||||
product={product}
|
||||
detailsHref={paths.product.details(product.id)}
|
||||
key={partyEvent.id}
|
||||
partyEvent={partyEvent}
|
||||
detailsHref={paths.partyEvent.details(partyEvent.id)}
|
||||
/>
|
||||
));
|
||||
|
||||
@@ -46,7 +46,7 @@ export function PartyEventList({ products, loading, sx, ...other }: Props) {
|
||||
{loading ? renderLoading() : renderList()}
|
||||
</Box>
|
||||
|
||||
{products.length > 8 && (
|
||||
{partyEvents.length > 8 && (
|
||||
<Pagination
|
||||
count={8}
|
||||
sx={{
|
||||
|
@@ -212,7 +212,7 @@ export function PartyEventNewEditForm({ currentPartyEvent }: Props) {
|
||||
createPartyEvent(sanitizedValues);
|
||||
}
|
||||
|
||||
toast.success(currentPartyEvent ? 'Update success!' : 'Create success!');
|
||||
toast.success(currentPartyEvent ? 'update-success!' : 'create-success!');
|
||||
|
||||
router.push(paths.dashboard.partyEvent.root);
|
||||
|
||||
|
@@ -9,11 +9,11 @@ export function PartyEventCreateView() {
|
||||
return (
|
||||
<DashboardContent>
|
||||
<CustomBreadcrumbs
|
||||
heading="Create a new product"
|
||||
heading="Create a new party event"
|
||||
links={[
|
||||
{ name: 'Dashboard', href: paths.dashboard.root },
|
||||
{ name: 'Product', href: paths.dashboard.product.root },
|
||||
{ name: 'New product' },
|
||||
{ name: 'Party Event', href: paths.dashboard.product.root },
|
||||
{ name: 'New party event' },
|
||||
]}
|
||||
sx={{ mb: { xs: 3, md: 5 } }}
|
||||
/>
|
||||
|
@@ -18,7 +18,7 @@ export function PartyEventEditView({ partyEvent }: Props) {
|
||||
backHref={paths.dashboard.partyEvent.root}
|
||||
links={[
|
||||
{ name: 'Dashboard', href: paths.dashboard.root },
|
||||
{ name: 'Product', href: paths.dashboard.partyEvent.root },
|
||||
{ name: 'Party Event', href: paths.dashboard.partyEvent.root },
|
||||
{ name: partyEvent?.name },
|
||||
]}
|
||||
sx={{ mb: { xs: 3, md: 5 } }}
|
||||
|
@@ -304,10 +304,10 @@ export function PartyEventListView() {
|
||||
<>
|
||||
<DashboardContent sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column' }}>
|
||||
<CustomBreadcrumbs
|
||||
heading={t('Product List')}
|
||||
heading={t('Party Event List')}
|
||||
links={[
|
||||
{ name: t('Dashboard'), href: paths.dashboard.root },
|
||||
{ name: t('Product'), href: paths.dashboard.partyEvent.root },
|
||||
{ name: t('Party Event'), href: paths.dashboard.partyEvent.root },
|
||||
{ name: t('List') },
|
||||
]}
|
||||
action={
|
||||
|
@@ -121,7 +121,7 @@ export function PartyEventShopView({ products, loading }: Props) {
|
||||
{notFound || isEmpty ? (
|
||||
renderNotFound()
|
||||
) : (
|
||||
<PartyEventList products={dataFiltered} loading={loading} />
|
||||
<PartyEventList partyEvents={dataFiltered} loading={loading} />
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
|
Reference in New Issue
Block a user