From e2242f58cc94420f9c1674ce4867666865fcf355 Mon Sep 17 00:00:00 2001 From: Tara Aqeel Date: Fri, 23 Oct 2026 14:19:10 +0200 Subject: [PATCH] refactor: extract shared shopping list tabs (#111) --- frontend/src/pages/shoppingLists/PreviousListsPage.tsx | 6 +----- frontend/src/pages/shoppingLists/ShoppingListsPage.tsx | 5 +---- frontend/src/pages/shoppingLists/shoppingListTabs.ts | 4 ++++ 3 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 frontend/src/pages/shoppingLists/shoppingListTabs.ts diff --git a/frontend/src/pages/shoppingLists/PreviousListsPage.tsx b/frontend/src/pages/shoppingLists/PreviousListsPage.tsx index 52213b7..d030bd0 100644 --- a/frontend/src/pages/shoppingLists/PreviousListsPage.tsx +++ b/frontend/src/pages/shoppingLists/PreviousListsPage.tsx @@ -5,11 +5,7 @@ import type { ShoppingList } from "../../types/shoppingList"; import "./PreviousListsPage.css"; import "./ShoppingListsPage.css"; import { mockLists } from "./shoppingListMockData"; - -const LIST_TABS = [ - { value: "active", label: "Aktive", to: "/lists" }, - { value: "previous", label: "Tidligere", to: "/lists/history" }, -]; +import { LIST_TABS } from "./shoppingListTabs"; diff --git a/frontend/src/pages/shoppingLists/ShoppingListsPage.tsx b/frontend/src/pages/shoppingLists/ShoppingListsPage.tsx index 6aa6aa3..9686d0d 100644 --- a/frontend/src/pages/shoppingLists/ShoppingListsPage.tsx +++ b/frontend/src/pages/shoppingLists/ShoppingListsPage.tsx @@ -4,15 +4,12 @@ import SegmentedControl from "../../components/segmentedControl/SegmentedControl import ShoppingListCard from "./ShoppingListCard"; import { mockLists } from "./shoppingListMockData"; import "./ShoppingListsPage.css"; +import { LIST_TABS } from "./shoppingListTabs"; type SortOrder = "newest" | "oldest" | "name-asc" | "name-desc"; const SORT_STORAGE_KEY = "active-lists-sort-order"; -const LIST_TABS = [ - { value: "active", label: "Aktive", to: "/lists" }, - { value: "previous", label: "Tidligere", to: "/lists/history" }, -]; function loadSortOrder(): SortOrder { try { diff --git a/frontend/src/pages/shoppingLists/shoppingListTabs.ts b/frontend/src/pages/shoppingLists/shoppingListTabs.ts new file mode 100644 index 0000000..8812419 --- /dev/null +++ b/frontend/src/pages/shoppingLists/shoppingListTabs.ts @@ -0,0 +1,4 @@ +export const LIST_TABS = [ + { value: "active", label: "Aktive", to: "/lists" }, + { value: "previous", label: "Tidligere", to: "/lists/history" }, +]; \ No newline at end of file