mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-05-07 18:43:34 -04:00
feat: Shopping list / Swipe to check off (#7118)
Co-authored-by: Michael Genson <genson.michael@gmail.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
@@ -223,7 +223,10 @@
|
||||
:units="allUnits || []"
|
||||
:foods="allFoods || []"
|
||||
:recipes="recipeMap"
|
||||
@checked="saveListItem"
|
||||
@checked="(item) => {
|
||||
saveListItem(item);
|
||||
itemCheckedToast(item);
|
||||
}"
|
||||
@save="saveListItem"
|
||||
@delete="deleteListItem(item)"
|
||||
/>
|
||||
@@ -354,7 +357,9 @@ import ShoppingListAddItemForm from "~/components/Domain/ShoppingList/ShoppingLi
|
||||
import ShoppingListItem from "~/components/Domain/ShoppingList/ShoppingListItem.vue";
|
||||
import ShoppingListItemEditor from "~/components/Domain/ShoppingList/ShoppingListItemEditor.vue";
|
||||
import { useShoppingListPage } from "~/composables/shopping-list-page/use-shopping-list-page";
|
||||
import { useFoodStore, useLabelStore, useUnitStore } from "~/composables/store";
|
||||
import { useLabelStore, useUnitStore, useFoodStore } from "~/composables/store";
|
||||
import { alert } from "~/composables/use-toast";
|
||||
import type { ShoppingListItemOut } from "~/lib/api/types/household";
|
||||
|
||||
const { mdAndUp } = useDisplay();
|
||||
const i18n = useI18n();
|
||||
@@ -371,6 +376,23 @@ const { store: allLabels } = useLabelStore();
|
||||
const { store: allUnits } = useUnitStore();
|
||||
const { store: allFoods } = useFoodStore();
|
||||
|
||||
function itemCheckedToast(item: ShoppingListItemOut) {
|
||||
alert.info(
|
||||
i18n.t("shopping-list.item-checked-off", { item: item.food?.name || item.note || i18n.t("recipe.ingredient") }),
|
||||
undefined,
|
||||
{
|
||||
timeout: 4000,
|
||||
action: {
|
||||
message: i18n.t("general.undo"),
|
||||
onClick: () => {
|
||||
item.checked = false;
|
||||
shoppingListPage.saveListItem(item);
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
shoppingList,
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user