Add store-item bulk create, unlimited stock, and contact-for-price UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
5eaf7fb046
commit
ad83fc1099
@@ -1,5 +1,5 @@
|
||||
import { useId } from 'react'
|
||||
import { Pencil, Percent, Sparkles, Trash2 } from 'lucide-react'
|
||||
import { useEffect, useId, useState } from 'react'
|
||||
import { ImageOff, Pencil, Percent, Sparkles, Trash2 } from 'lucide-react'
|
||||
import { useLocale } from '@meshkee/dashboard-ui'
|
||||
import { useT } from '../i18n/useT'
|
||||
import {
|
||||
@@ -80,20 +80,30 @@ export function StoreItemCard({
|
||||
? listing.productTitle
|
||||
: ''
|
||||
: listing.productNameFa
|
||||
const imageSrc = listing.productImage?.trim() || ''
|
||||
const [imageFailed, setImageFailed] = useState(false)
|
||||
const showImage = Boolean(imageSrc) && !imageFailed
|
||||
|
||||
useEffect(() => {
|
||||
setImageFailed(false)
|
||||
}, [imageSrc])
|
||||
|
||||
return (
|
||||
<article className={styles.card}>
|
||||
<button type="button" className={styles.clickable} onClick={() => onOpen(listing)}>
|
||||
<div className={styles.imageWrap}>
|
||||
{listing.productImage ? (
|
||||
{showImage ? (
|
||||
<img
|
||||
src={listing.productImage}
|
||||
src={imageSrc}
|
||||
alt={primaryName}
|
||||
className={styles.image}
|
||||
loading="lazy"
|
||||
onError={() => setImageFailed(true)}
|
||||
/>
|
||||
) : (
|
||||
<div className={styles.imagePlaceholder} />
|
||||
<div className={styles.imagePlaceholder} aria-hidden="true">
|
||||
<ImageOff size={28} strokeWidth={1.5} />
|
||||
</div>
|
||||
)}
|
||||
{listing.showFestival && (
|
||||
<span className={styles.festivalBadge}>{t('storeItems.card.festival')}</span>
|
||||
|
||||
Reference in New Issue
Block a user