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:
parent
efc0d31724
commit
245ca5fe3b
49 changed files with 173 additions and 364 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue