Improve website settings and special-item pick UX.
Tighten sitemap/settings controls, debounce product search to 10 results, keep catalog-only specials visible after add, and use frosted glass on link/category modals. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
a39aef0c8c
commit
77080a7a4b
@@ -36,12 +36,64 @@ function specialStoreItemToVariants(item: StoreSpecialStoreItem): StoreItem[] {
|
||||
}))
|
||||
}
|
||||
|
||||
export function specialItemsToListings(items: StoreSpecialStoreItem[]): SpecialProductListing[] {
|
||||
const variants = items.flatMap(specialStoreItemToVariants)
|
||||
const listings = groupStoreItemsByProduct(variants)
|
||||
/** Catalog-only specials (product source) may have a store item row with no variants yet. */
|
||||
function listingFromStoreItemWithoutVariants(
|
||||
item: StoreSpecialStoreItem,
|
||||
): SpecialProductListing {
|
||||
const representative: StoreItem = {
|
||||
id: item.id,
|
||||
storeItemId: item.id,
|
||||
productId: item.productId,
|
||||
productTitle: item.productTitle,
|
||||
productNameFa: item.productNameFa,
|
||||
productImage: item.productImage,
|
||||
productTotalStock: 0,
|
||||
selections: [],
|
||||
label: item.productTitle,
|
||||
price: null,
|
||||
discountedPrice: null,
|
||||
stockQuantity: null,
|
||||
rewardPoints: null,
|
||||
isFestival: false,
|
||||
sortOrder: item.sortOrder,
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
}
|
||||
|
||||
return listings.map((listing) => ({
|
||||
...listing,
|
||||
storeItemId: listing.representative.storeItemId ?? listing.representative.id,
|
||||
}))
|
||||
return {
|
||||
productId: item.productId,
|
||||
productTitle: item.productTitle,
|
||||
productNameFa: item.productNameFa,
|
||||
productImage: item.productImage,
|
||||
productTotalStock: 0,
|
||||
variantCount: 0,
|
||||
variants: [],
|
||||
representative,
|
||||
displayPrice: null,
|
||||
displayDiscountedPrice: null,
|
||||
showFestival: false,
|
||||
storeItemId: item.id,
|
||||
}
|
||||
}
|
||||
|
||||
export function specialItemsToListings(items: StoreSpecialStoreItem[]): SpecialProductListing[] {
|
||||
const listings: SpecialProductListing[] = []
|
||||
|
||||
for (const item of items) {
|
||||
const variants = specialStoreItemToVariants(item)
|
||||
if (variants.length === 0) {
|
||||
listings.push(listingFromStoreItemWithoutVariants(item))
|
||||
continue
|
||||
}
|
||||
|
||||
const grouped = groupStoreItemsByProduct(variants)
|
||||
for (const listing of grouped) {
|
||||
listings.push({
|
||||
...listing,
|
||||
storeItemId: listing.representative.storeItemId ?? item.id,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return listings
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user