From e6765fc7df472534c9591ef404767a14e7178d02 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 19 Aug 2024 01:52:49 +0200 Subject: [PATCH] [PUI] Add AdminCenter to cmd k (#7908) * Add API bump * [PUI] Add AdminCenter to cmd k Closes https://github.com/invenhost/InvenTree/issues/96 * Revert "Add API bump" This reverts commit 9135e443a9e4fd162c5f03da3b98caf7b5260e04. --- src/frontend/src/defaults/actions.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/frontend/src/defaults/actions.tsx b/src/frontend/src/defaults/actions.tsx index 6a5c570fe1..8f7241aec8 100644 --- a/src/frontend/src/defaults/actions.tsx +++ b/src/frontend/src/defaults/actions.tsx @@ -4,11 +4,13 @@ import { IconHome, IconLink, IconPointer } from '@tabler/icons-react'; import { NavigateFunction } from 'react-router-dom'; import { useLocalState } from '../states/LocalState'; +import { useUserState } from '../states/UserState'; import { aboutInvenTree, docLinks, licenseInfo, serverInfo } from './links'; import { menuItems } from './menuItems'; export function getActions(navigate: NavigateFunction) { const setNavigationOpen = useLocalState((state) => state.setNavigationOpen); + const { user } = useUserState(); const actions: SpotlightActionData[] = [ { @@ -62,5 +64,15 @@ export function getActions(navigate: NavigateFunction) { } ]; + // Staff actions + user?.is_staff && + actions.push({ + id: 'admin-center', + label: t`Admin Center`, + description: t`Go to the Admin Center`, + onClick: () => navigate(menuItems['settings-admin'].link), + leftSection: + }); + return actions; }