diff --git a/frontend/composables/use-users/preferences.ts b/frontend/composables/use-users/preferences.ts index 6b03c58f3..2cede5eb4 100644 --- a/frontend/composables/use-users/preferences.ts +++ b/frontend/composables/use-users/preferences.ts @@ -33,7 +33,6 @@ export interface UserRecipePreferences { export interface UserShoppingListPreferences { viewAllLists: boolean; - viewByLabel: boolean; } export interface UserTimelinePreferences { @@ -129,7 +128,6 @@ export function useShoppingListPreferences(): Ref { "shopping-list-preferences", { viewAllLists: false, - viewByLabel: true, }, { mergeDefaults: true }, // we cast to a Ref because by default it will return an optional type ref diff --git a/frontend/pages/shopping-lists/[id].vue b/frontend/pages/shopping-lists/[id].vue index b67aad4c7..511096015 100644 --- a/frontend/pages/shopping-lists/[id].vue +++ b/frontend/pages/shopping-lists/[id].vue @@ -90,11 +90,6 @@ text: '', event: 'three-dot', children: [ - { - icon: $globals.icons.tags, - text: $t('shopping-list.toggle-label-sort'), - event: 'sort-by-labels', - }, { icon: $globals.icons.tags, text: $t('shopping-list.reorder-labels'), @@ -111,7 +106,6 @@ @edit="edit = true" @three-dot="threeDot = true" @check="openCheckAll" - @sort-by-labels="sortByLabels" @copy-plain="copyListItems('plain')" @copy-markdown="copyListItems('markdown')" @reorder-labels="toggleReorderLabelsDialog()" @@ -136,90 +130,56 @@ v-if="!edit" class="py-2" > -
- + - - - - -
- - -
-
- - - {{ labelOpenState[key] ? $globals.icons.chevronDown : $globals.icons.chevronRight }} - - {{ key }} - - - -
- + {{ labelOpenState[key] ? $globals.icons.chevronDown : $globals.icons.chevronRight }} + + {{ key }} + + + +
+ + - - - - -
-
-
+ + + +
+
@@ -647,29 +607,19 @@ export default defineNuxtComponent({ function copyListItems(copyType: CopyTypes) { const text: string[] = []; - if (preferences.value.viewByLabel) { - // if we're sorting by label, we want the copied text in subsections - Object.entries(itemsByLabel.value).forEach(([label, items], idx) => { - // for every group except the first, add a blank line - if (idx) { - text.push(""); - } + // Copy text into subsections based on label + Object.entries(itemsByLabel.value).forEach(([label, items], idx) => { + // for every group except the first, add a blank line + if (idx) { + text.push(""); + } - // add an appropriate heading for the label depending on the copy format - text.push(formatCopiedLabelHeading(copyType, label)); + // add an appropriate heading for the label depending on the copy format + text.push(formatCopiedLabelHeading(copyType, label)); - // now add the appropriately formatted list items with the given label - items.forEach(item => text.push(formatCopiedListItem(copyType, item))); - }); - } - else { - // labels are toggled off, so just copy in the order they come in - const items = shoppingList.value?.listItems?.filter(item => !item.checked); - - items?.forEach((item) => { - text.push(formatCopiedListItem(copyType, item)); - }); - } + // now add the appropriately formatted list items with the given label + items.forEach(item => text.push(formatCopiedListItem(copyType, item))); + }); copy.copyPlain(text); } @@ -801,10 +751,6 @@ export default defineNuxtComponent({ return item?.label?.color; } - function sortByLabels() { - preferences.value.viewByLabel = !preferences.value.viewByLabel; - } - function toggleReorderLabelsDialog() { // stop polling and populate localLabels loadingCounter.value += 1; @@ -1148,16 +1094,6 @@ export default defineNuxtComponent({ refresh(); } - function updateIndexUnchecked(uncheckedItems: ShoppingListItemOut[]) { - listItems.unchecked = uncheckedItems; - listItems.checked = shoppingList.value?.listItems?.filter(item => item.checked) || []; - - // since the user has manually reordered the list, we should preserve this order - preserveItemOrder.value = true; - - updateUncheckedListItems(); - } - function updateIndexUncheckedByLabel(labelName: string, labeledUncheckedItems: ShoppingListItemOut[]) { if (!itemsByLabel.value[labelName]) { return; @@ -1245,7 +1181,6 @@ export default defineNuxtComponent({ saveListItem, shoppingList, showChecked, - sortByLabels, labelOpenState, toggleShowLabel, toggleShowChecked, @@ -1253,7 +1188,6 @@ export default defineNuxtComponent({ openUncheckAll, checkAll, openCheckAll, - updateIndexUnchecked, updateIndexUncheckedByLabel, allUnits, allFoods,