feat: add product catalog with URL-based category filtering
Build & Deploy (develop) / build-and-deploy (push) Successful in 1m48s
Build & Deploy (develop) / build-and-deploy (push) Successful in 1m48s
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import type {Locale} from '@/types/domain';
|
||||
|
||||
const fa = {
|
||||
allProducts: 'همه محصولات',
|
||||
featuredProducts: 'محصولات منتخب',
|
||||
productsDescription: 'دستگاه مناسب خود را انتخاب کنید و مشخصات آن را بررسی کنید.',
|
||||
category: 'دستهبندی محصولات',
|
||||
allCategories: 'همه دستهبندیها',
|
||||
clearFilters: 'پاک کردن فیلتر',
|
||||
noProducts: 'محصولی با این دستهبندی پیدا نشد.',
|
||||
unknownCategory: 'دستهبندی نامعتبر',
|
||||
results: 'محصول',
|
||||
details: 'جزئیات محصول',
|
||||
increase: 'افزایش تعداد',
|
||||
decrease: 'کاهش تعداد',
|
||||
@@ -27,6 +36,15 @@ const fa = {
|
||||
export const commerceCopy: Record<Locale, Record<keyof typeof fa, string>> = {
|
||||
fa,
|
||||
en: {
|
||||
allProducts: 'All products',
|
||||
featuredProducts: 'Featured products',
|
||||
productsDescription: 'Choose a machine and explore its specifications.',
|
||||
category: 'Product category',
|
||||
allCategories: 'All categories',
|
||||
clearFilters: 'Clear filter',
|
||||
noProducts: 'No products found in this category.',
|
||||
unknownCategory: 'Unknown category',
|
||||
results: 'products',
|
||||
details: 'Product details',
|
||||
increase: 'Increase quantity',
|
||||
decrease: 'Decrease quantity',
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {FloatingSnack, Locale, Machine, SiteContent} from '@/types/domain';
|
||||
const machinesFa: Machine[] = [
|
||||
{
|
||||
id: 'rm-35',
|
||||
category: 'warm-vending',
|
||||
name: 'روبات مارکت ۳۵ کانال',
|
||||
shortLabel: '۳۵ کانال',
|
||||
priceLabel: '4,180,000,000 ریال',
|
||||
@@ -21,6 +22,7 @@ const machinesFa: Machine[] = [
|
||||
},
|
||||
{
|
||||
id: 'rm-48',
|
||||
category: 'warm-vending',
|
||||
name: 'روبات مارکت ۴۸ کانال',
|
||||
shortLabel: '۴۸ کانال',
|
||||
priceLabel: '4,980,000,000 ریال',
|
||||
@@ -33,6 +35,7 @@ const machinesFa: Machine[] = [
|
||||
},
|
||||
{
|
||||
id: 'rm-60',
|
||||
category: 'warm-vending',
|
||||
name: 'روبات مارکت ۶۰ کانال',
|
||||
shortLabel: '۶۰ کانال',
|
||||
priceLabel: '5,480,000,000 ریال',
|
||||
@@ -48,6 +51,7 @@ const machinesFa: Machine[] = [
|
||||
const machinesEn: Machine[] = [
|
||||
{
|
||||
id: 'rm-35',
|
||||
category: 'warm-vending',
|
||||
name: 'Robot Market RM-35',
|
||||
shortLabel: '35 Channels',
|
||||
priceLabel: '4,180,000,000 Rials',
|
||||
@@ -60,6 +64,7 @@ const machinesEn: Machine[] = [
|
||||
},
|
||||
{
|
||||
id: 'rm-48',
|
||||
category: 'warm-vending',
|
||||
name: 'Robot Market RM-48',
|
||||
shortLabel: '48 Channels',
|
||||
priceLabel: '4,980,000,000 Rials',
|
||||
@@ -72,6 +77,7 @@ const machinesEn: Machine[] = [
|
||||
},
|
||||
{
|
||||
id: 'rm-60',
|
||||
category: 'warm-vending',
|
||||
name: 'Robot Market RM-60',
|
||||
shortLabel: '60 Channels',
|
||||
priceLabel: '5,480,000,000 Rials',
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import type {Locale, Machine, ProductCategory} from '@/types/domain';
|
||||
|
||||
export const productCategories: {id: ProductCategory; label: Record<Locale, string>}[] = [
|
||||
{id: 'warm-vending', label: {fa: 'وندینگ گرم', en: 'Warm vending'}},
|
||||
];
|
||||
|
||||
// Keep the home showcase independent of future catalog additions.
|
||||
const featuredIds = ['rm-35', 'rm-48', 'rm-60'];
|
||||
|
||||
export function featuredMachines(machines: Machine[]): Machine[] {
|
||||
return featuredIds.flatMap(id => machines.filter(machine => machine.id === id));
|
||||
}
|
||||
|
||||
export function filterMachines(machines: Machine[], category: string): Machine[] {
|
||||
return category ? machines.filter(machine => machine.category === category) : machines;
|
||||
}
|
||||
Reference in New Issue
Block a user