opinionated comment cleanup

This commit is contained in:
Michael Genson 2025-07-31 17:52:45 +00:00
commit 798f5a36cc
4 changed files with 3 additions and 18 deletions

View file

@ -11,18 +11,12 @@ export function useShoppingListCopy() {
function copyListItems(itemsByLabel: { [key: string]: ShoppingListItemOut[] }, copyType: CopyTypes) { function copyListItems(itemsByLabel: { [key: string]: ShoppingListItemOut[] }, copyType: CopyTypes) {
const text: string[] = []; const text: string[] = [];
// Copy text into subsections based on label
Object.entries(itemsByLabel).forEach(([label, items], idx) => { Object.entries(itemsByLabel).forEach(([label, items], idx) => {
// for every group except the first, add a blank line
if (idx) { if (idx) {
text.push(""); text.push("");
} }
// add an appropriate heading for the label depending on the copy format
text.push(formatCopiedLabelHeading(copyType, label)); text.push(formatCopiedLabelHeading(copyType, label));
// now add the appropriately formatted list items with the given label
items.forEach(item => text.push(formatCopiedListItem(copyType, item))); items.forEach(item => text.push(formatCopiedListItem(copyType, item)));
}); });

View file

@ -77,7 +77,6 @@ export function useShoppingListCrud(
refresh(); refresh();
} }
// Individual item operations
function saveListItem(item: ShoppingListItemOut) { function saveListItem(item: ShoppingListItemOut) {
if (!shoppingList.value) { if (!shoppingList.value) {
return; return;

View file

@ -52,7 +52,7 @@ export function useShoppingListPage(listId: string) {
const refresh = () => baseRefresh(updateListItemOrder); const refresh = () => baseRefresh(updateListItemOrder);
// Initialize labels // Initialize shopping list labels
const labels = useShoppingListLabels(shoppingList); const labels = useShoppingListLabels(shoppingList);
// Initialize copy functionality // Initialize copy functionality
@ -164,8 +164,6 @@ export function useShoppingListPage(listId: string) {
}); });
return { return {
// State - flatten the dialog state for easier access
...state.state,
shoppingList, shoppingList,
loadingCounter, loadingCounter,
recipeReferenceLoading, recipeReferenceLoading,
@ -179,13 +177,10 @@ export function useShoppingListPage(listId: string) {
itemsByLabel, itemsByLabel,
isOffline, isOffline,
// Labels // Sub-composables
...state.state,
...labels, ...labels,
// CRUD operations
...crud, ...crud,
// Recipe management
...recipes, ...recipes,
// Specialized functions // Specialized functions

View file

@ -398,10 +398,7 @@ export default defineNuxtComponent({
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || ""); const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const id = route.params.id as string; const id = route.params.id as string;
// Use the main shopping list page composable
const shoppingListPage = useShoppingListPage(id); const shoppingListPage = useShoppingListPage(id);
// Get stores for labels, units, and foods
const { store: allLabels } = useLabelStore(); const { store: allLabels } = useLabelStore();
const { store: allUnits } = useUnitStore(); const { store: allUnits } = useUnitStore();
const { store: allFoods } = useFoodStore(); const { store: allFoods } = useFoodStore();