From 286091c1e523e6bd78eaf6705372b5d14fe6f164 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 19 Aug 2024 01:52:23 +0200 Subject: [PATCH] [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 --- .../InvenTree/InvenTree/api_version.py | 5 ++++- src/frontend/src/components/nav/MainMenu.tsx | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index 98733ffa68..94cf10e91e 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,13 +1,16 @@ """InvenTree API version information.""" # 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.""" 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 - Adjust "issued_by" filter for the BuildOrder list endpoint - Adjust "assigned_to" filter for the BuildOrder list endpoint diff --git a/src/frontend/src/components/nav/MainMenu.tsx b/src/frontend/src/components/nav/MainMenu.tsx index 04ab8e7b89..102a70a91b 100644 --- a/src/frontend/src/components/nav/MainMenu.tsx +++ b/src/frontend/src/components/nav/MainMenu.tsx @@ -1,9 +1,18 @@ 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 { IconChevronDown, IconLogout, + IconMoonStars, IconSettings, + IconSun, IconUserBolt, IconUserCog } from '@tabler/icons-react'; @@ -20,6 +29,7 @@ export function MainMenu() { state.user, state.username ]); + const { colorScheme, toggleColorScheme } = useMantineColorScheme(); return ( @@ -57,6 +67,15 @@ export function MainMenu() { System Settings )} + : } + c={ + colorScheme === 'dark' ? vars.colors.yellow[4] : vars.colors.blue[6] + } + > + Change Color Mode + {user?.is_staff && } {user?.is_staff && (