feat: KitchenStock light UI, Gemma 31B AI, supermarket store filters & 130+ vegan products
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
export const GRAM_SLIDER_STEPS = [50, 100, 250, 500, 1000];
|
||||
|
||||
export function isGramUnit(packageUnit: string): boolean {
|
||||
const u = (packageUnit || '').toLowerCase().trim();
|
||||
return u === 'gramm' || u === 'g';
|
||||
}
|
||||
|
||||
export function getProductStepSize(
|
||||
packageUnit: string,
|
||||
categoryName?: string | null,
|
||||
productName?: string | null
|
||||
): { step: number; label: string } {
|
||||
const unit = (packageUnit || '').toLowerCase().trim();
|
||||
const name = (productName || '').toLowerCase().trim();
|
||||
const cat = (categoryName || '').toLowerCase().trim();
|
||||
|
||||
if (unit === 'gramm' || unit === 'g') {
|
||||
const isSpice =
|
||||
cat.includes('gewürz') ||
|
||||
/paprika|hefe|gewürz|salz|pfeffer|curry|zimt|oregano|basilikum|thymian|knoblauch|chili|kümmel|rosmarin|muskat|kurkuma/i.test(
|
||||
name
|
||||
);
|
||||
|
||||
if (isSpice) {
|
||||
return { step: 50, label: '50g' };
|
||||
}
|
||||
return { step: 250, label: '250g' };
|
||||
}
|
||||
|
||||
if (unit === 'kilogramm' || unit === 'kg') {
|
||||
return { step: 1, label: '1kg' };
|
||||
}
|
||||
|
||||
if (unit === 'liter' || unit === 'l') {
|
||||
return { step: 1, label: '1l' };
|
||||
}
|
||||
|
||||
if (unit === 'milliliter' || unit === 'ml') {
|
||||
return { step: 250, label: '250ml' };
|
||||
}
|
||||
|
||||
return { step: 1, label: '1' };
|
||||
}
|
||||
Reference in New Issue
Block a user