1 import { ShoppingBag, TruckFast } from "@medusajs/icons"
2 import { Container, Heading } from "@medusajs/ui"
3 import { useTranslation } from "react-i18next"
4
5 import { CORE_LAYOUT_IDS } from "@medusajs/admin-shared"
6 import { SidebarLink } from "../../../components/common/sidebar-link/sidebar-link"
7 import { LayoutComposer } from "../../../components/layout-composer"
8 import { useFeatureFlag } from "../../../providers/feature-flag-provider"
9 import { ConfigurableLocationListTable } from "./configurable-location-list-table"
10 import { LocationListTable } from "./location-list-table"
11
12 export function LocationList() {
13 const isViewConfigEnabled = useFeatureFlag("view_configurations")
14
15 return (
16 <LayoutComposer
17 widgetsZonePrefix="location.list"
18 preferredLayoutId={CORE_LAYOUT_IDS.TWO_COLUMN}
19 sections={{
20 main: (
21 <>
22 <LayoutComposer.Entry id="stock-locations-table">
23 {isViewConfigEnabled ? (
24 <ConfigurableLocationListTable />
25 ) : (
26 <LocationListTable />
27 )}
28 </LayoutComposer.Entry>
29 </>
30 ),
31 side: (
32 <>
33 <LayoutComposer.Entry id="LinksSection">
34 <LinksSection />
35 </LayoutComposer.Entry>
36 </>
37 ),
38 }}
39 />
40 )
41 }
42
43 const LinksSection = () => {
44 const { t } = useTranslation()
45
46 return (
47 <Container className="p-0">
48 <div className="flex items-center justify-between px-6 py-4">
49 <Heading level="h2">{t("stockLocations.sidebar.header")}</Heading>
50 </div>
51
52 <SidebarLink
53 to="/settings/locations/shipping-profiles"
54 labelKey={t("stockLocations.sidebar.shippingProfiles.label")}
55 descriptionKey={t(
56 "stockLocations.sidebar.shippingProfiles.description"
57 )}
58 icon={<ShoppingBag />}
59 />
60 <SidebarLink
61 to="/settings/locations/shipping-option-types"
62 labelKey={t("stockLocations.sidebar.shippingOptionTypes.label")}
63 descriptionKey={t(
64 "stockLocations.sidebar.shippingOptionTypes.description"
65 )}
66 icon={<TruckFast />}
67 />
68 </Container>
69 )
70 }