mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
[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.
This commit is contained in:
parent
286091c1e5
commit
e6765fc7df
@ -4,11 +4,13 @@ import { IconHome, IconLink, IconPointer } from '@tabler/icons-react';
|
|||||||
import { NavigateFunction } from 'react-router-dom';
|
import { NavigateFunction } from 'react-router-dom';
|
||||||
|
|
||||||
import { useLocalState } from '../states/LocalState';
|
import { useLocalState } from '../states/LocalState';
|
||||||
|
import { useUserState } from '../states/UserState';
|
||||||
import { aboutInvenTree, docLinks, licenseInfo, serverInfo } from './links';
|
import { aboutInvenTree, docLinks, licenseInfo, serverInfo } from './links';
|
||||||
import { menuItems } from './menuItems';
|
import { menuItems } from './menuItems';
|
||||||
|
|
||||||
export function getActions(navigate: NavigateFunction) {
|
export function getActions(navigate: NavigateFunction) {
|
||||||
const setNavigationOpen = useLocalState((state) => state.setNavigationOpen);
|
const setNavigationOpen = useLocalState((state) => state.setNavigationOpen);
|
||||||
|
const { user } = useUserState();
|
||||||
|
|
||||||
const actions: SpotlightActionData[] = [
|
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: <IconLink size="1.2rem" />
|
||||||
|
});
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user