refactor(products): organize product showcase into feature module

This commit is contained in:
2026-09-29 09:44:00 +03:30
parent fcded6f139
commit ae6018a1f0
13 changed files with 68 additions and 45 deletions
+16
View File
@@ -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;
}