Refactor ProductItemProps type definition

Moved `ProductItemProps` from `product-item.tsx` to `product-service.ts` for centralized access. Updated `product-item.tsx` to import the type from the new location. Adjusted imports in `products-view.tsx` to streamline dependencies and reduce redundancy. This improves code organization and maintains a single source of truth for the `ProductItemProps` type.
This commit is contained in:
tekh 2025-07-02 15:45:44 +02:00
parent a155c991c6
commit b7c5734a1b
3 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,12 @@
import { ProductItemProps } from "src/sections/product/product-item";
export type ProductItemProps = {
id: string;
name: string;
price: number;
status: string;
coverUrl: string;
colors: string[];
priceSale: number | null;
};
/**
* send a request to the server to get the products

View File

@ -8,21 +8,13 @@ import Typography from '@mui/material/Typography';
import { fCurrency } from 'src/utils/format-number';
import { ProductItemProps } from 'src/api/product-service';
import { Label } from 'src/components/label';
import { ColorPreview } from 'src/components/color-utils';
// ----------------------------------------------------------------------
export type ProductItemProps = {
id: string;
name: string;
price: number;
status: string;
coverUrl: string;
colors: string[];
priceSale: number | null;
};
export function ProductItem({ product }: { product: ProductItemProps }) {
const renderStatus = (
<Label

View File

@ -6,13 +6,13 @@ import Pagination from '@mui/material/Pagination';
import Typography from '@mui/material/Typography';
import { _products } from 'src/_mock';
import { getProducts } from 'src/api/product-service';
import { DashboardContent } from 'src/layouts/dashboard';
import { getProducts, ProductItemProps } from 'src/api/product-service';
import { ProductSort } from '../product-sort';
import { ProductItem } from '../product-item';
import { CartIcon } from '../product-cart-widget';
import { ProductFilters } from '../product-filters';
import { ProductItem, ProductItemProps } from '../product-item';
import type { FiltersProps } from '../product-filters';