refactor: rename product to partyEvent in frontend components and views

This commit is contained in:
louiscklaw
2025-06-15 18:06:17 +08:00
parent 4c2a06585d
commit ae39b7ca67
7 changed files with 18 additions and 18 deletions

View File

@@ -16,15 +16,15 @@ import { useCheckoutContext } from '../checkout/context';
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
type Props = { type Props = {
product: IPartyEventItem; partyEvent: IPartyEventItem;
detailsHref: string; detailsHref: string;
}; };
export function ProductItem({ product, detailsHref }: Props) { export function ProductItem({ partyEvent, detailsHref }: Props) {
const { onAddToCart } = useCheckoutContext(); const { onAddToCart } = useCheckoutContext();
const { id, name, coverUrl, price, colors, available, sizes, priceSale, newLabel, saleLabel } = const { id, name, coverUrl, price, colors, available, sizes, priceSale, newLabel, saleLabel } =
product; partyEvent;
const handleAddCart = async () => { const handleAddCart = async () => {
const newProduct = { const newProduct = {

View File

@@ -10,18 +10,18 @@ import { ProductItemSkeleton } from './party-event-skeleton';
type Props = BoxProps & { type Props = BoxProps & {
loading?: boolean; 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 renderLoading = () => <ProductItemSkeleton />;
const renderList = () => const renderList = () =>
products.map((product) => ( partyEvents.map((partyEvent) => (
<ProductItem <ProductItem
key={product.id} key={partyEvent.id}
product={product} partyEvent={partyEvent}
detailsHref={paths.product.details(product.id)} detailsHref={paths.partyEvent.details(partyEvent.id)}
/> />
)); ));
@@ -46,7 +46,7 @@ export function PartyEventList({ products, loading, sx, ...other }: Props) {
{loading ? renderLoading() : renderList()} {loading ? renderLoading() : renderList()}
</Box> </Box>
{products.length > 8 && ( {partyEvents.length > 8 && (
<Pagination <Pagination
count={8} count={8}
sx={{ sx={{

View File

@@ -212,7 +212,7 @@ export function PartyEventNewEditForm({ currentPartyEvent }: Props) {
createPartyEvent(sanitizedValues); createPartyEvent(sanitizedValues);
} }
toast.success(currentPartyEvent ? 'Update success!' : 'Create success!'); toast.success(currentPartyEvent ? 'update-success!' : 'create-success!');
router.push(paths.dashboard.partyEvent.root); router.push(paths.dashboard.partyEvent.root);

View File

@@ -9,11 +9,11 @@ export function PartyEventCreateView() {
return ( return (
<DashboardContent> <DashboardContent>
<CustomBreadcrumbs <CustomBreadcrumbs
heading="Create a new product" heading="Create a new party event"
links={[ links={[
{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'Dashboard', href: paths.dashboard.root },
{ name: 'Product', href: paths.dashboard.product.root }, { name: 'Party Event', href: paths.dashboard.product.root },
{ name: 'New product' }, { name: 'New party event' },
]} ]}
sx={{ mb: { xs: 3, md: 5 } }} sx={{ mb: { xs: 3, md: 5 } }}
/> />

View File

@@ -18,7 +18,7 @@ export function PartyEventEditView({ partyEvent }: Props) {
backHref={paths.dashboard.partyEvent.root} backHref={paths.dashboard.partyEvent.root}
links={[ links={[
{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'Dashboard', href: paths.dashboard.root },
{ name: 'Product', href: paths.dashboard.partyEvent.root }, { name: 'Party Event', href: paths.dashboard.partyEvent.root },
{ name: partyEvent?.name }, { name: partyEvent?.name },
]} ]}
sx={{ mb: { xs: 3, md: 5 } }} sx={{ mb: { xs: 3, md: 5 } }}

View File

@@ -304,10 +304,10 @@ export function PartyEventListView() {
<> <>
<DashboardContent sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column' }}> <DashboardContent sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column' }}>
<CustomBreadcrumbs <CustomBreadcrumbs
heading={t('Product List')} heading={t('Party Event List')}
links={[ links={[
{ name: t('Dashboard'), href: paths.dashboard.root }, { 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') }, { name: t('List') },
]} ]}
action={ action={

View File

@@ -121,7 +121,7 @@ export function PartyEventShopView({ products, loading }: Props) {
{notFound || isEmpty ? ( {notFound || isEmpty ? (
renderNotFound() renderNotFound()
) : ( ) : (
<PartyEventList products={dataFiltered} loading={loading} /> <PartyEventList partyEvents={dataFiltered} loading={loading} />
)} )}
</Container> </Container>
); );