fix: soo many lint errors

This commit is contained in:
Max Richter
2025-11-03 00:03:27 +01:00
parent c13420c3ab
commit 696082250d
41 changed files with 373 additions and 500 deletions

View File

@@ -9,15 +9,12 @@ function formatAmount(num: number) {
}
function formatUnit(unit: string, amount: number) {
const unitKey = unit.toLowerCase() as keyof typeof unitsOfMeasure;
if (!unit) return "";
const unitKey = unit.toLowerCase() as (keyof typeof unitsOfMeasure);
if (unitKey in unitsOfMeasure) {
if (amount > 1 && unitsOfMeasure[unitKey].plural !== undefined) {
return unitsOfMeasure[unitKey].plural;
}
if (unitKey !== "cup") {
return unitsOfMeasure[unitKey].short;
}
return unitKey.toString();
} else {
return unit;
@@ -66,9 +63,22 @@ export const IngredientsList: FunctionalComponent<
<table class="w-full border-collapse table-auto">
<tbody>
{ingredients.map((item) => {
return (
<Ingredient ingredient={item} amount={amount} portion={portion} />
);
if ("items" in item) {
return item.items.map((ing, i) => {
return (
<Ingredient
key={i}
ingredient={ing}
amount={amount}
portion={portion}
/>
);
});
} else {
return (
<Ingredient ingredient={item} amount={amount} portion={portion} />
);
}
})}
</tbody>
</table>