2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

[PUI] Add theme changer to navbar (#7907)

* Add API bump

* [PUI] Add theme setting to navbar
Closes https://github.com/invenhost/InvenTree/issues/106

* Rename to the same as ColorToggle

* Change action text
Co-authored-by: @SchrodingersGat
This commit is contained in:
Matthias Mair 2024-08-19 01:52:23 +02:00 committed by GitHub
parent 5c9f50b43c
commit 286091c1e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 2 deletions

View File

@ -1,13 +1,16 @@
"""InvenTree API version information.""" """InvenTree API version information."""
# InvenTree API version # InvenTree API version
INVENTREE_API_VERSION = 240 INVENTREE_API_VERSION = 241
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" """Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """ INVENTREE_API_TEXT = """
v241 - 2024-09-18 : https://github.com/inventree/InvenTree/pull/7906
- Adjusts required fields for the MeUserDetail endpoint
v240 - 2024-08-16 : https://github.com/inventree/InvenTree/pull/7900 v240 - 2024-08-16 : https://github.com/inventree/InvenTree/pull/7900
- Adjust "issued_by" filter for the BuildOrder list endpoint - Adjust "issued_by" filter for the BuildOrder list endpoint
- Adjust "assigned_to" filter for the BuildOrder list endpoint - Adjust "assigned_to" filter for the BuildOrder list endpoint

View File

@ -1,9 +1,18 @@
import { Trans } from '@lingui/macro'; import { Trans } from '@lingui/macro';
import { Group, Menu, Skeleton, Text, UnstyledButton } from '@mantine/core'; import {
Group,
Menu,
Skeleton,
Text,
UnstyledButton,
useMantineColorScheme
} from '@mantine/core';
import { import {
IconChevronDown, IconChevronDown,
IconLogout, IconLogout,
IconMoonStars,
IconSettings, IconSettings,
IconSun,
IconUserBolt, IconUserBolt,
IconUserCog IconUserCog
} from '@tabler/icons-react'; } from '@tabler/icons-react';
@ -20,6 +29,7 @@ export function MainMenu() {
state.user, state.user,
state.username state.username
]); ]);
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
return ( return (
<Menu width={260} position="bottom-end"> <Menu width={260} position="bottom-end">
@ -57,6 +67,15 @@ export function MainMenu() {
<Trans>System Settings</Trans> <Trans>System Settings</Trans>
</Menu.Item> </Menu.Item>
)} )}
<Menu.Item
onClick={toggleColorScheme}
leftSection={colorScheme === 'dark' ? <IconSun /> : <IconMoonStars />}
c={
colorScheme === 'dark' ? vars.colors.yellow[4] : vars.colors.blue[6]
}
>
<Trans>Change Color Mode</Trans>
</Menu.Item>
{user?.is_staff && <Menu.Divider />} {user?.is_staff && <Menu.Divider />}
{user?.is_staff && ( {user?.is_staff && (
<Menu.Item <Menu.Item