@deenruv/admin-dashboard 1.0.17-dev.4 → 1.0.17-dev.40
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,12 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { capitalizeFirstLetter, cn, Routes, Separator, useServer, useTranslation } from '@deenruv/react-ui-devkit';
|
|
2
|
+
import { cn, Routes, Separator, Tooltip, TooltipContent, TooltipTrigger, useServer, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
4
3
|
import { Puzzle } from 'lucide-react';
|
|
5
4
|
import { NavLink } from 'react-router';
|
|
6
|
-
|
|
5
|
+
import { canAccessAdminItem, useAdminAccess } from "../../access/index.js";
|
|
6
|
+
import { AccountMenu } from './AccountMenu.js';
|
|
7
|
+
export const NavigationFooter = ({ isCollapsed, mode, onNavigate }) => {
|
|
7
8
|
const { t } = useTranslation('common');
|
|
8
|
-
const userPermissions = useServer((
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const userPermissions = useServer((state) => state.userPermissions);
|
|
10
|
+
const { routes } = useAdminAccess();
|
|
11
|
+
const extensionsRoute = routes.find((route) => route.id === 'extensions');
|
|
12
|
+
const canAccessExtensions = !!extensionsRoute && canAccessAdminItem({ item: extensionsRoute, userPermissions });
|
|
13
|
+
const extensionsPath = extensionsRoute?.path || Routes.extensions;
|
|
14
|
+
const version = window.__DEENRUV_SETTINGS__.appVersion;
|
|
15
|
+
const extensionsLink = (_jsx(NavLink, { to: extensionsPath, viewTransition: true, onClick: onNavigate, "aria-label": t('menu.extensions'), className: "sidebar-link group/sidebar-link", children: ({ isActive }) => (_jsxs("span", { className: cn(isCollapsed
|
|
16
|
+
? 'mx-auto flex size-8 items-center justify-center rounded-[4px] text-[var(--sidebar-secondary)] transition-colors hover:bg-[var(--sidebar-hover)] hover:text-[var(--sidebar-ink)]'
|
|
17
|
+
: 'sidebar-row mx-2', 'group-focus-visible/sidebar-link:ring-2 group-focus-visible/sidebar-link:ring-[var(--sidebar-focus)] group-focus-visible/sidebar-link:outline-none', isCollapsed &&
|
|
18
|
+
isActive &&
|
|
19
|
+
'bg-[var(--sidebar-active)] text-[var(--sidebar-active-ink)] shadow-[inset_2px_0_0_var(--sidebar-active-indicator)]'), "data-active": !isCollapsed && isActive, children: [isCollapsed ? (_jsx(Puzzle, { className: "size-4" })) : (_jsx("span", { className: "sidebar-icon-slot", children: _jsx(Puzzle, { className: "size-4" }) })), !isCollapsed && _jsx("span", { className: "truncate", children: t('menu.extensions') })] })) }));
|
|
20
|
+
return (_jsxs("div", { className: "shrink-0 border-t border-[var(--sidebar-hairline)] bg-[var(--sidebar-surface)] py-2 text-xs text-[var(--sidebar-secondary)]", children: [canAccessExtensions && (_jsxs(_Fragment, { children: [isCollapsed ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { className: "flex h-8 items-center justify-center", children: extensionsLink }) }), _jsx(TooltipContent, { side: "right", children: t('menu.extensions') })] })) : (extensionsLink), _jsx(Separator, { className: "my-2 bg-[var(--sidebar-hairline)]" })] })), isCollapsed ? (_jsx("div", { className: "flex justify-center", children: _jsx(AccountMenu, { isCollapsed: true, mode: mode, onNavigate: onNavigate }) })) : (_jsx(AccountMenu, { isCollapsed: false, mode: mode, onNavigate: onNavigate })), isCollapsed ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: "mx-auto mt-2 max-w-10 truncate px-1 text-center text-[10px] text-[var(--sidebar-tertiary)]", children: ["v ", version] }) }), _jsxs(TooltipContent, { side: "right", children: [t('versionAbbreviation'), " ", version] })] })) : (_jsxs("div", { className: "mt-2 flex h-8 items-center gap-1 px-4 text-xs text-[var(--sidebar-tertiary)]", children: [_jsx("span", { children: "Deenruv" }), _jsxs("span", { children: [t('versionAbbreviation'), " ", version] })] }))] }));
|
|
12
21
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, cn, useTranslation } from '@deenruv/react-ui-devkit';
|
|
3
|
+
import { BrandLogo } from "../BrandLogo.js";
|
|
4
|
+
import { Navigation } from './Navigation.js';
|
|
5
|
+
import { NavigationFooter } from './NavigationFooter.js';
|
|
6
|
+
export const SidebarContent = ({ isCollapsed, manuallyOpenGroupIds, mode, onExpand, onOpenGroupIdsChange, onNavigate, onNavigateHome, }) => {
|
|
7
|
+
const { t } = useTranslation('common');
|
|
8
|
+
return (_jsxs("div", { className: "deenruv-sidebar flex h-full min-h-0 flex-col bg-[var(--sidebar-canvas)] text-[var(--sidebar-ink)]", children: [_jsx("div", { className: cn('flex h-16 shrink-0 items-center border-b border-[var(--sidebar-hairline)] px-2 lg:h-[72px]', isCollapsed ? 'justify-center' : 'pr-10'), children: _jsx(Button, { variant: "ghost", className: cn('h-12 rounded-[4px] px-2 text-[var(--sidebar-ink)] hover:bg-[var(--sidebar-hover)] hover:text-[var(--sidebar-ink)] focus-visible:ring-[var(--sidebar-focus)]', isCollapsed ? 'size-8 p-1' : 'w-full justify-start'), onClick: onNavigateHome, "aria-label": t('goToDashboard'), title: t('goToDashboard'), children: _jsx("span", { className: cn('flex shrink-0 items-center justify-center', isCollapsed ? 'size-6' : 'h-10 w-full min-w-0'), children: _jsx(BrandLogo, { isCollapsed: isCollapsed }) }) }) }), _jsx(Navigation, { isCollapsed: isCollapsed, manuallyOpenGroupIds: manuallyOpenGroupIds, onExpand: onExpand, onOpenGroupIdsChange: onOpenGroupIdsChange, onNavigate: onNavigate }), _jsx(NavigationFooter, { isCollapsed: isCollapsed, mode: mode, onNavigate: onNavigate })] }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
export const SIDEBAR_COLLAPSED_STORAGE_KEY = 'deenruv:admin-sidebar:v1:collapsed';
|
|
3
|
+
export const SIDEBAR_GROUPS_STORAGE_KEY = 'deenruv:admin-sidebar:v1:open-groups';
|
|
4
|
+
export const parseStoredCollapsed = (value, fallback = false) => {
|
|
5
|
+
if (value === 'true')
|
|
6
|
+
return true;
|
|
7
|
+
if (value === 'false')
|
|
8
|
+
return false;
|
|
9
|
+
return fallback;
|
|
10
|
+
};
|
|
11
|
+
export const parseStoredGroupIds = (value) => {
|
|
12
|
+
if (!value)
|
|
13
|
+
return [];
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(value);
|
|
16
|
+
return Array.isArray(parsed) ? [...new Set(parsed.filter((id) => typeof id === 'string'))] : [];
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const mergeOpenGroupIds = (storedGroupIds, activeGroupIds) => [
|
|
23
|
+
...new Set([...storedGroupIds, ...activeGroupIds]),
|
|
24
|
+
];
|
|
25
|
+
export const readSidebarStorage = (key) => {
|
|
26
|
+
try {
|
|
27
|
+
return window.localStorage.getItem(key);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const writeSidebarStorage = (key, value) => {
|
|
34
|
+
try {
|
|
35
|
+
window.localStorage.setItem(key, value);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Navigation remains usable when browser storage is unavailable.
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const getInitialCollapsed = () => typeof window === 'undefined' ? false : parseStoredCollapsed(readSidebarStorage(SIDEBAR_COLLAPSED_STORAGE_KEY));
|
|
42
|
+
const getInitialOpenGroupIds = () => typeof window === 'undefined' ? [] : parseStoredGroupIds(readSidebarStorage(SIDEBAR_GROUPS_STORAGE_KEY));
|
|
43
|
+
export const useSidebarState = () => {
|
|
44
|
+
const [isCollapsed, setIsCollapsedState] = useState(getInitialCollapsed);
|
|
45
|
+
const [isMobileOpen, setIsMobileOpen] = useState(false);
|
|
46
|
+
const [manuallyOpenGroupIds, setManuallyOpenGroupIdsState] = useState(getInitialOpenGroupIds);
|
|
47
|
+
const setIsCollapsed = useCallback((collapsed) => {
|
|
48
|
+
setIsCollapsedState(collapsed);
|
|
49
|
+
writeSidebarStorage(SIDEBAR_COLLAPSED_STORAGE_KEY, String(collapsed));
|
|
50
|
+
}, []);
|
|
51
|
+
const toggleDesktop = useCallback(() => {
|
|
52
|
+
setIsCollapsedState((collapsed) => {
|
|
53
|
+
const nextCollapsed = !collapsed;
|
|
54
|
+
writeSidebarStorage(SIDEBAR_COLLAPSED_STORAGE_KEY, String(nextCollapsed));
|
|
55
|
+
return nextCollapsed;
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
58
|
+
const setManuallyOpenGroupIds = useCallback((groupIds) => {
|
|
59
|
+
const nextGroupIds = [...new Set(groupIds)];
|
|
60
|
+
setManuallyOpenGroupIdsState(nextGroupIds);
|
|
61
|
+
writeSidebarStorage(SIDEBAR_GROUPS_STORAGE_KEY, JSON.stringify(nextGroupIds));
|
|
62
|
+
}, []);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const handleShortcut = (event) => {
|
|
65
|
+
const target = event.target;
|
|
66
|
+
const isEditable = target instanceof HTMLElement &&
|
|
67
|
+
(target.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName));
|
|
68
|
+
if (event.key.toLowerCase() !== 'b' ||
|
|
69
|
+
(!event.metaKey && !event.ctrlKey) ||
|
|
70
|
+
event.altKey ||
|
|
71
|
+
event.shiftKey ||
|
|
72
|
+
isEditable) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
if (window.matchMedia('(min-width: 768px)').matches)
|
|
77
|
+
toggleDesktop();
|
|
78
|
+
else
|
|
79
|
+
setIsMobileOpen((open) => !open);
|
|
80
|
+
};
|
|
81
|
+
window.addEventListener('keydown', handleShortcut);
|
|
82
|
+
return () => window.removeEventListener('keydown', handleShortcut);
|
|
83
|
+
}, [toggleDesktop]);
|
|
84
|
+
return {
|
|
85
|
+
isCollapsed,
|
|
86
|
+
isMobileOpen,
|
|
87
|
+
manuallyOpenGroupIds,
|
|
88
|
+
setIsCollapsed,
|
|
89
|
+
setIsMobileOpen,
|
|
90
|
+
setManuallyOpenGroupIds,
|
|
91
|
+
toggleDesktop,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Popover, PopoverContent, PopoverTrigger, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
3
|
+
import { SlidersHorizontal } from 'lucide-react';
|
|
4
|
+
import { ChannelSwitcher } from './ChannelSwitcher.js';
|
|
5
|
+
import { LanguagesDropdown } from './LanguagesDropdown.js';
|
|
6
|
+
export const TopbarOverflow = ({ components, showChannelPicker, showLanguagePicker }) => {
|
|
7
|
+
const { t } = useTranslation('common');
|
|
8
|
+
if (components.length === 0 && !showChannelPicker && !showLanguagePicker)
|
|
9
|
+
return null;
|
|
10
|
+
return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "icon", className: "size-9 shrink-0 lg:hidden", "aria-label": t('openTopbarControls'), title: t('openTopbarControls'), children: _jsx(SlidersHorizontal, { className: "size-4" }) }) }), _jsx(PopoverContent, { align: "end", className: "z-[2138] w-[min(20rem,calc(100vw-2rem))] p-3 lg:hidden", children: _jsxs("div", { className: "flex flex-col gap-3", children: [components.length > 0 && (_jsx("div", { className: `flex flex-wrap items-center gap-2 ${showChannelPicker || showLanguagePicker ? 'border-b pb-3' : ''}`, children: components.map(({ component: Component }, index) => (_jsx(Component, {}, index))) })), showChannelPicker || showLanguagePicker ? (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [showLanguagePicker ? _jsx(LanguagesDropdown, {}) : null, showChannelPicker ? _jsx(ChannelSwitcher, { className: "min-w-0 flex-1" }) : null] })) : null] }) })] }));
|
|
11
|
+
};
|
|
@@ -1,66 +1,78 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import React, { useMemo
|
|
3
|
-
import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbSeparator, Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, ScrollArea, TooltipProvider, Routes, useSettings, useServer, usePluginStore, cn, dashToCamelCase, apiClient, useGlobalSearch, useTranslation, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuPortal, DropdownMenuSubContent, createDialog, buildURL, } from '@deenruv/react-ui-devkit';
|
|
4
|
-
import { useShallow } from 'zustand/react/shallow';
|
|
5
|
-
import { GripVertical, LogOutIcon, MenuIcon, Moon, Slash, Sun, SunMoon, RotateCwSquare, SearchIcon, } from 'lucide-react';
|
|
6
|
-
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
7
|
-
import { Navigation } from './Navigation.js';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
8
3
|
import { NavLink, useMatches, useNavigate } from 'react-router';
|
|
4
|
+
import { Breadcrumb, BreadcrumbItem, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, cn, dashToCamelCase, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, ScrollArea, Sheet, SheetContent, SheetDescription, SheetTitle, TooltipProvider, Routes, useGlobalSearch, usePluginStore, useServer, useSettings, useTranslation, } from '@deenruv/react-ui-devkit';
|
|
5
|
+
import { MenuIcon, Moon, PanelLeftClose, PanelLeftOpen, SearchIcon, Slash, Sun, SunMoon } from 'lucide-react';
|
|
6
|
+
import { adminNavigationGroups, canAccessAdminItem, useAdminAccess } from "../../access/index.js";
|
|
9
7
|
import { ChannelSwitcher } from './ChannelSwitcher.js';
|
|
10
|
-
import {
|
|
8
|
+
import { buildMenuBreadcrumbs } from './Breadcrumbs.js';
|
|
11
9
|
import { LanguagesDropdown } from './LanguagesDropdown.js';
|
|
12
10
|
import { Notifications } from './Notifications.js';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const ResizableHandle = ({ withHandle, className, ...props }) => (_jsx(ResizablePrimitive.Separator, { className: cn('relative flex w-px items-center justify-center bg-border/70 after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:translate-x-0 data-[orientation=vertical]:after:-translate-y-1/2 [&[data-orientation=vertical]>div]:rotate-90', className), ...props, children: withHandle && (_jsx("div", { className: "z-10 flex h-4 w-3 items-center justify-center border bg-background text-muted-foreground", children: _jsx(GripVertical, { className: "size-2.5" }) })) }));
|
|
11
|
+
import { SidebarContent } from './SidebarContent.js';
|
|
12
|
+
import { useSidebarState } from './SidebarState.js';
|
|
13
|
+
import { TopbarOverflow } from './TopbarOverflow.js';
|
|
17
14
|
const removableCrumbs = ['draft', 'admin-ui'];
|
|
18
15
|
export const Menu = ({ children }) => {
|
|
19
|
-
const openGlobalSearch = useGlobalSearch((state) => state.open);
|
|
20
|
-
const linkPath = [];
|
|
21
16
|
const { t } = useTranslation('common');
|
|
22
|
-
const {
|
|
23
|
-
const { logOut, theme, setTheme } = useSettings(useShallow((p) => ({
|
|
24
|
-
logOut: p.logOut,
|
|
25
|
-
theme: p.theme,
|
|
26
|
-
setTheme: p.setTheme,
|
|
27
|
-
language: p.language,
|
|
28
|
-
setLanguage: p.setLanguage,
|
|
29
|
-
})));
|
|
17
|
+
const { t: pluginTranslation } = useTranslation();
|
|
30
18
|
const navigate = useNavigate();
|
|
31
|
-
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
32
|
-
const { activeAdministrator, setJobQueue } = useServer();
|
|
33
|
-
const rebuildSearchIndex = async () => {
|
|
34
|
-
await apiClient('mutation')({ reindex: { id: true, queueName: true, state: true } }).then(({ reindex: { queueName, state } }) => {
|
|
35
|
-
setJobQueue(queueName, state === 'RUNNING');
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
19
|
const matches = useMatches();
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
20
|
+
const openGlobalSearch = useGlobalSearch((state) => state.open);
|
|
21
|
+
const { navMenuData, topNavigationComponents } = usePluginStore();
|
|
22
|
+
const { defaultRoute, routes } = useAdminAccess();
|
|
23
|
+
const userPermissions = useServer((state) => state.userPermissions);
|
|
24
|
+
const { theme, setTheme } = useSettings();
|
|
25
|
+
const showChannelPicker = window.__DEENRUV_SETTINGS__.ui?.showChannelPicker !== false;
|
|
26
|
+
const showLanguagePicker = window.__DEENRUV_SETTINGS__.ui?.showLanguagePicker !== false;
|
|
27
|
+
const { isCollapsed, isMobileOpen, manuallyOpenGroupIds, setIsCollapsed, setIsMobileOpen, setManuallyOpenGroupIds, toggleDesktop, } = useSidebarState();
|
|
28
|
+
const defaultRoutePath = defaultRoute?.path || Routes.dashboard;
|
|
29
|
+
const defaultRouteMenuKey = defaultRoute?.nav?.menuKey || defaultRoute?.search?.menuKey || 'dashboard';
|
|
30
|
+
const allowedTopNavigationComponents = topNavigationComponents?.filter((entry) => canAccessAdminItem({ item: entry.access, userPermissions }));
|
|
31
|
+
const pathname = matches.at(-1)?.pathname || '';
|
|
32
|
+
const crumbSegments = pathname.split('/').filter(Boolean);
|
|
33
|
+
const pluginT = (translation) => {
|
|
34
|
+
const [namespace = '', ...keyParts] = translation.split('.');
|
|
35
|
+
return pluginTranslation(keyParts.join('.'), { ns: namespace });
|
|
36
|
+
};
|
|
37
|
+
const crumbs = useMemo(() => {
|
|
38
|
+
const groups = [
|
|
39
|
+
...adminNavigationGroups.map((group) => ({
|
|
40
|
+
id: group.id,
|
|
41
|
+
label: t(`menuGroups.${group.labelKey}`),
|
|
42
|
+
permitted: true,
|
|
43
|
+
})),
|
|
44
|
+
...navMenuData.groups.map((group) => ({
|
|
45
|
+
id: group.id,
|
|
46
|
+
label: pluginT(group.labelId),
|
|
47
|
+
permitted: canAccessAdminItem({ item: group.access, userPermissions }),
|
|
48
|
+
})),
|
|
49
|
+
];
|
|
50
|
+
const links = navMenuData.links.map((link) => ({
|
|
51
|
+
href: link.href,
|
|
52
|
+
groupId: link.groupId,
|
|
53
|
+
label: pluginT(link.labelId),
|
|
54
|
+
permitted: canAccessAdminItem({ item: link.access, userPermissions }),
|
|
55
|
+
}));
|
|
56
|
+
const extensionsRoute = routes.find((route) => route.id === 'extensions');
|
|
57
|
+
return buildMenuBreadcrumbs({
|
|
58
|
+
pathname,
|
|
59
|
+
groups,
|
|
60
|
+
links,
|
|
61
|
+
extensions: {
|
|
62
|
+
label: t('menu.extensions'),
|
|
63
|
+
href: extensionsRoute?.path || '/admin-ui/extensions',
|
|
64
|
+
permitted: canAccessAdminItem({ item: extensionsRoute, userPermissions }),
|
|
65
|
+
},
|
|
66
|
+
fallbackLabels: crumbSegments.map((crumb) => removableCrumbs.includes(crumb) ? '' : t(`menu.${dashToCamelCase(crumb)}`, { defaultValue: crumb })),
|
|
67
|
+
});
|
|
68
|
+
}, [navMenuData.groups, navMenuData.links, pathname, pluginTranslation, routes, t, userPermissions]);
|
|
69
|
+
const navigateHome = () => navigate(defaultRoutePath, { viewTransition: true });
|
|
70
|
+
return (_jsx(TooltipProvider, { delayDuration: 100, children: _jsxs("div", { className: "flex h-screen w-full overflow-hidden bg-[var(--sidebar-canvas)]", children: [_jsx("aside", { "data-collapsed": isCollapsed, className: cn('hidden h-full shrink-0 border-r border-[var(--sidebar-hairline)] bg-[var(--sidebar-canvas)] transition-[width] duration-300 ease-out motion-reduce:transition-none md:block', isCollapsed ? 'w-12' : 'w-64'), "aria-label": t('mainNavigation'), children: _jsx(SidebarContent, { isCollapsed: isCollapsed, manuallyOpenGroupIds: manuallyOpenGroupIds, mode: "desktop", onExpand: () => setIsCollapsed(false), onOpenGroupIdsChange: setManuallyOpenGroupIds, onNavigate: () => undefined, onNavigateHome: navigateHome }) }), _jsx(Sheet, { open: isMobileOpen, onOpenChange: setIsMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 max-w-[calc(100vw-1rem)] border-[var(--sidebar-hairline)] bg-[var(--sidebar-canvas)] p-0 sm:max-w-72 [&>button]:rounded-[4px] [&>button]:text-[var(--sidebar-secondary)] [&>button]:focus:ring-[var(--sidebar-focus)] [&>button]:data-[state=open]:bg-[var(--sidebar-hover)]", children: [_jsx(SheetTitle, { className: "sr-only", children: t('mainNavigation') }), _jsx(SheetDescription, { className: "sr-only", children: t('mobileNavigationDescription') }), _jsx(SidebarContent, { isCollapsed: false, manuallyOpenGroupIds: manuallyOpenGroupIds, mode: "mobile", onExpand: () => undefined, onOpenGroupIdsChange: setManuallyOpenGroupIds, onNavigate: () => setIsMobileOpen(false), onNavigateHome: () => {
|
|
71
|
+
navigateHome();
|
|
72
|
+
setIsMobileOpen(false);
|
|
73
|
+
} })] }) }), _jsxs("main", { className: "flex min-w-0 flex-1 flex-col bg-[var(--sidebar-canvas)]", children: [_jsxs("header", { className: "flex h-16 shrink-0 items-center gap-2 border-b border-[var(--sidebar-hairline)] bg-[var(--sidebar-canvas)] px-3 lg:h-[72px] lg:px-5", children: [_jsx(Button, { variant: "outline", size: "icon", className: "size-9 shrink-0 md:hidden", onClick: () => setIsMobileOpen(true), "aria-label": t('openSidebar'), title: t('openSidebar'), children: _jsx(MenuIcon, { className: "size-4" }) }), _jsx(Button, { variant: "outline", size: "icon", className: "hidden size-9 shrink-0 md:inline-flex", onClick: toggleDesktop, "aria-label": isCollapsed ? t('expandSidebar') : t('collapseSidebar'), title: `${isCollapsed ? t('expandSidebar') : t('collapseSidebar')} (${t('sidebarShortcut')})`, children: isCollapsed ? _jsx(PanelLeftOpen, { className: "size-4" }) : _jsx(PanelLeftClose, { className: "size-4" }) }), _jsx("div", { className: "hidden min-w-0 flex-col items-start justify-center sm:flex", children: _jsx(Breadcrumb, { children: _jsx(BreadcrumbList, { className: "flex-nowrap overflow-hidden", children: crumbs.length ? (crumbs.map((crumb, index) => {
|
|
74
|
+
return (_jsxs(React.Fragment, { children: [_jsx(BreadcrumbItem, { className: "min-w-0", children: crumb.current ? (_jsx(BreadcrumbPage, { className: "truncate text-sm font-semibold tracking-tight", children: crumb.label })) : crumb.href ? (_jsx(NavLink, { to: crumb.href, viewTransition: true, className: "truncate", children: _jsx("span", { className: "text-sm font-semibold tracking-tight text-foreground", children: crumb.label }) })) : (_jsx("span", { className: "truncate text-sm font-semibold tracking-tight text-muted-foreground", children: crumb.label })) }), index !== crumbs.length - 1 && (_jsx(BreadcrumbSeparator, { children: _jsx(Slash, { className: "text-muted-foreground" }) }))] }, `${crumb.label}-${index}`));
|
|
75
|
+
})) : (_jsx(BreadcrumbItem, { children: _jsx(BreadcrumbPage, { className: "text-lg font-semibold tracking-tight", children: t(defaultRouteMenuKey === 'dashboard'
|
|
76
|
+
? 'dashboard'
|
|
77
|
+
: `menu.${dashToCamelCase(defaultRouteMenuKey)}`) }) })) }) }) }), _jsxs("div", { className: "ml-auto flex min-w-0 items-center justify-end gap-1.5", children: [_jsx(TopbarOverflow, { components: allowedTopNavigationComponents || [], showChannelPicker: showChannelPicker, showLanguagePicker: showLanguagePicker }), allowedTopNavigationComponents?.length ? (_jsx("div", { className: "hidden items-center gap-2 lg:flex", children: allowedTopNavigationComponents.map(({ component: Component }, index) => (_jsx(Component, {}, index))) })) : null, showChannelPicker || showLanguagePicker ? (_jsxs("div", { className: "hidden items-center gap-1.5 lg:flex", children: [showLanguagePicker ? _jsx(LanguagesDropdown, {}) : null, showChannelPicker ? _jsx(ChannelSwitcher, { className: "min-w-44" }) : null] })) : null, _jsx(Button, { onClick: openGlobalSearch, variant: "outline", size: "icon", className: "relative size-9 shrink-0", "aria-label": t('openGlobalSearch'), title: t('openGlobalSearch'), children: _jsx(SearchIcon, { className: "size-4" }) }), _jsx(Notifications, {}), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "icon", className: "relative size-9 shrink-0", children: [theme === 'light' ? (_jsx(Sun, { className: "size-[1.2rem]" })) : theme === 'dark' ? (_jsx(Moon, { className: "size-[1.2rem]" })) : (_jsx(SunMoon, { className: "size-[1.2rem]" })), _jsx("span", { className: "sr-only", children: t('toggleTheme') })] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuItem, { onClick: () => setTheme('light'), children: t('themeLight') }), _jsx(DropdownMenuItem, { onClick: () => setTheme('dark'), children: t('themeDark') }), _jsx(DropdownMenuItem, { onClick: () => setTheme('system'), children: t('themeSystem') })] })] })] })] }), _jsx(ScrollArea, { className: "relative min-h-0 flex-1 overflow-y-hidden bg-[var(--sidebar-canvas)]", children: children })] })] }) }));
|
|
66
78
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, SimpleTooltip } from '@deenruv/react-ui-devkit';
|
|
3
|
+
import { ExternalLink } from 'lucide-react';
|
|
4
|
+
export const StorefrontAction = ({ label, state }) => {
|
|
5
|
+
if (state.kind === 'ready') {
|
|
6
|
+
return (_jsx(Button, { asChild: true, variant: "secondary", size: "sm", children: _jsxs("a", { href: state.url, target: "_blank", rel: "noopener noreferrer", className: "gap-2", children: [_jsx(ExternalLink, { className: "size-4", "aria-hidden": "true" }), label] }) }));
|
|
7
|
+
}
|
|
8
|
+
return (_jsx(SimpleTooltip, { content: state.tooltip, children: _jsxs(Button, { type: "button", variant: "secondary", size: "sm", className: "gap-2", disabled: true, children: [_jsx(ExternalLink, { className: "size-4", "aria-hidden": "true" }), label] }) }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const getStorefrontEntityUrlState = (context, resolver) => {
|
|
2
|
+
let resolvedUrl;
|
|
3
|
+
try {
|
|
4
|
+
resolvedUrl = resolver(context);
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return { kind: 'disabled', reason: 'resolverFailed' };
|
|
8
|
+
}
|
|
9
|
+
if (resolvedUrl === undefined)
|
|
10
|
+
return { kind: 'hidden' };
|
|
11
|
+
if (resolvedUrl === null)
|
|
12
|
+
return { kind: 'disabled', reason: 'resolverEmpty' };
|
|
13
|
+
let urlString;
|
|
14
|
+
let protocol;
|
|
15
|
+
try {
|
|
16
|
+
const url = new globalThis.URL(resolvedUrl);
|
|
17
|
+
urlString = url.href;
|
|
18
|
+
protocol = url.protocol;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return { kind: 'disabled', reason: 'urlNotAbsolute' };
|
|
22
|
+
}
|
|
23
|
+
if (protocol !== 'http:' && protocol !== 'https:') {
|
|
24
|
+
return { kind: 'disabled', reason: 'unsupportedProtocol' };
|
|
25
|
+
}
|
|
26
|
+
return { kind: 'ready', url: urlString };
|
|
27
|
+
};
|
package/dist/graphql/scalars.js
CHANGED
package/dist/index.css
CHANGED
|
@@ -59,6 +59,18 @@
|
|
|
59
59
|
|
|
60
60
|
--navigation-link: hsl(228 14% 28%);
|
|
61
61
|
|
|
62
|
+
--sidebar-canvas: #fbfbf5;
|
|
63
|
+
--sidebar-surface: #ffffff;
|
|
64
|
+
--sidebar-ink: #000000;
|
|
65
|
+
--sidebar-secondary: #71717a;
|
|
66
|
+
--sidebar-tertiary: #52525b;
|
|
67
|
+
--sidebar-hairline: #e4e4e7;
|
|
68
|
+
--sidebar-hover: #ffffff;
|
|
69
|
+
--sidebar-active: #d4f9e0;
|
|
70
|
+
--sidebar-active-ink: #000000;
|
|
71
|
+
--sidebar-active-indicator: #000000;
|
|
72
|
+
--sidebar-focus: #000000;
|
|
73
|
+
|
|
62
74
|
--topbar-height: 64px;
|
|
63
75
|
--topbar-height-lg: 72px;
|
|
64
76
|
|
|
@@ -104,6 +116,18 @@
|
|
|
104
116
|
--warning-foreground: hsl(38 92% 50%);
|
|
105
117
|
|
|
106
118
|
--navigation-link: hsl(220 18% 86%);
|
|
119
|
+
|
|
120
|
+
--sidebar-canvas: #000000;
|
|
121
|
+
--sidebar-surface: #0a0a0a;
|
|
122
|
+
--sidebar-ink: #ffffff;
|
|
123
|
+
--sidebar-secondary: #a1a1aa;
|
|
124
|
+
--sidebar-tertiary: #9dabad;
|
|
125
|
+
--sidebar-hairline: #1e2c31;
|
|
126
|
+
--sidebar-hover: #0a0a0a;
|
|
127
|
+
--sidebar-active: #1e2c31;
|
|
128
|
+
--sidebar-active-ink: #ffffff;
|
|
129
|
+
--sidebar-active-indicator: #ffffff;
|
|
130
|
+
--sidebar-focus: #bdbdca;
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
@theme inline {
|
|
@@ -236,6 +260,47 @@ a {
|
|
|
236
260
|
text-decoration: none;
|
|
237
261
|
}
|
|
238
262
|
|
|
263
|
+
.deenruv-sidebar a.sidebar-link {
|
|
264
|
+
display: block;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.deenruv-sidebar .sidebar-row {
|
|
268
|
+
display: flex;
|
|
269
|
+
height: 36px;
|
|
270
|
+
min-height: 36px;
|
|
271
|
+
align-items: center;
|
|
272
|
+
gap: 8px;
|
|
273
|
+
padding: 0 8px;
|
|
274
|
+
border-radius: 4px;
|
|
275
|
+
color: var(--sidebar-secondary);
|
|
276
|
+
font-size: 14px;
|
|
277
|
+
font-weight: 500;
|
|
278
|
+
line-height: 20px;
|
|
279
|
+
transition:
|
|
280
|
+
color 150ms ease,
|
|
281
|
+
background-color 150ms ease;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.deenruv-sidebar .sidebar-row:hover {
|
|
285
|
+
background-color: var(--sidebar-hover);
|
|
286
|
+
color: var(--sidebar-ink);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.deenruv-sidebar .sidebar-row[data-active="true"] {
|
|
290
|
+
background-color: var(--sidebar-active);
|
|
291
|
+
color: var(--sidebar-active-ink);
|
|
292
|
+
box-shadow: inset 2px 0 0 var(--sidebar-active-indicator);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.deenruv-sidebar .sidebar-icon-slot {
|
|
296
|
+
display: flex;
|
|
297
|
+
width: 20px;
|
|
298
|
+
height: 20px;
|
|
299
|
+
flex: 0 0 20px;
|
|
300
|
+
align-items: center;
|
|
301
|
+
justify-content: center;
|
|
302
|
+
}
|
|
303
|
+
|
|
239
304
|
.Puck > div:nth-child(1) {
|
|
240
305
|
position: relative !important;
|
|
241
306
|
}
|
|
@@ -32,6 +32,68 @@
|
|
|
32
32
|
"placeholder": "Adding roles to a user"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
+
"provision": {
|
|
36
|
+
"action": "Create with role",
|
|
37
|
+
"title": "Create administrator with role",
|
|
38
|
+
"description": "Use a business preset to create a role and assign it to a new administrator in one flow.",
|
|
39
|
+
"submit": "Create administrator",
|
|
40
|
+
"submitting": "Creating...",
|
|
41
|
+
"admin": {
|
|
42
|
+
"title": "Administrator account",
|
|
43
|
+
"description": "Credentials and contact details for the new administrator."
|
|
44
|
+
},
|
|
45
|
+
"role": {
|
|
46
|
+
"title": "Role setup",
|
|
47
|
+
"description": "Create a new role from the selected preset or reuse an existing role by code.",
|
|
48
|
+
"code": "Role code",
|
|
49
|
+
"descriptionLabel": "Role name",
|
|
50
|
+
"reuseExisting": "Use existing role with this code",
|
|
51
|
+
"reuseExistingHint": "When enabled, permissions and channels below are ignored and the administrator gets the existing role.",
|
|
52
|
+
"channels": "Channels",
|
|
53
|
+
"channelsPlaceholder": "Add channel"
|
|
54
|
+
},
|
|
55
|
+
"permissions": {
|
|
56
|
+
"title": "Permissions",
|
|
57
|
+
"description": "Review the preset and tweak permissions before creating the role.",
|
|
58
|
+
"reuseExisting": "Permissions are taken from the existing role when reuse mode is enabled."
|
|
59
|
+
},
|
|
60
|
+
"presets": {
|
|
61
|
+
"title": "Business preset",
|
|
62
|
+
"description": "Start from a safe operational role and adjust it if needed.",
|
|
63
|
+
"defaultBadge": "Default",
|
|
64
|
+
"backendNote": "The backend still enforces every permission. This wizard only provisions roles and administrator accounts.",
|
|
65
|
+
"shopManager": {
|
|
66
|
+
"title": "Shop manager",
|
|
67
|
+
"description": "Order handling, customer support, catalog visibility, payment/shipping lookup and stock-location visibility.",
|
|
68
|
+
"roleDescription": "Shop manager"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"summary": {
|
|
72
|
+
"title": "Summary",
|
|
73
|
+
"description": "What will be submitted.",
|
|
74
|
+
"role": "Role",
|
|
75
|
+
"channels": "Channels",
|
|
76
|
+
"permissions": "Permissions",
|
|
77
|
+
"mode": "Mode",
|
|
78
|
+
"create": "Create role",
|
|
79
|
+
"reuse": "Reuse role"
|
|
80
|
+
},
|
|
81
|
+
"validation": {
|
|
82
|
+
"emailRequired": "Email is required",
|
|
83
|
+
"emailInvalid": "Enter a valid email address",
|
|
84
|
+
"roleCodeRequired": "Role code is required",
|
|
85
|
+
"channelsRequired": "Select at least one channel",
|
|
86
|
+
"permissionsRequired": "Select at least one permission",
|
|
87
|
+
"roleCodeExists": "A role with this code already exists. Enable reuse or choose another code.",
|
|
88
|
+
"roleNotFound": "No existing role with this code was found."
|
|
89
|
+
},
|
|
90
|
+
"toasts": {
|
|
91
|
+
"success": "Administrator and role were created successfully",
|
|
92
|
+
"error": "Could not create administrator with role",
|
|
93
|
+
"roleCodeExists": "A role with this code already exists",
|
|
94
|
+
"roleNotFound": "No existing role with this code was found"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
35
97
|
"toasts": {
|
|
36
98
|
"adminLoadingError": "Failed to load administrator with ID {{value}}",
|
|
37
99
|
"adminUpdateSuccess": "Administrator successfully updated",
|
|
@@ -7,6 +7,20 @@
|
|
|
7
7
|
"baseInfoUpdated": "Updated: {{value}}",
|
|
8
8
|
"buttonDisabledTooltip": "Fill in all required fields",
|
|
9
9
|
"noChangesTooltip": "No changes have been made",
|
|
10
|
+
"storefrontAction": {
|
|
11
|
+
"label": "Open in storefront",
|
|
12
|
+
"disabled": {
|
|
13
|
+
"collectionPrivate": "Make the collection public and save it before opening it in the storefront.",
|
|
14
|
+
"missingChannel": "Select a channel before opening the collection in the storefront.",
|
|
15
|
+
"missingSlug": "The saved collection has no slug for the selected language.",
|
|
16
|
+
"unsavedPrivate": "Save the current visibility before opening the collection in the storefront.",
|
|
17
|
+
"unsavedSlug": "Save the current slug before opening the collection in the storefront.",
|
|
18
|
+
"resolverFailed": "The storefront URL could not be resolved.",
|
|
19
|
+
"resolverEmpty": "The storefront URL resolver returned no URL.",
|
|
20
|
+
"urlNotAbsolute": "The storefront URL must be absolute.",
|
|
21
|
+
"unsupportedProtocol": "The storefront URL must use HTTP or HTTPS."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
10
24
|
"table": {
|
|
11
25
|
"id": "Id",
|
|
12
26
|
"name": "Name",
|