1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

feat: Remove "Is Food" and "Disable Amounts" Flags (#5684)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Michael Genson 2025-07-31 10:36:24 -05:00 committed by GitHub
parent efc0d31724
commit 245ca5fe3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 173 additions and 364 deletions

View file

@ -762,31 +762,12 @@ export default defineNuxtComponent({
const contextActions = {
delete: "delete",
setIngredient: "setIngredient",
};
const contextMenu = [
{ title: i18n.t("general.delete"), action: contextActions.delete },
{ title: i18n.t("recipe.ingredient"), action: contextActions.setIngredient },
];
function contextMenuAction(action: string, item: ShoppingListItemOut, idx: number) {
if (!shoppingList.value?.listItems) {
return;
}
switch (action) {
case contextActions.delete:
shoppingList.value.listItems = shoppingList.value?.listItems.filter(itm => itm.id !== item.id);
break;
case contextActions.setIngredient:
shoppingList.value.listItems[idx].isFood = !shoppingList.value.listItems[idx].isFood;
break;
default:
break;
}
}
// =====================================
// Labels, Units, Foods
// TODO: Extract to Composable
@ -901,7 +882,7 @@ export default defineNuxtComponent({
shoppingList.value.listItems.forEach((item) => {
const key = item.checked
? checkedItemKey
: item.isFood && item.food?.name
: item.food?.name
? item.food.name
: item.note || "";
@ -1087,13 +1068,12 @@ export default defineNuxtComponent({
const createEditorOpen = ref(false);
const createListItemData = ref<ShoppingListItemOut>(listItemFactory());
function listItemFactory(isFood = false): ShoppingListItemOut {
function listItemFactory(): ShoppingListItemOut {
return {
id: uuid4(),
shoppingListId: id,
checked: false,
position: shoppingList.value?.listItems?.length || 1,
isFood,
quantity: 0,
note: "",
labelId: undefined,
@ -1144,7 +1124,7 @@ export default defineNuxtComponent({
shoppingList.value.listItems.push(createListItemData.value);
updateListItemOrder();
}
createListItemData.value = listItemFactory(createListItemData.value.isFood || false);
createListItemData.value = listItemFactory();
refresh();
}
@ -1217,7 +1197,6 @@ export default defineNuxtComponent({
addRecipeReferenceToList,
allLabels,
contextMenu,
contextMenuAction,
copyListItems,
createEditorOpen,
createListItem,