1
1
import { Sidebar } from "../Sidebar/Sidebar.tsx" ;
2
2
import { Tabs } from "../Tabs/Tabs.tsx" ;
3
- import { useEffect , useMemo , useState } from "react" ;
3
+ import { useEffect , useState } from "react" ;
4
4
import { localStorageDriver } from "src/lib/storage/local-storage.ts" ;
5
5
6
6
import { validateTabs , usePersistTabs } from "src/lib/tabs" ;
@@ -13,14 +13,11 @@ import {
13
13
productsRoute ,
14
14
suppliersRoute ,
15
15
} from "../../constants/routes.constants.ts" ;
16
- import {
17
- InsertMethod ,
18
- TabConfig ,
19
- useRouterTabs ,
20
- } from "src/lib/tabs/useRouterTabs.tsx" ;
16
+ import { TabConfig , useRouterTabs } from "src/lib/tabs/useRouterTabs.tsx" ;
21
17
import { css } from "@emotion/react" ;
22
18
import { Outlet } from "react-router-dom" ;
23
19
import { TabModel } from "src/lib/tabs-ui/tabs-ui.types.ts" ;
20
+ import { theBeginning } from "src/lib/tabs/theBeginning.ts" ;
24
21
25
22
const persistStoreKey = {
26
23
name : "clip-one__main-tabs" ,
@@ -45,32 +42,30 @@ export function AdminLayout() {
45
42
{
46
43
title : ( ) => "Dashboard" ,
47
44
shouldOpen : ( match ) => match . route . path === dashboardRoute ,
48
- insertMethod : InsertMethod . Prepend ,
45
+ insertAt : theBeginning ,
49
46
} ,
50
47
{
51
48
title : ( ) => "Categories" ,
52
49
shouldOpen : ( match ) => match . route . path === categoriesRoute ,
53
- insertMethod : InsertMethod . Prepend ,
50
+ insertAt : theBeginning ,
54
51
} ,
55
52
{
56
53
title : ( ) => "Products" ,
57
54
shouldOpen : ( match ) => match . route . path === productsRoute ,
58
- insertMethod : InsertMethod . Prepend ,
55
+ insertAt : theBeginning ,
59
56
} ,
60
57
{
61
58
title : ( ) => "Suppliers" ,
62
59
shouldOpen : ( match ) => match . route . path === suppliersRoute ,
63
- insertMethod : InsertMethod . Prepend ,
60
+ insertAt : theBeginning ,
64
61
} ,
65
62
] ) ;
66
63
67
64
const { activeTabId, setActiveTabId, getTabTitleByTabPath } = useRouterTabs ( {
68
65
router,
69
66
config,
70
67
tabs,
71
- endPinnedTabs : useMemo ( ( ) => [ ] , [ ] ) ,
72
68
onTabsChange : setTabs ,
73
- startPinnedTabs,
74
69
fallbackPath : homeRoute ,
75
70
} ) ;
76
71
0 commit comments