diff --git a/apps/storefront/src/components/B3LinkTipContent.tsx b/apps/storefront/src/components/B3LinkTipContent.tsx new file mode 100644 index 00000000..5d1f762c --- /dev/null +++ b/apps/storefront/src/components/B3LinkTipContent.tsx @@ -0,0 +1,38 @@ +import { + Link, + Box, +} from '@mui/material' + +interface B3SuccessTipContentProps{ + message: string, + link?: string, + linkText?: string, +} + +export const B3LinkTipContent = ({ + message, + link, + linkText = 'View', +}: B3SuccessTipContentProps) => ( + + + {message} + + {link && ( + + {linkText} + + )} + +) diff --git a/apps/storefront/src/components/index.ts b/apps/storefront/src/components/index.ts index b323e520..a2023c68 100644 --- a/apps/storefront/src/components/index.ts +++ b/apps/storefront/src/components/index.ts @@ -48,3 +48,7 @@ export { export { B3ProductList, } from './B3ProductList' + +export { + B3LinkTipContent, +} from './B3LinkTipContent' diff --git a/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx b/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx index 9268c77d..1f2c4907 100644 --- a/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx +++ b/apps/storefront/src/pages/orderDetail/components/OrderDialog.tsx @@ -8,7 +8,6 @@ import { import { Box, Typography, - } from '@mui/material' import { @@ -33,6 +32,7 @@ import { import { B3CustomForm, B3Dialog, + B3LinkTipContent, } from '@/components' import { @@ -141,11 +141,12 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ maxQuantity = 0, minQuantity = 0, stock = 0, + isStock = '0', } = variantInfo const quantity = product?.editQuantity || 1 - if (quantity > stock) { + if (isStock === '1' && quantity > stock) { product.helperText = `${stock} In Stock` isValid = false } else if (minQuantity !== 0 && quantity < minQuantity) { @@ -166,6 +167,14 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ return isValid } + const successTip = () => ( + + ) + const handleReorder = async () => { setIsRequestLoading(true) @@ -212,7 +221,9 @@ export const OrderDialog: (props: OrderDialogProps) => ReactElement = ({ snackbar.error(res.detail) } else { setOpen(false) - snackbar.success(`${items.length} products were added to cart`) + snackbar.success('', { + jsx: successTip, + }) } } finally { setIsRequestLoading(false) diff --git a/apps/storefront/src/pages/shoppingListDetails/components/ReAddToCart.tsx b/apps/storefront/src/pages/shoppingListDetails/components/ReAddToCart.tsx index 0a15d32b..b14ff162 100644 --- a/apps/storefront/src/pages/shoppingListDetails/components/ReAddToCart.tsx +++ b/apps/storefront/src/pages/shoppingListDetails/components/ReAddToCart.tsx @@ -197,12 +197,13 @@ export const ReAddToCart = (props: ShoppingProductsProps) => { minQuantity = 0, stock = 0, node, + isStock = '0', } = product const { quantity, } = node - if (quantity > stock) return `${stock} In Stock` + if (isStock === '1' && quantity > stock) return `${stock} In Stock` if (minQuantity !== 0 && quantity < minQuantity) return `minQuantity is ${minQuantity}` diff --git a/apps/storefront/src/pages/shoppingListDetails/shared/config.ts b/apps/storefront/src/pages/shoppingListDetails/shared/config.ts index eadde68b..7931c208 100644 --- a/apps/storefront/src/pages/shoppingListDetails/shared/config.ts +++ b/apps/storefront/src/pages/shoppingListDetails/shared/config.ts @@ -89,6 +89,7 @@ export interface ProductsProps { maxQuantity?: number, minQuantity?: number, stock?: number, + isStock?: string, node: NodeProps }