@deenruv/admin-dashboard 1.0.17-dev.4 → 1.0.17-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DeenruvAdminPanel.js +30 -41
- package/dist/access/access-context.js +10 -0
- package/dist/access/admin-router.js +60 -0
- package/dist/access/built-in-route-permissions.js +44 -0
- package/dist/access/built-in-routes.js +301 -0
- package/dist/access/channel-selection.js +11 -0
- package/dist/access/index.js +6 -0
- package/dist/access/navigation.js +33 -0
- package/dist/access/permission-access.js +9 -0
- package/dist/access/permission-routes.js +3 -0
- package/dist/access/types.js +1 -0
- package/dist/components/BrandLogo.js +5 -5
- package/dist/components/GlobalSearch.js +32 -57
- package/dist/components/Menu/AccountMenu.js +58 -0
- package/dist/components/Menu/Breadcrumbs.js +23 -0
- package/dist/components/Menu/ChannelSwitcher.js +8 -1
- package/dist/components/Menu/Navigation.js +79 -257
- package/dist/components/Menu/NavigationFooter.js +16 -7
- package/dist/components/Menu/SidebarContent.js +9 -0
- package/dist/components/Menu/SidebarState.js +93 -0
- package/dist/components/Menu/TopbarOverflow.js +11 -0
- package/dist/components/Menu/index.js +68 -56
- package/dist/components/storefrontAction/StorefrontAction.js +9 -0
- package/dist/components/storefrontAction/StorefrontAction.logic.js +27 -0
- package/dist/components/storefrontAction/index.js +2 -0
- package/dist/graphql/scalars.js +4 -0
- package/dist/index.css +65 -0
- package/dist/locales/en/admins.json +62 -0
- package/dist/locales/en/collections.json +14 -0
- package/dist/locales/en/common.json +55 -27
- package/dist/locales/en/orders.json +9 -1
- package/dist/locales/en/products.json +15 -0
- package/dist/locales/pl/admins.json +62 -0
- package/dist/locales/pl/collections.json +14 -0
- package/dist/locales/pl/common.json +56 -28
- package/dist/locales/pl/orders.json +9 -1
- package/dist/locales/pl/products.json +15 -0
- package/dist/pages/Root.js +76 -35
- package/dist/pages/admins/Detail.js +1 -1
- package/dist/pages/admins/List.js +8 -3
- package/dist/pages/admins/Provision.js +173 -0
- package/dist/pages/admins/Provision.logic.js +53 -0
- package/dist/pages/admins/index.js +1 -0
- package/dist/pages/assets/List.js +3 -3
- package/dist/pages/channels/Detail.js +1 -1
- package/dist/pages/collections/Detail.js +9 -1
- package/dist/pages/collections/List.js +87 -20
- package/dist/pages/collections/_components/ContentsCard.js +1 -1
- package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.js +41 -0
- package/dist/pages/collections/_components/collectionStorefrontAction/CollectionStorefrontAction.logic.js +44 -0
- package/dist/pages/collections/_components/collectionStorefrontAction/index.js +2 -0
- package/dist/pages/countries/Detail.js +6 -1
- package/dist/pages/countries/List.js +1 -1
- package/dist/pages/dashboard/Dashboard.js +2 -2
- package/dist/pages/facets/Detail.js +6 -1
- package/dist/pages/facets/List.js +1 -1
- package/dist/pages/facets/_components/FacetDetailView.js +3 -2
- package/dist/pages/orders/_components/CancelAndRefundDialog.js +80 -19
- package/dist/pages/orders/_components/OrderLineImage.logic.js +4 -0
- package/dist/pages/orders/_components/Payments.js +39 -23
- package/dist/pages/orders/_components/ProductsCard.js +2 -3
- package/dist/pages/orders/_components/ProductsTable.js +13 -25
- package/dist/pages/orders/_components/TopActions.js +14 -8
- package/dist/pages/payment-methods/Detail.js +6 -1
- package/dist/pages/payment-methods/List.js +1 -1
- package/dist/pages/product-variants/List.js +7 -6
- package/dist/pages/products/Detail.js +9 -17
- package/dist/pages/products/List.js +3 -2
- package/dist/pages/products/ProductInitialVariantFormConfig.js +17 -0
- package/dist/pages/products/_components/Variant.js +13 -7
- package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.js +42 -0
- package/dist/pages/products/_components/productStorefrontAction/ProductStorefrontAction.logic.js +39 -0
- package/dist/pages/products/_components/productStorefrontAction/index.js +2 -0
- package/dist/pages/roles/Detail.js +1 -1
- package/dist/pages/sellers/Detail.js +1 -1
- package/dist/pages/shipping-methods/Detail.js +6 -1
- package/dist/pages/shipping-methods/List.js +1 -1
- package/dist/pages/status/_components/Jobs.js +2 -2
- package/dist/pages/stock-locations/Detail.js +1 -1
- package/dist/pages/tax-categories/Detail.js +3 -3
- package/dist/pages/tax-categories/List.js +1 -1
- package/dist/pages/tax-rates/Detail.js +6 -1
- package/dist/pages/tax-rates/List.js +1 -1
- package/dist/pages/zones/Detail.js +6 -1
- package/dist/pages/zones/List.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -1,52 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// eslint-disable-next-line no-restricted-imports
|
|
3
3
|
import { I18nextProvider } from 'react-i18next';
|
|
4
|
-
import { useEffect } from 'react';
|
|
4
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import { createBrowserRouter, RouterProvider } from 'react-router';
|
|
6
6
|
import { AnimatePresence } from 'framer-motion';
|
|
7
7
|
import { Toaster } from 'sonner';
|
|
8
8
|
import i18n from './i18.js';
|
|
9
|
-
import {
|
|
9
|
+
import { PluginProvider, PluginStore, useServer, useSettings, GlobalStoreProvider, DEFAULT_CHANNEL_CODE, NotificationProvider, } from '@deenruv/react-ui-devkit';
|
|
10
10
|
import { useShallow } from 'zustand/react/shallow';
|
|
11
11
|
import { LanguageCode } from '@deenruv/admin-types';
|
|
12
12
|
import { Root } from "./pages/Root.js";
|
|
13
13
|
import { LoginScreen } from "./pages/LoginScreen.js";
|
|
14
14
|
import { ErrorPage } from "./pages/Custom404.js";
|
|
15
|
-
import * as Pages from "./pages/index.js";
|
|
16
15
|
import * as resources from "./locales/index.js";
|
|
17
16
|
import { ADMIN_DASHBOARD_VERSION } from "./version.js";
|
|
18
17
|
import { ORDER_STATUS_NOTIFICATION } from "./notifications/OrderStatusNotification.js";
|
|
19
18
|
import { SYSTEM_STATUS_NOTIFICATION } from "./notifications/SystemStatusNotification.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const route = Routes[name];
|
|
23
|
-
if (typeof route !== 'object')
|
|
24
|
-
return route;
|
|
25
|
-
if (key.includes('DetailPage') && 'route' in route)
|
|
26
|
-
return route.route;
|
|
27
|
-
if (key.includes('ListPage') && 'list' in route)
|
|
28
|
-
return route.list;
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
const getName = (key) => {
|
|
32
|
-
if (key.includes('DetailPage'))
|
|
33
|
-
return firstLetterToLowerCase(key.replace('DetailPage', ''));
|
|
34
|
-
if (key.includes('ListPage'))
|
|
35
|
-
return firstLetterToLowerCase(key.replace('ListPage', ''));
|
|
36
|
-
return firstLetterToLowerCase(key);
|
|
37
|
-
};
|
|
38
|
-
const DeenruvPaths = Object.entries(Pages).flatMap(([key, Component]) => {
|
|
39
|
-
const name = getName(key);
|
|
40
|
-
const path = getRoute(name, key);
|
|
41
|
-
const paths = [];
|
|
42
|
-
if (path)
|
|
43
|
-
paths.push({ path, element: _jsx(Component, {}) });
|
|
44
|
-
const route = Routes[name];
|
|
45
|
-
if (key.includes('DetailPage') && typeof route === 'object' && 'new' in route) {
|
|
46
|
-
paths.push({ path: route.new, element: _jsx(Component, {}) });
|
|
47
|
-
}
|
|
48
|
-
return paths;
|
|
49
|
-
});
|
|
19
|
+
import { AdminAccessProvider, builtInAdminRoutes, getDefaultAdminRoute, getPermittedAdminRoutes, } from "./access/index.js";
|
|
20
|
+
import { CommittedRouterOwner, createAdminRouterRoutes } from "./access/admin-router.js";
|
|
50
21
|
const loadTranslations = () => {
|
|
51
22
|
Object.entries(resources).forEach(([lang, value]) => {
|
|
52
23
|
Object.entries(value).forEach(([, translations]) => {
|
|
@@ -62,6 +33,8 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
|
|
|
62
33
|
...settings,
|
|
63
34
|
ui: {
|
|
64
35
|
...settings.ui,
|
|
36
|
+
showChannelPicker: settings?.ui?.showChannelPicker ?? true,
|
|
37
|
+
showLanguagePicker: settings?.ui?.showLanguagePicker ?? true,
|
|
65
38
|
defaultChannelCode: settings?.ui?.defaultChannelCode || DEFAULT_CHANNEL_CODE,
|
|
66
39
|
defaultLanguageCode: settings?.ui?.defaultLanguageCode || LanguageCode.en,
|
|
67
40
|
defaultTranslationLanguageCode: settings?.ui?.defaultTranslationLanguageCode || LanguageCode.en,
|
|
@@ -76,13 +49,6 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
|
|
|
76
49
|
};
|
|
77
50
|
pluginsStore.install(plugins, i18n);
|
|
78
51
|
loadTranslations();
|
|
79
|
-
const router = createBrowserRouter([
|
|
80
|
-
{
|
|
81
|
-
element: _jsx(Root, { allPaths: [...DeenruvPaths].map((path) => path.path).filter(Boolean) }),
|
|
82
|
-
errorElement: _jsx(ErrorPage, {}),
|
|
83
|
-
children: [...DeenruvPaths, ...pluginsStore.routes],
|
|
84
|
-
},
|
|
85
|
-
]);
|
|
86
52
|
const { theme, isLoggedIn, ...context } = useSettings(useShallow((p) => ({
|
|
87
53
|
theme: p.theme,
|
|
88
54
|
isLoggedIn: p.isLoggedIn,
|
|
@@ -90,6 +56,29 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
|
|
|
90
56
|
language: p.language,
|
|
91
57
|
translationsLanguage: p.translationsLanguage,
|
|
92
58
|
})));
|
|
59
|
+
const { administratorAccessState, userPermissions } = useServer(useShallow((p) => ({
|
|
60
|
+
administratorAccessState: p.administratorAccessState,
|
|
61
|
+
userPermissions: p.userPermissions,
|
|
62
|
+
})));
|
|
63
|
+
const pluginRoutes = useMemo(() => pluginsStore.routes.map((route) => ({
|
|
64
|
+
id: `plugin.${route.plugin.name}.${route.path}`,
|
|
65
|
+
path: route.path,
|
|
66
|
+
element: route.element,
|
|
67
|
+
...route.access,
|
|
68
|
+
search: { menuKey: `${route.plugin.name} - ${route.path}`, type: 'plugin' },
|
|
69
|
+
})), [plugins]);
|
|
70
|
+
const permittedRoutes = useMemo(() => administratorAccessState === 'ready'
|
|
71
|
+
? getPermittedAdminRoutes([...builtInAdminRoutes, ...pluginRoutes], userPermissions)
|
|
72
|
+
: [], [administratorAccessState, pluginRoutes, userPermissions]);
|
|
73
|
+
const defaultRoute = administratorAccessState === 'ready' ? getDefaultAdminRoute(permittedRoutes) : undefined;
|
|
74
|
+
const routerRemountKey = useMemo(() => JSON.stringify([administratorAccessState, permittedRoutes.map(({ id }) => id)]), [administratorAccessState, permittedRoutes]);
|
|
75
|
+
const createRouter = useCallback(() => createBrowserRouter(createAdminRouterRoutes({
|
|
76
|
+
permittedRoutes,
|
|
77
|
+
defaultRoute,
|
|
78
|
+
administratorAccessState,
|
|
79
|
+
rootElement: _jsx(Root, { allPaths: permittedRoutes.map((route) => route.path).filter(Boolean) }),
|
|
80
|
+
errorElement: _jsx(ErrorPage, {}),
|
|
81
|
+
})), [administratorAccessState, defaultRoute, permittedRoutes]);
|
|
93
82
|
useEffect(() => {
|
|
94
83
|
const root = window.document.documentElement;
|
|
95
84
|
root.classList.remove('light', 'dark');
|
|
@@ -101,7 +90,7 @@ export const DeenruvAdminPanel = ({ plugins, settings }) => {
|
|
|
101
90
|
root.classList.add(theme);
|
|
102
91
|
}
|
|
103
92
|
}, [theme]);
|
|
104
|
-
return (_jsx(GlobalStoreProvider, { ...settings, children: _jsxs(I18nextProvider, { i18n: i18n, defaultNS: 'common', children: [_jsx(AnimatePresence, { children: isLoggedIn ? (_jsx(PluginProvider, { plugins: pluginsStore, context: context, children: _jsx(NotificationProvider, { notifications: [ORDER_STATUS_NOTIFICATION, SYSTEM_STATUS_NOTIFICATION].concat(pluginsStore.notifications), children: _jsx(RouterProvider, { router: router }) }) })) : (_jsx(LoginScreen, {})) }), _jsx(Toaster, { theme: theme, className: "toaster group", richColors: true, expand: true, position: "bottom-right", toastOptions: {
|
|
93
|
+
return (_jsx(GlobalStoreProvider, { ...settings, children: _jsxs(I18nextProvider, { i18n: i18n, defaultNS: 'common', children: [_jsx(AnimatePresence, { children: isLoggedIn ? (_jsx(AdminAccessProvider, { value: { routes: permittedRoutes, defaultRoute }, children: _jsx(PluginProvider, { plugins: pluginsStore, context: context, children: _jsx(NotificationProvider, { notifications: [ORDER_STATUS_NOTIFICATION, SYSTEM_STATUS_NOTIFICATION].concat(pluginsStore.notifications), children: _jsx(CommittedRouterOwner, { createRouter: createRouter, remountKey: routerRemountKey, children: (router) => _jsx(RouterProvider, { router: router }) }) }) }) })) : (_jsx(LoginScreen, {})) }), _jsx(Toaster, { theme: theme, className: "toaster group", richColors: true, expand: true, position: "bottom-right", toastOptions: {
|
|
105
94
|
classNames: {
|
|
106
95
|
toast: 'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:p-4',
|
|
107
96
|
title: 'group-[.toast]:font-semibold group-[.toast]:text-foreground',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
const AdminAccessContext = createContext(null);
|
|
4
|
+
export const AdminAccessProvider = ({ children, value, }) => (_jsx(AdminAccessContext.Provider, { value: value, children: children }));
|
|
5
|
+
export const useAdminAccess = () => {
|
|
6
|
+
const context = useContext(AdminAccessContext);
|
|
7
|
+
if (!context)
|
|
8
|
+
throw new Error('useAdminAccess must be used within AdminAccessProvider');
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Routes } from '@deenruv/react-ui-devkit';
|
|
4
|
+
import { Navigate } from 'react-router';
|
|
5
|
+
export const CommittedRouterOwner = ({ createRouter, remountKey, children, }) => {
|
|
6
|
+
const [ownedRouter, setOwnedRouter] = useState();
|
|
7
|
+
const activeRouter = useRef(undefined);
|
|
8
|
+
const disposedRouters = useRef(new WeakSet());
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
const nextRouter = createRouter();
|
|
11
|
+
activeRouter.current = nextRouter;
|
|
12
|
+
setOwnedRouter({ router: nextRouter, remountKey });
|
|
13
|
+
return () => {
|
|
14
|
+
if (activeRouter.current === nextRouter) {
|
|
15
|
+
activeRouter.current = undefined;
|
|
16
|
+
}
|
|
17
|
+
globalThis.queueMicrotask(() => {
|
|
18
|
+
if (activeRouter.current !== nextRouter && !disposedRouters.current.has(nextRouter)) {
|
|
19
|
+
disposedRouters.current.add(nextRouter);
|
|
20
|
+
nextRouter.dispose();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}, [createRouter, remountKey]);
|
|
25
|
+
return ownedRouter && activeRouter.current === ownedRouter.router ? (_jsx(Fragment, { children: children(ownedRouter.router) }, ownedRouter.remountKey)) : null;
|
|
26
|
+
};
|
|
27
|
+
export const createAdminRouterRoutes = ({ permittedRoutes, defaultRoute, administratorAccessState, rootElement, errorElement, }) => {
|
|
28
|
+
const children = permittedRoutes.map(({ id, path, element }) => ({ id, path, element }));
|
|
29
|
+
if (administratorAccessState === 'ready' &&
|
|
30
|
+
defaultRoute &&
|
|
31
|
+
!permittedRoutes.some((route) => route.path === Routes.dashboard)) {
|
|
32
|
+
children.push({
|
|
33
|
+
id: 'admin.fallback.dashboard',
|
|
34
|
+
path: Routes.dashboard,
|
|
35
|
+
element: _jsx(Navigate, { to: defaultRoute.path, replace: true }),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (administratorAccessState === 'ready' && defaultRoute) {
|
|
39
|
+
children.push({
|
|
40
|
+
id: 'admin.fallback.wildcard',
|
|
41
|
+
path: '*',
|
|
42
|
+
element: _jsx(Navigate, { to: defaultRoute.path, replace: true }),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (administratorAccessState === 'pending') {
|
|
46
|
+
children.push({
|
|
47
|
+
id: 'admin.fallback.pending-access',
|
|
48
|
+
path: '*',
|
|
49
|
+
element: null,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
children.push({
|
|
54
|
+
id: 'admin.fallback.unavailable-access',
|
|
55
|
+
path: '*',
|
|
56
|
+
element: errorElement,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return [{ id: 'admin.root', element: rootElement, errorElement, children }];
|
|
60
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Permission } from '@deenruv/admin-types';
|
|
2
|
+
export const catalogRoutePermissions = {
|
|
3
|
+
products: {
|
|
4
|
+
read: [Permission.ReadProduct, Permission.ReadCatalog],
|
|
5
|
+
create: [Permission.CreateProduct, Permission.CreateCatalog],
|
|
6
|
+
},
|
|
7
|
+
collections: {
|
|
8
|
+
read: [Permission.ReadCollection, Permission.ReadCatalog],
|
|
9
|
+
create: [Permission.CreateCollection, Permission.CreateCatalog],
|
|
10
|
+
},
|
|
11
|
+
facets: {
|
|
12
|
+
read: [Permission.ReadFacet, Permission.ReadCatalog],
|
|
13
|
+
create: [Permission.CreateFacet, Permission.CreateCatalog],
|
|
14
|
+
},
|
|
15
|
+
assets: {
|
|
16
|
+
read: [Permission.ReadAsset, Permission.ReadCatalog],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export const settingsRoutePermissions = {
|
|
20
|
+
paymentMethods: {
|
|
21
|
+
read: [Permission.ReadPaymentMethod, Permission.ReadSettings],
|
|
22
|
+
create: [Permission.CreatePaymentMethod, Permission.CreateSettings],
|
|
23
|
+
},
|
|
24
|
+
shippingMethods: {
|
|
25
|
+
read: [Permission.ReadShippingMethod, Permission.ReadSettings],
|
|
26
|
+
create: [Permission.CreateShippingMethod, Permission.CreateSettings],
|
|
27
|
+
},
|
|
28
|
+
zones: {
|
|
29
|
+
read: [Permission.ReadZone, Permission.ReadSettings],
|
|
30
|
+
create: [Permission.CreateZone, Permission.CreateSettings],
|
|
31
|
+
},
|
|
32
|
+
countries: {
|
|
33
|
+
read: [Permission.ReadCountry, Permission.ReadSettings],
|
|
34
|
+
create: [Permission.CreateCountry, Permission.CreateSettings],
|
|
35
|
+
},
|
|
36
|
+
taxCategories: {
|
|
37
|
+
read: [Permission.ReadTaxCategory, Permission.ReadSettings],
|
|
38
|
+
create: [Permission.CreateTaxCategory, Permission.CreateSettings],
|
|
39
|
+
},
|
|
40
|
+
taxRates: {
|
|
41
|
+
read: [Permission.ReadTaxRate, Permission.ReadSettings],
|
|
42
|
+
create: [Permission.CreateTaxRate, Permission.CreateSettings],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Permission } from '@deenruv/admin-types';
|
|
3
|
+
import { Routes } from '@deenruv/react-ui-devkit';
|
|
4
|
+
import { BarChart, Barcode, BadgePercent, Coins, Cog, CreditCard, Flag, Folder, Globe, Globe2, Images, MapPin, Percent, ScanBarcode, Server, ShoppingCart, Store, Tag, Truck, UserCog, UserRoundSearch, Users, UsersRound, } from 'lucide-react';
|
|
5
|
+
import { AdminsDetailPage, AdminsListPage, AdminsProvisionPage, AssetsListPage, ChannelsDetailPage, ChannelsListPage, CollectionsDetailPage, CollectionsListPage, CountriesDetailPage, CountriesListPage, CustomerGroupsDetailPage, CustomerGroupsListPage, CustomersDetailPage, CustomersListPage, Dashboard, Extensions, FacetsDetailPage, FacetsListPage, GlobalSettings, OrdersDetailPage, OrdersListPage, PaymentMethodsDetailPage, PaymentMethodsListPage, ProductVariantDetailPage, ProductVariantsListPage, ProductsDetailPage, ProductsListPage, PromotionsDetailPage, PromotionsListPage, RolesDetailPage, RolesListPage, SellersDetailPage, SellersListPage, ShippingMethodsDetailPage, ShippingMethodsListPage, Status, StockLocationsDetailPage, StockLocationsListPage, TaxCategoriesDetailPage, TaxCategoriesListPage, TaxRatesDetailPage, TaxRatesListPage, ZonesDetailPage, ZonesListPage, } from "../pages/index.js";
|
|
6
|
+
import { catalogRoutePermissions, settingsRoutePermissions } from './built-in-route-permissions.js';
|
|
7
|
+
export const adminNavigationGroups = [
|
|
8
|
+
{ id: 'shop-group', labelKey: 'shop' },
|
|
9
|
+
{ id: 'assortment-group', labelKey: 'assortment' },
|
|
10
|
+
{ id: 'users-group', labelKey: 'users' },
|
|
11
|
+
{ id: 'promotions-group', labelKey: 'promotions' },
|
|
12
|
+
{ id: 'shipping-group', labelKey: 'shipping' },
|
|
13
|
+
{ id: 'settings-group', labelKey: 'settings' },
|
|
14
|
+
];
|
|
15
|
+
const createCrudRouteDefinitions = ({ id, menuKey, routes, listElement, detailElement, readPermissions, createPermissions, nav, }) => {
|
|
16
|
+
const definitions = [
|
|
17
|
+
{
|
|
18
|
+
id: `${id}.list`,
|
|
19
|
+
path: routes.list,
|
|
20
|
+
element: listElement(),
|
|
21
|
+
requiredPermissions: readPermissions,
|
|
22
|
+
nav,
|
|
23
|
+
search: { menuKey, type: 'list' },
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
if (routes.route && detailElement) {
|
|
27
|
+
definitions.push({
|
|
28
|
+
id: `${id}.detail`,
|
|
29
|
+
path: routes.route,
|
|
30
|
+
element: detailElement(),
|
|
31
|
+
requiredPermissions: readPermissions,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (routes.new && detailElement) {
|
|
35
|
+
definitions.push({
|
|
36
|
+
id: `${id}.create`,
|
|
37
|
+
path: routes.new,
|
|
38
|
+
element: detailElement(),
|
|
39
|
+
requiredPermissions: createPermissions,
|
|
40
|
+
search: { menuKey, type: 'new' },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return definitions;
|
|
44
|
+
};
|
|
45
|
+
export const builtInAdminRoutes = [
|
|
46
|
+
{
|
|
47
|
+
id: 'dashboard',
|
|
48
|
+
path: Routes.dashboard,
|
|
49
|
+
element: _jsx(Dashboard, {}),
|
|
50
|
+
nav: { groupId: 'shop-group', linkId: 'link-dashboard', menuKey: 'dashboard', icon: BarChart },
|
|
51
|
+
search: { menuKey: 'dashboard', type: 'default' },
|
|
52
|
+
},
|
|
53
|
+
...createCrudRouteDefinitions({
|
|
54
|
+
id: 'orders',
|
|
55
|
+
menuKey: 'orders',
|
|
56
|
+
routes: Routes.orders,
|
|
57
|
+
listElement: () => _jsx(OrdersListPage, {}),
|
|
58
|
+
detailElement: () => _jsx(OrdersDetailPage, {}),
|
|
59
|
+
readPermissions: [Permission.ReadOrder],
|
|
60
|
+
createPermissions: [Permission.CreateOrder],
|
|
61
|
+
nav: { groupId: 'shop-group', linkId: 'link-orders', menuKey: 'orders', icon: ShoppingCart },
|
|
62
|
+
}),
|
|
63
|
+
...createCrudRouteDefinitions({
|
|
64
|
+
id: 'customers',
|
|
65
|
+
menuKey: 'customers',
|
|
66
|
+
routes: Routes.customers,
|
|
67
|
+
listElement: () => _jsx(CustomersListPage, {}),
|
|
68
|
+
detailElement: () => _jsx(CustomersDetailPage, {}),
|
|
69
|
+
readPermissions: [Permission.ReadCustomer],
|
|
70
|
+
createPermissions: [Permission.CreateCustomer],
|
|
71
|
+
nav: { groupId: 'shop-group', linkId: 'link-customers', menuKey: 'customers', icon: UserRoundSearch },
|
|
72
|
+
}),
|
|
73
|
+
...createCrudRouteDefinitions({
|
|
74
|
+
id: 'customerGroups',
|
|
75
|
+
menuKey: 'customerGroups',
|
|
76
|
+
routes: Routes.customerGroups,
|
|
77
|
+
listElement: () => _jsx(CustomerGroupsListPage, {}),
|
|
78
|
+
detailElement: () => _jsx(CustomerGroupsDetailPage, {}),
|
|
79
|
+
readPermissions: [Permission.ReadCustomerGroup],
|
|
80
|
+
createPermissions: [Permission.CreateCustomerGroup],
|
|
81
|
+
nav: { groupId: 'shop-group', linkId: 'link-customerGroups', menuKey: 'customerGroups', icon: UsersRound },
|
|
82
|
+
}),
|
|
83
|
+
...createCrudRouteDefinitions({
|
|
84
|
+
id: 'products',
|
|
85
|
+
menuKey: 'products',
|
|
86
|
+
routes: Routes.products,
|
|
87
|
+
listElement: () => _jsx(ProductsListPage, {}),
|
|
88
|
+
detailElement: () => _jsx(ProductsDetailPage, {}),
|
|
89
|
+
readPermissions: catalogRoutePermissions.products.read,
|
|
90
|
+
createPermissions: catalogRoutePermissions.products.create,
|
|
91
|
+
nav: { groupId: 'assortment-group', linkId: 'link-products', menuKey: 'products', icon: Barcode },
|
|
92
|
+
}),
|
|
93
|
+
...createCrudRouteDefinitions({
|
|
94
|
+
id: 'productVariants',
|
|
95
|
+
menuKey: 'productVariants',
|
|
96
|
+
routes: Routes.productVariants,
|
|
97
|
+
listElement: () => _jsx(ProductVariantsListPage, {}),
|
|
98
|
+
detailElement: () => _jsx(ProductVariantDetailPage, {}),
|
|
99
|
+
readPermissions: catalogRoutePermissions.products.read,
|
|
100
|
+
createPermissions: catalogRoutePermissions.products.create,
|
|
101
|
+
nav: {
|
|
102
|
+
groupId: 'assortment-group',
|
|
103
|
+
linkId: 'link-product-variants',
|
|
104
|
+
menuKey: 'productVariants',
|
|
105
|
+
icon: ScanBarcode,
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
...createCrudRouteDefinitions({
|
|
109
|
+
id: 'collections',
|
|
110
|
+
menuKey: 'collections',
|
|
111
|
+
routes: Routes.collections,
|
|
112
|
+
listElement: () => _jsx(CollectionsListPage, {}),
|
|
113
|
+
detailElement: () => _jsx(CollectionsDetailPage, {}),
|
|
114
|
+
readPermissions: catalogRoutePermissions.collections.read,
|
|
115
|
+
createPermissions: catalogRoutePermissions.collections.create,
|
|
116
|
+
nav: { groupId: 'assortment-group', linkId: 'link-collections', menuKey: 'collections', icon: Folder },
|
|
117
|
+
}),
|
|
118
|
+
...createCrudRouteDefinitions({
|
|
119
|
+
id: 'facets',
|
|
120
|
+
menuKey: 'facets',
|
|
121
|
+
routes: Routes.facets,
|
|
122
|
+
listElement: () => _jsx(FacetsListPage, {}),
|
|
123
|
+
detailElement: () => _jsx(FacetsDetailPage, {}),
|
|
124
|
+
readPermissions: catalogRoutePermissions.facets.read,
|
|
125
|
+
createPermissions: catalogRoutePermissions.facets.create,
|
|
126
|
+
nav: { groupId: 'assortment-group', linkId: 'link-facets', menuKey: 'facets', icon: Tag },
|
|
127
|
+
}),
|
|
128
|
+
{
|
|
129
|
+
id: 'assets.list',
|
|
130
|
+
path: Routes.assets.list,
|
|
131
|
+
element: _jsx(AssetsListPage, {}),
|
|
132
|
+
requiredPermissions: catalogRoutePermissions.assets.read,
|
|
133
|
+
nav: { groupId: 'assortment-group', linkId: 'link-assets', menuKey: 'assets', icon: Images },
|
|
134
|
+
search: { menuKey: 'assets', type: 'list' },
|
|
135
|
+
},
|
|
136
|
+
...createCrudRouteDefinitions({
|
|
137
|
+
id: 'admins',
|
|
138
|
+
menuKey: 'admins',
|
|
139
|
+
routes: Routes.admins,
|
|
140
|
+
listElement: () => _jsx(AdminsListPage, {}),
|
|
141
|
+
detailElement: () => _jsx(AdminsDetailPage, {}),
|
|
142
|
+
readPermissions: [Permission.ReadAdministrator],
|
|
143
|
+
createPermissions: [Permission.CreateAdministrator],
|
|
144
|
+
nav: { groupId: 'users-group', linkId: 'link-admins', menuKey: 'admins', icon: UserCog },
|
|
145
|
+
}),
|
|
146
|
+
{
|
|
147
|
+
id: 'admins.provision',
|
|
148
|
+
path: Routes.admins.provision,
|
|
149
|
+
element: _jsx(AdminsProvisionPage, {}),
|
|
150
|
+
requiredPermissions: [Permission.CreateAdministrator],
|
|
151
|
+
search: { menuKey: 'adminProvision', type: 'new' },
|
|
152
|
+
},
|
|
153
|
+
...createCrudRouteDefinitions({
|
|
154
|
+
id: 'roles',
|
|
155
|
+
menuKey: 'roles',
|
|
156
|
+
routes: Routes.roles,
|
|
157
|
+
listElement: () => _jsx(RolesListPage, {}),
|
|
158
|
+
detailElement: () => _jsx(RolesDetailPage, {}),
|
|
159
|
+
readPermissions: [Permission.ReadAdministrator],
|
|
160
|
+
createPermissions: [Permission.CreateAdministrator],
|
|
161
|
+
nav: { groupId: 'users-group', linkId: 'link-roles', menuKey: 'roles', icon: Users },
|
|
162
|
+
}),
|
|
163
|
+
...createCrudRouteDefinitions({
|
|
164
|
+
id: 'sellers',
|
|
165
|
+
menuKey: 'sellers',
|
|
166
|
+
routes: Routes.sellers,
|
|
167
|
+
listElement: () => _jsx(SellersListPage, {}),
|
|
168
|
+
detailElement: () => _jsx(SellersDetailPage, {}),
|
|
169
|
+
readPermissions: [Permission.ReadSeller],
|
|
170
|
+
createPermissions: [Permission.CreateSeller],
|
|
171
|
+
nav: { groupId: 'users-group', linkId: 'link-sellers', menuKey: 'sellers', icon: Store },
|
|
172
|
+
}),
|
|
173
|
+
...createCrudRouteDefinitions({
|
|
174
|
+
id: 'promotions',
|
|
175
|
+
menuKey: 'promotions',
|
|
176
|
+
routes: Routes.promotions,
|
|
177
|
+
listElement: () => _jsx(PromotionsListPage, {}),
|
|
178
|
+
detailElement: () => _jsx(PromotionsDetailPage, {}),
|
|
179
|
+
readPermissions: [Permission.ReadPromotion],
|
|
180
|
+
createPermissions: [Permission.CreatePromotion],
|
|
181
|
+
nav: { groupId: 'promotions-group', linkId: 'link-promotions', menuKey: 'promotions', icon: BadgePercent },
|
|
182
|
+
}),
|
|
183
|
+
...createCrudRouteDefinitions({
|
|
184
|
+
id: 'paymentMethods',
|
|
185
|
+
menuKey: 'paymentMethods',
|
|
186
|
+
routes: Routes.paymentMethods,
|
|
187
|
+
listElement: () => _jsx(PaymentMethodsListPage, {}),
|
|
188
|
+
detailElement: () => _jsx(PaymentMethodsDetailPage, {}),
|
|
189
|
+
readPermissions: settingsRoutePermissions.paymentMethods.read,
|
|
190
|
+
createPermissions: settingsRoutePermissions.paymentMethods.create,
|
|
191
|
+
nav: {
|
|
192
|
+
groupId: 'shipping-group',
|
|
193
|
+
linkId: 'link-payment-methods',
|
|
194
|
+
menuKey: 'paymentMethods',
|
|
195
|
+
icon: CreditCard,
|
|
196
|
+
},
|
|
197
|
+
}),
|
|
198
|
+
...createCrudRouteDefinitions({
|
|
199
|
+
id: 'shippingMethods',
|
|
200
|
+
menuKey: 'shippingMethods',
|
|
201
|
+
routes: Routes.shippingMethods,
|
|
202
|
+
listElement: () => _jsx(ShippingMethodsListPage, {}),
|
|
203
|
+
detailElement: () => _jsx(ShippingMethodsDetailPage, {}),
|
|
204
|
+
readPermissions: settingsRoutePermissions.shippingMethods.read,
|
|
205
|
+
createPermissions: settingsRoutePermissions.shippingMethods.create,
|
|
206
|
+
nav: {
|
|
207
|
+
groupId: 'shipping-group',
|
|
208
|
+
linkId: 'link-shipping-methods',
|
|
209
|
+
menuKey: 'shippingMethods',
|
|
210
|
+
icon: Truck,
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
...createCrudRouteDefinitions({
|
|
214
|
+
id: 'stockLocations',
|
|
215
|
+
menuKey: 'stock',
|
|
216
|
+
routes: Routes.stockLocations,
|
|
217
|
+
listElement: () => _jsx(StockLocationsListPage, {}),
|
|
218
|
+
detailElement: () => _jsx(StockLocationsDetailPage, {}),
|
|
219
|
+
readPermissions: [Permission.ReadStockLocation],
|
|
220
|
+
createPermissions: [Permission.CreateStockLocation],
|
|
221
|
+
nav: { groupId: 'shipping-group', linkId: 'link-stock', menuKey: 'stock', icon: MapPin },
|
|
222
|
+
}),
|
|
223
|
+
...createCrudRouteDefinitions({
|
|
224
|
+
id: 'channels',
|
|
225
|
+
menuKey: 'channels',
|
|
226
|
+
routes: Routes.channels,
|
|
227
|
+
listElement: () => _jsx(ChannelsListPage, {}),
|
|
228
|
+
detailElement: () => _jsx(ChannelsDetailPage, {}),
|
|
229
|
+
readPermissions: [Permission.ReadChannel],
|
|
230
|
+
createPermissions: [Permission.CreateChannel],
|
|
231
|
+
nav: { groupId: 'settings-group', linkId: 'link-channels', menuKey: 'channels', icon: Globe2 },
|
|
232
|
+
}),
|
|
233
|
+
...createCrudRouteDefinitions({
|
|
234
|
+
id: 'zones',
|
|
235
|
+
menuKey: 'zones',
|
|
236
|
+
routes: Routes.zones,
|
|
237
|
+
listElement: () => _jsx(ZonesListPage, {}),
|
|
238
|
+
detailElement: () => _jsx(ZonesDetailPage, {}),
|
|
239
|
+
readPermissions: settingsRoutePermissions.zones.read,
|
|
240
|
+
createPermissions: settingsRoutePermissions.zones.create,
|
|
241
|
+
nav: { groupId: 'settings-group', linkId: 'link-zones', menuKey: 'zones', icon: Globe },
|
|
242
|
+
}),
|
|
243
|
+
...createCrudRouteDefinitions({
|
|
244
|
+
id: 'countries',
|
|
245
|
+
menuKey: 'countries',
|
|
246
|
+
routes: Routes.countries,
|
|
247
|
+
listElement: () => _jsx(CountriesListPage, {}),
|
|
248
|
+
detailElement: () => _jsx(CountriesDetailPage, {}),
|
|
249
|
+
readPermissions: settingsRoutePermissions.countries.read,
|
|
250
|
+
createPermissions: settingsRoutePermissions.countries.create,
|
|
251
|
+
nav: { groupId: 'settings-group', linkId: 'link-countries', menuKey: 'countries', icon: Flag },
|
|
252
|
+
}),
|
|
253
|
+
...createCrudRouteDefinitions({
|
|
254
|
+
id: 'taxCategories',
|
|
255
|
+
menuKey: 'taxCategories',
|
|
256
|
+
routes: Routes.taxCategories,
|
|
257
|
+
listElement: () => _jsx(TaxCategoriesListPage, {}),
|
|
258
|
+
detailElement: () => _jsx(TaxCategoriesDetailPage, {}),
|
|
259
|
+
readPermissions: settingsRoutePermissions.taxCategories.read,
|
|
260
|
+
createPermissions: settingsRoutePermissions.taxCategories.create,
|
|
261
|
+
nav: {
|
|
262
|
+
groupId: 'settings-group',
|
|
263
|
+
linkId: 'link-tax-categories',
|
|
264
|
+
menuKey: 'taxCategories',
|
|
265
|
+
icon: Coins,
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
...createCrudRouteDefinitions({
|
|
269
|
+
id: 'taxRates',
|
|
270
|
+
menuKey: 'taxRates',
|
|
271
|
+
routes: Routes.taxRates,
|
|
272
|
+
listElement: () => _jsx(TaxRatesListPage, {}),
|
|
273
|
+
detailElement: () => _jsx(TaxRatesDetailPage, {}),
|
|
274
|
+
readPermissions: settingsRoutePermissions.taxRates.read,
|
|
275
|
+
createPermissions: settingsRoutePermissions.taxRates.create,
|
|
276
|
+
nav: { groupId: 'settings-group', linkId: 'link-tax-rates', menuKey: 'taxRates', icon: Percent },
|
|
277
|
+
}),
|
|
278
|
+
{
|
|
279
|
+
id: 'settings.global',
|
|
280
|
+
path: Routes.globalSettings,
|
|
281
|
+
element: _jsx(GlobalSettings, {}),
|
|
282
|
+
requiredPermissions: [Permission.ReadSettings],
|
|
283
|
+
nav: { groupId: 'settings-group', linkId: 'link-global-settings', menuKey: 'globalSettings', icon: Cog },
|
|
284
|
+
search: { menuKey: 'globalSettings', type: 'default' },
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 'system.status',
|
|
288
|
+
path: Routes.status,
|
|
289
|
+
element: _jsx(Status, {}),
|
|
290
|
+
requiredPermissions: [Permission.ReadSystem],
|
|
291
|
+
nav: { groupId: 'settings-group', linkId: 'link-system-status', menuKey: 'systemStatus', icon: Server },
|
|
292
|
+
search: { menuKey: 'systemStatus', type: 'default' },
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 'extensions',
|
|
296
|
+
path: Routes.extensions,
|
|
297
|
+
element: _jsx(Extensions, {}),
|
|
298
|
+
requiredPermissions: [Permission.ReadSettings],
|
|
299
|
+
search: { menuKey: 'extensions', type: 'default' },
|
|
300
|
+
},
|
|
301
|
+
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const switchSelectedChannel = (channel, actions) => {
|
|
2
|
+
actions.clearPermissions();
|
|
3
|
+
actions.selectChannel(channel);
|
|
4
|
+
actions.setPermissionsForChannel(channel.id);
|
|
5
|
+
};
|
|
6
|
+
export const selectPreferredChannel = (channels, retainedChannel, configuredDefaultCode, builtInDefaultCode, forceConfiguredDefault = false) => forceConfiguredDefault
|
|
7
|
+
? channels.find((channel) => channel.code === configuredDefaultCode)
|
|
8
|
+
: (channels.find((channel) => channel.id === retainedChannel?.id) ??
|
|
9
|
+
channels.find((channel) => channel.code === configuredDefaultCode) ??
|
|
10
|
+
channels.find((channel) => channel.code === builtInDefaultCode) ??
|
|
11
|
+
channels[0]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const matchesNavigationPath = (pathname, routePath) => {
|
|
2
|
+
const pathnameSegments = pathname.split('/').filter(Boolean);
|
|
3
|
+
const routeSegments = routePath.split('/').filter(Boolean);
|
|
4
|
+
return (pathnameSegments.length === routeSegments.length &&
|
|
5
|
+
routeSegments.every((segment, index) => segment.startsWith(':') || segment === pathnameSegments[index]));
|
|
6
|
+
};
|
|
7
|
+
export const getRouteFamilyId = (routeId) => routeId.split('.')[0];
|
|
8
|
+
export const getNavigationLinkActivePaths = (route, routes) => {
|
|
9
|
+
const routeFamilyId = getRouteFamilyId(route.id);
|
|
10
|
+
const relatedPaths = routes
|
|
11
|
+
.filter((candidate) => getRouteFamilyId(candidate.id) === routeFamilyId)
|
|
12
|
+
.map((candidate) => candidate.path);
|
|
13
|
+
return [...relatedPaths.filter((path) => !path.includes(':')), ...relatedPaths.filter((path) => path.includes(':'))];
|
|
14
|
+
};
|
|
15
|
+
export const isNavigationLinkActive = (link, pathname) => (link.activePaths?.length ? link.activePaths : [link.href]).some((path) => matchesNavigationPath(pathname, path));
|
|
16
|
+
export const getActiveNavigationLinkIds = (links, pathname) => {
|
|
17
|
+
const exactPathMatches = links.filter((link) => link.href === pathname);
|
|
18
|
+
return exactPathMatches.length > 0
|
|
19
|
+
? exactPathMatches
|
|
20
|
+
: links.filter((link) => isNavigationLinkActive(link, pathname));
|
|
21
|
+
};
|
|
22
|
+
export const getActiveNavigationGroupIds = (links, pathname) => [
|
|
23
|
+
...new Set(getActiveNavigationLinkIds(links, pathname).map((link) => link.groupId)),
|
|
24
|
+
];
|
|
25
|
+
export const insertNavigationLink = (links, link, placement) => {
|
|
26
|
+
if (!placement)
|
|
27
|
+
return [...links, link];
|
|
28
|
+
const index = links.findIndex((item) => item.id === placement.linkId);
|
|
29
|
+
if (index === -1)
|
|
30
|
+
return [...links, link];
|
|
31
|
+
const insertionIndex = placement.where === 'above' ? index : index + 1;
|
|
32
|
+
return [...links.slice(0, insertionIndex), link, ...links.slice(insertionIndex)];
|
|
33
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const hasRequiredPermissions = ({ requiredPermissions, permissionMatch = 'any', userPermissions, }) => {
|
|
2
|
+
if (!requiredPermissions?.length)
|
|
3
|
+
return true;
|
|
4
|
+
if (permissionMatch === 'all') {
|
|
5
|
+
return requiredPermissions.every((permission) => userPermissions.includes(permission));
|
|
6
|
+
}
|
|
7
|
+
return requiredPermissions.some((permission) => userPermissions.includes(permission));
|
|
8
|
+
};
|
|
9
|
+
export const canAccessAdminItem = ({ item, userPermissions, }) => hasRequiredPermissions({ ...item, userPermissions });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { canAccessAdminItem } from './permission-access.js';
|
|
2
|
+
export const getPermittedAdminRoutes = (routes, userPermissions) => routes.filter((route) => canAccessAdminItem({ item: route, userPermissions }));
|
|
3
|
+
export const getDefaultAdminRoute = (routes) => routes.find((route) => route.id === 'dashboard') || routes.find((route) => route.nav) || routes[0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,17 +6,17 @@ export const BrandLogo = ({ isCollapsed = false }) => {
|
|
|
6
6
|
let Logo = null;
|
|
7
7
|
if (isCollapsed) {
|
|
8
8
|
if (typeof collapsed === 'string')
|
|
9
|
-
Logo = _jsx("img", { src: collapsed, alt: "
|
|
9
|
+
Logo = _jsx("img", { src: collapsed, alt: "", className: "size-full object-contain" });
|
|
10
10
|
if (typeof collapsed === 'object')
|
|
11
|
-
Logo = React.cloneElement(collapsed, { className: 'object-contain' });
|
|
11
|
+
Logo = React.cloneElement(collapsed, { className: 'size-full object-contain' });
|
|
12
12
|
}
|
|
13
13
|
if (!isCollapsed) {
|
|
14
14
|
if (typeof full === 'string')
|
|
15
|
-
Logo = _jsx("img", { src: full, alt: "
|
|
15
|
+
Logo = _jsx("img", { src: full, alt: "", className: "size-full object-contain" });
|
|
16
16
|
if (typeof full === 'object')
|
|
17
|
-
Logo = React.cloneElement(full, { className: 'object-contain' });
|
|
17
|
+
Logo = React.cloneElement(full, { className: 'size-full object-contain' });
|
|
18
18
|
}
|
|
19
19
|
if (!Logo)
|
|
20
|
-
return (_jsxs("svg", {
|
|
20
|
+
return (_jsxs("svg", { className: "size-full", viewBox: "0 0 200 60", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [_jsx("defs", { children: _jsxs("filter", { id: "shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [_jsx("feOffset", { result: "offOut", in: "SourceAlpha", dx: "2", dy: "2" }), _jsx("feGaussianBlur", { result: "blurOut", in: "offOut", stdDeviation: "2" }), _jsx("feBlend", { in: "SourceGraphic", in2: "blurOut", mode: "normal" })] }) }), _jsx("text", { x: "50%", y: "50%", textAnchor: "middle", fill: "black", fontSize: "24", fontWeight: "bold", dy: ".3em", children: isCollapsed ? name?.charAt?.(0) : name }), _jsx("text", { x: "50%", y: "50%", textAnchor: "middle", fill: "#ffffff", fontSize: "24", fontWeight: "bold", dy: ".3em", filter: "url(#shadow)", opacity: "0.9", children: isCollapsed ? name?.charAt?.(0) : name })] }));
|
|
21
21
|
return _jsx(_Fragment, { children: Logo });
|
|
22
22
|
};
|