mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-09 21:30:54 +00:00
misc fixes
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { ActionIcon, Group, useMantineColorScheme } from '@mantine/core';
|
import { ActionIcon, Group, useMantineColorScheme } from '@mantine/core';
|
||||||
import { IconMoonStars, IconSun } from '@tabler/icons-react';
|
import { IconMoonStars, IconSun } from '@tabler/icons-react';
|
||||||
|
|
||||||
|
import { vars } from '../../theme';
|
||||||
|
|
||||||
export function ColorToggle() {
|
export function ColorToggle() {
|
||||||
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
||||||
|
|
||||||
@@ -9,12 +11,10 @@ export function ColorToggle() {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
onClick={() => toggleColorScheme()}
|
onClick={() => toggleColorScheme()}
|
||||||
size="lg"
|
size="lg"
|
||||||
sx={(theme) => ({
|
style={{
|
||||||
color:
|
color:
|
||||||
theme.colorScheme === 'dark'
|
colorScheme === 'dark' ? vars.colors.yellow[4] : vars.colors.blue[6]
|
||||||
? theme.colors.yellow[4]
|
}}
|
||||||
: theme.colors.blue[6]
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
{colorScheme === 'dark' ? <IconSun /> : <IconMoonStars />}
|
{colorScheme === 'dark' ? <IconSun /> : <IconMoonStars />}
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import type { SpotlightAction } from '@mantine/spotlight';
|
import type { SpotlightAction, SpotlightActionData } from '@mantine/spotlight';
|
||||||
import { IconHome, IconLink, IconPointer } from '@tabler/icons-react';
|
import { IconHome, IconLink, IconPointer } from '@tabler/icons-react';
|
||||||
import { NavigateFunction } from 'react-router-dom';
|
import { NavigateFunction } from 'react-router-dom';
|
||||||
|
|
||||||
@@ -10,48 +10,55 @@ 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 actions: SpotlightAction[] = [
|
const actions: SpotlightActionData[] = [
|
||||||
{
|
{
|
||||||
|
id: 'home',
|
||||||
title: t`Home`,
|
title: t`Home`,
|
||||||
description: `Go to the home page`,
|
description: `Go to the home page`,
|
||||||
onTrigger: () => navigate(menuItems.home.link),
|
onClick: () => navigate(menuItems.home.link),
|
||||||
icon: <IconHome size="1.2rem" />
|
leftSection: <IconHome size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'dashboard',
|
||||||
title: t`Dashboard`,
|
title: t`Dashboard`,
|
||||||
description: t`Go to the InvenTree dashboard`,
|
description: t`Go to the InvenTree dashboard`,
|
||||||
onTrigger: () => navigate(menuItems.dashboard.link),
|
onClick: () => navigate(menuItems.dashboard.link),
|
||||||
icon: <IconLink size="1.2rem" />
|
leftSection: <IconLink size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'documentation',
|
||||||
title: t`Documentation`,
|
title: t`Documentation`,
|
||||||
description: t`Visit the documentation to learn more about InvenTree`,
|
description: t`Visit the documentation to learn more about InvenTree`,
|
||||||
onTrigger: () => (window.location.href = docLinks.faq),
|
onClick: () => (window.location.href = docLinks.faq),
|
||||||
icon: <IconLink size="1.2rem" />
|
leftSection: <IconLink size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'about',
|
||||||
title: t`About InvenTree`,
|
title: t`About InvenTree`,
|
||||||
description: t`About the InvenTree org`,
|
description: t`About the InvenTree org`,
|
||||||
onTrigger: () => aboutInvenTree(),
|
onClick: () => aboutInvenTree(),
|
||||||
icon: <IconLink size="1.2rem" />
|
leftSection: <IconLink size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'server-info',
|
||||||
title: t`Server Information`,
|
title: t`Server Information`,
|
||||||
description: t`About this Inventree instance`,
|
description: t`About this Inventree instance`,
|
||||||
onTrigger: () => serverInfo(),
|
onClick: () => serverInfo(),
|
||||||
icon: <IconLink size="1.2rem" />
|
leftSection: <IconLink size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'license-info',
|
||||||
title: t`License Information`,
|
title: t`License Information`,
|
||||||
description: t`Licenses for dependencies of the service`,
|
description: t`Licenses for dependencies of the service`,
|
||||||
onTrigger: () => licenseInfo(),
|
onClick: () => licenseInfo(),
|
||||||
icon: <IconLink size="1.2rem" />
|
leftSection: <IconLink size="1.2rem" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 'navigation',
|
||||||
title: t`Open Navigation`,
|
title: t`Open Navigation`,
|
||||||
description: t`Open the main navigation menu`,
|
description: t`Open the main navigation menu`,
|
||||||
onTrigger: () => setNavigationOpen(true),
|
onClick: () => setNavigationOpen(true),
|
||||||
icon: <IconPointer size="1.2rem" />
|
leftSection: <IconPointer size="1.2rem" />
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -67,7 +67,8 @@ export function UserTheme({ height }: { height: number }) {
|
|||||||
{ value: 'dots', label: t`dots` }
|
{ value: 'dots', label: t`dots` }
|
||||||
];
|
];
|
||||||
const [loader, setLoader] = useState<string>(theme.loader);
|
const [loader, setLoader] = useState<string>(theme.loader);
|
||||||
function changeLoader(value: string) {
|
function changeLoader(value: string | null) {
|
||||||
|
if (value === null) return;
|
||||||
setLoader(value);
|
setLoader(value);
|
||||||
useLocalState.setState({ loader: value });
|
useLocalState.setState({ loader: value });
|
||||||
}
|
}
|
||||||
|
@@ -66,12 +66,12 @@ interface MachineI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function MachineStatusIndicator({ machine }: { machine: MachineI }) {
|
function MachineStatusIndicator({ machine }: { machine: MachineI }) {
|
||||||
const sx = { marginLeft: '4px' };
|
const style = { marginLeft: '4px' };
|
||||||
|
|
||||||
// machine is not active, show a gray dot
|
// machine is not active, show a gray dot
|
||||||
if (!machine.active) {
|
if (!machine.active) {
|
||||||
return (
|
return (
|
||||||
<Indicator sx={sx} color="gray">
|
<Indicator style={style} color="gray">
|
||||||
<Box></Box>
|
<Box></Box>
|
||||||
</Indicator>
|
</Indicator>
|
||||||
);
|
);
|
||||||
@@ -90,7 +90,7 @@ function MachineStatusIndicator({ machine }: { machine: MachineI }) {
|
|||||||
machine.initialized && machine.status > 0 && machine.status < 300;
|
machine.initialized && machine.status > 0 && machine.status < 300;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Indicator processing={processing} sx={sx} color={color}>
|
<Indicator processing={processing} style={style} color={color}>
|
||||||
<Box></Box>
|
<Box></Box>
|
||||||
</Indicator>
|
</Indicator>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user