2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-10 05:40:55 +00:00

fix more arg renames

This commit is contained in:
Matthias Mair
2024-04-15 12:09:19 +02:00
parent e43befc2cc
commit 3e5a31d6bc
21 changed files with 79 additions and 82 deletions

View File

@@ -358,8 +358,8 @@ export function DetailsImage(props: DetailImageProps) {
<> <>
<ApiImage <ApiImage
src={img} src={img}
height={IMAGE_DIMENSION} h={IMAGE_DIMENSION}
width={IMAGE_DIMENSION} w={IMAGE_DIMENSION}
onClick={expandImage} onClick={expandImage}
/> />
{permissions.hasChangeRole(props.appRole) && {permissions.hasChangeRole(props.appRole) &&

View File

@@ -62,15 +62,15 @@ export function HostOptionsForm({
<Box sx={{ maxWidth: 500 }} mx="auto"> <Box sx={{ maxWidth: 500 }} mx="auto">
{fields.length > 0 ? ( {fields.length > 0 ? (
<Group mb="xs"> <Group mb="xs">
<Text weight={500} size="sm" sx={{ flex: 1 }}> <Text fw={500} size="sm" sx={{ flex: 1 }}>
<Trans>Host</Trans> <Trans>Host</Trans>
</Text> </Text>
<Text weight={500} size="sm" sx={{ flex: 1 }}> <Text fw={500} size="sm" sx={{ flex: 1 }}>
<Trans>Name</Trans> <Trans>Name</Trans>
</Text> </Text>
</Group> </Group>
) : ( ) : (
<Text c="dimmed" align="center"> <Text c="dimmed" ta="center">
<Trans>No one here...</Trans> <Trans>No one here...</Trans>
</Text> </Text>
)} )}

View File

@@ -15,7 +15,7 @@ export function InstanceOptions({
setHostEdit setHostEdit
}: { }: {
hostKey: string; hostKey: string;
ChangeHost: (newHost: string) => void; ChangeHost: (newHost: string | null) => void;
setHostEdit: () => void; setHostEdit: () => void;
}) { }) {
const [HostListEdit, setHostListEdit] = useToggle([false, true] as const); const [HostListEdit, setHostListEdit] = useToggle([false, true] as const);

View File

@@ -1,6 +1,6 @@
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Input, useMantineTheme } from '@mantine/core'; import { Input, useMantineTheme } from '@mantine/core';
import { useDebouncedValue } from '@mantine/hooks'; import { useColorScheme, useDebouncedValue } from '@mantine/hooks';
import { useId } from '@mantine/hooks'; import { useId } from '@mantine/hooks';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -12,6 +12,7 @@ import {
import Select from 'react-select'; import Select from 'react-select';
import { api } from '../../../App'; import { api } from '../../../App';
import { vars } from '../../../theme';
import { RenderInstance } from '../../render/Instance'; import { RenderInstance } from '../../render/Instance';
import { ApiFormFieldType } from './ApiFormField'; import { ApiFormFieldType } from './ApiFormField';
@@ -218,29 +219,32 @@ export function RelatedModelField({
// Define color theme to pass to field based on Mantine theme // Define color theme to pass to field based on Mantine theme
const theme = useMantineTheme(); const theme = useMantineTheme();
const colorschema = vars.colors.primaryColors;
const [preferredColorScheme] = useColorScheme();
const colors = useMemo(() => { const colors = useMemo(() => {
let colors: any; let colors: any;
if (theme.colorScheme === 'dark') { if (preferredColorScheme === 'dark') {
colors = { colors = {
neutral0: theme.colors[theme.colorScheme][6], neutral0: colorschema[6],
neutral5: theme.colors[theme.colorScheme][4], neutral5: colorschema[4],
neutral10: theme.colors[theme.colorScheme][4], neutral10: colorschema[4],
neutral20: theme.colors[theme.colorScheme][4], neutral20: colorschema[4],
neutral30: theme.colors[theme.colorScheme][3], neutral30: colorschema[3],
neutral40: theme.colors[theme.colorScheme][2], neutral40: colorschema[2],
neutral50: theme.colors[theme.colorScheme][1], neutral50: colorschema[1],
neutral60: theme.colors[theme.colorScheme][0], neutral60: colorschema[0],
neutral70: theme.colors[theme.colorScheme][0], neutral70: colorschema[0],
neutral80: theme.colors[theme.colorScheme][0], neutral80: colorschema[0],
neutral90: theme.colors[theme.colorScheme][0], neutral90: colorschema[0],
primary: theme.colors[theme.primaryColor][7], primary: vars.colors.primaryColors[7],
primary25: theme.colors[theme.primaryColor][6], primary25: vars.colors.primaryColors[6],
primary50: theme.colors[theme.primaryColor][5], primary50: vars.colors.primaryColors[5],
primary75: theme.colors[theme.primaryColor][4] primary75: vars.colors.primaryColors[4]
}; };
} else { } else {
colors = { colors = {
neutral0: theme.white, neutral0: vars.colors.white,
neutral5: theme.fn.darken(theme.white, 0.05), neutral5: theme.fn.darken(theme.white, 0.05),
neutral10: theme.fn.darken(theme.white, 0.1), neutral10: theme.fn.darken(theme.white, 0.1),
neutral20: theme.fn.darken(theme.white, 0.2), neutral20: theme.fn.darken(theme.white, 0.2),
@@ -251,10 +255,10 @@ export function RelatedModelField({
neutral70: theme.fn.darken(theme.white, 0.7), neutral70: theme.fn.darken(theme.white, 0.7),
neutral80: theme.fn.darken(theme.white, 0.8), neutral80: theme.fn.darken(theme.white, 0.8),
neutral90: theme.fn.darken(theme.white, 0.9), neutral90: theme.fn.darken(theme.white, 0.9),
primary: theme.colors[theme.primaryColor][7], primary: vars.colors.primaryColors[7],
primary25: theme.colors[theme.primaryColor][4], primary25: vars.colors.primaryColors[4],
primary50: theme.colors[theme.primaryColor][5], primary50: vars.colors.primaryColors[5],
primary75: theme.colors[theme.primaryColor][6] primary75: vars.colors.primaryColors[6]
}; };
} }
return colors; return colors;

View File

@@ -67,10 +67,7 @@ export function ApiImage(props: ImageProps) {
{image && image.length > 0 ? ( {image && image.length > 0 ? (
<Image {...props} src={image} withPlaceholder fit="contain" /> <Image {...props} src={image} withPlaceholder fit="contain" />
) : ( ) : (
<Skeleton <Skeleton h={props?.h ?? props.w} w={props?.w ?? props.h} />
height={props?.height ?? props.width}
width={props?.width ?? props.height}
/>
)} )}
</Stack> </Stack>
); );

View File

@@ -18,7 +18,7 @@ export function StatisticItem({
}) { }) {
return ( return (
<Paper withBorder p="xs" key={id} pos="relative"> <Paper withBorder p="xs" key={id} pos="relative">
<LoadingOverlay visible={isLoading} overlayBlur={2} /> <LoadingOverlay visible={isLoading} overlayProps={{ blur: 2 }} />
<Group justify="apart"> <Group justify="apart">
<Text size="xs" color="dimmed" className={classes.dashboardItemTitle}> <Text size="xs" color="dimmed" className={classes.dashboardItemTitle}>
{data.title} {data.title}

View File

@@ -9,7 +9,7 @@ export function LanguageToggle() {
return ( return (
<Group <Group
position="center" justify="center"
style={{ style={{
border: open === true ? `1px dashed ` : ``, border: open === true ? `1px dashed ` : ``,
margin: open === true ? 2 : 12, margin: open === true ? 2 : 12,

View File

@@ -9,7 +9,7 @@ export function PlaceholderPill() {
return ( return (
<Tooltip <Tooltip
multiline multiline
width={220} w={220}
withArrow withArrow
label={t`This feature/button/site is a placeholder for a feature that is not implemented, only partial or intended for testing.`} label={t`This feature/button/site is a placeholder for a feature that is not implemented, only partial or intended for testing.`}
> >

View File

@@ -24,7 +24,7 @@ export function ProgressBar(props: ProgressBarProps) {
return ( return (
<Stack gap={2} style={{ flexGrow: 1, minWidth: '100px' }}> <Stack gap={2} style={{ flexGrow: 1, minWidth: '100px' }}>
{props.progressLabel && ( {props.progressLabel && (
<Text align="center" size="xs"> <Text ta="center" size="xs">
{props.value} / {props.maximum} {props.value} / {props.maximum}
</Text> </Text>
)} )}

View File

@@ -23,7 +23,7 @@ export function MainMenu() {
<Menu.Target> <Menu.Target>
<UnstyledButton className={classes.layoutHeaderUser}> <UnstyledButton className={classes.layoutHeaderUser}>
<Group gap={7}> <Group gap={7}>
<Text weight={500} size="sm" sx={{ lineHeight: 1 }} mr={3}> <Text fw={500} size="sm" sx={{ lineHeight: 1 }} mr={3}>
{userState.username() ? ( {userState.username() ? (
userState.username() userState.username()
) : ( ) : (

View File

@@ -46,7 +46,7 @@ export function PageDetail({
<Group justify="apart" wrap="nowrap"> <Group justify="apart" wrap="nowrap">
<Group justify="left" wrap="nowrap"> <Group justify="left" wrap="nowrap">
{imageUrl && ( {imageUrl && (
<ApiImage src={imageUrl} radius="sm" height={64} width={64} /> <ApiImage src={imageUrl} radius="sm" h={64} w={64} />
)} )}
<Stack gap="xs"> <Stack gap="xs">
{title && <StylishText size="lg">{title}</StylishText>} {title && <StylishText size="lg">{title}</StylishText>}

View File

@@ -72,7 +72,7 @@ function BasePanelGroup({
}, [setLastUsedPanel]); }, [setLastUsedPanel]);
// Callback when the active panel changes // Callback when the active panel changes
function handlePanelChange(panel: string) { function handlePanelChange(panel: string | null) {
if (activePanels.findIndex((p) => p.name === panel) === -1) { if (activePanels.findIndex((p) => p.name === panel) === -1) {
setLastUsedPanel(''); setLastUsedPanel('');
return navigate('../'); return navigate('../');
@@ -81,7 +81,7 @@ function BasePanelGroup({
navigate(`../${panel}`); navigate(`../${panel}`);
// Optionally call external callback hook // Optionally call external callback hook
if (onPanelChange) { if (panel && onPanelChange) {
onPanelChange(panel); onPanelChange(panel);
} }
} }
@@ -111,7 +111,7 @@ function BasePanelGroup({
onChange={handlePanelChange} onChange={handlePanelChange}
keepMounted={false} keepMounted={false}
> >
<Tabs.List position="left"> <Tabs.List justify="left">
{panels.map( {panels.map(
(panel) => (panel) =>
!panel.hidden && ( !panel.hidden && (

View File

@@ -1,12 +1,6 @@
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { import { Drawer, Group, LoadingOverlay, Stack, Text } from '@mantine/core';
Drawer, import { useColorScheme } from '@mantine/hooks';
Group,
LoadingOverlay,
Stack,
Text,
useMantineTheme
} from '@mantine/core';
import { ReactTree, ThemeSettings } from '@naisutech/react-tree'; import { ReactTree, ThemeSettings } from '@naisutech/react-tree';
import { import {
IconChevronDown, IconChevronDown,
@@ -20,6 +14,7 @@ import { useNavigate } from 'react-router-dom';
import { api } from '../../App'; import { api } from '../../App';
import { ApiEndpoints } from '../../enums/ApiEndpoints'; import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { apiUrl } from '../../states/ApiState'; import { apiUrl } from '../../states/ApiState';
import { theme, vars } from '../../theme';
import { StylishText } from '../items/StylishText'; import { StylishText } from '../items/StylishText';
export function PartCategoryTree({ export function PartCategoryTree({
@@ -80,57 +75,57 @@ export function PartCategoryTree({
return open ? <IconChevronDown /> : <IconChevronRight />; return open ? <IconChevronDown /> : <IconChevronRight />;
} }
const mantineTheme = useMantineTheme(); const [prefferedColorScheme] = useColorScheme();
const themes: ThemeSettings = useMemo(() => { const themes: ThemeSettings = useMemo(() => {
const currentTheme = const currentTheme =
mantineTheme.colorScheme === 'dark' prefferedColorScheme === 'dark'
? mantineTheme.colorScheme ? vars.colors.defaultColor
: mantineTheme.primaryColor; : vars.colors.primaryColors;
return { return {
dark: { dark: {
text: { text: {
...mantineTheme.fn.fontStyles() ...vars.fontStyles()
}, },
nodes: { nodes: {
height: '2.5rem', height: '2.5rem',
folder: { folder: {
selectedBgColor: mantineTheme.colors[currentTheme][4], selectedBgColor: currentTheme[4],
hoverBgColor: mantineTheme.colors[currentTheme][6] hoverBgColor: currentTheme[6]
}, },
leaf: { leaf: {
selectedBgColor: mantineTheme.colors[currentTheme][4], selectedBgColor: currentTheme[4],
hoverBgColor: mantineTheme.colors[currentTheme][6] hoverBgColor: currentTheme[6]
}, },
icons: { icons: {
folderColor: mantineTheme.colors[currentTheme][3], folderColor: currentTheme[3],
leafColor: mantineTheme.colors[currentTheme][3] leafColor: currentTheme[3]
} }
} }
}, },
light: { light: {
text: { text: {
...mantineTheme.fn.fontStyles() ...theme.fn.fontStyles()
}, },
nodes: { nodes: {
height: '2.5rem', height: '2.5rem',
folder: { folder: {
selectedBgColor: mantineTheme.colors[currentTheme][4], selectedBgColor: currentTheme[4],
hoverBgColor: mantineTheme.colors[currentTheme][2] hoverBgColor: currentTheme[2]
}, },
leaf: { leaf: {
selectedBgColor: mantineTheme.colors[currentTheme][4], selectedBgColor: currentTheme[4],
hoverBgColor: mantineTheme.colors[currentTheme][2] hoverBgColor: currentTheme[2]
}, },
icons: { icons: {
folderColor: mantineTheme.colors[currentTheme][8], folderColor: currentTheme[8],
leafColor: mantineTheme.colors[currentTheme][6] leafColor: currentTheme[6]
} }
} }
} }
}; };
}, [mantineTheme]); }, [theme]);
return ( return (
<Drawer <Drawer
@@ -162,7 +157,7 @@ export function PartCategoryTree({
RenderIcon={renderIcon} RenderIcon={renderIcon}
defaultSelectedNodes={selectedCategory ? [selectedCategory] : []} defaultSelectedNodes={selectedCategory ? [selectedCategory] : []}
showEmptyItems={false} showEmptyItems={false}
theme={mantineTheme.colorScheme} theme={theme.colorScheme}
themes={themes} themes={themes}
/> />
</Stack> </Stack>

View File

@@ -51,7 +51,7 @@ export function StockLocationTree({
function renderNode({ node }: { node: any }) { function renderNode({ node }: { node: any }) {
return ( return (
<Group <Group
position="apart" justify="apart"
key={node.id} key={node.id}
wrap="nowrap" wrap="nowrap"
onClick={() => { onClick={() => {

View File

@@ -6,9 +6,9 @@ import {
Space, Space,
Stack, Stack,
Switch, Switch,
Text, Text
useMantineTheme
} from '@mantine/core'; } from '@mantine/core';
import { useColorScheme } from '@mantine/hooks';
import { showNotification } from '@mantine/notifications'; import { showNotification } from '@mantine/notifications';
import { IconEdit } from '@tabler/icons-react'; import { IconEdit } from '@tabler/icons-react';
import { useMemo } from 'react'; import { useMemo } from 'react';
@@ -19,6 +19,7 @@ import { openModalApiForm } from '../../functions/forms';
import { apiUrl } from '../../states/ApiState'; import { apiUrl } from '../../states/ApiState';
import { SettingsStateProps } from '../../states/SettingsState'; import { SettingsStateProps } from '../../states/SettingsState';
import { Setting, SettingType } from '../../states/states'; import { Setting, SettingType } from '../../states/states';
import { vars } from '../../theme';
import { ApiFormFieldType } from '../forms/fields/ApiFormField'; import { ApiFormFieldType } from '../forms/fields/ApiFormField';
/** /**
@@ -165,14 +166,14 @@ export function SettingItem({
shaded: boolean; shaded: boolean;
onChange?: () => void; onChange?: () => void;
}) { }) {
const theme = useMantineTheme(); const [prefferedColorScheme] = useColorScheme();
const style: Record<string, string> = { paddingLeft: '8px' }; const style: Record<string, string> = { paddingLeft: '8px' };
if (shaded) { if (shaded) {
style['backgroundColor'] = style['backgroundColor'] =
theme.colorScheme === 'light' prefferedColorScheme === 'light'
? theme.colors.gray[1] ? vars.colors.gray[1]
: theme.colors.gray[9]; : vars.colors.gray[9];
} }
return ( return (

View File

@@ -26,7 +26,7 @@ export default function FeedbackWidget() {
component="a" component="a"
href="https://github.com/inventree/InvenTree/discussions/5328" href="https://github.com/inventree/InvenTree/discussions/5328"
variant="outline" variant="outline"
leftIcon={<IconExternalLink size="0.9rem" />} leftSection={<IconExternalLink size="0.9rem" />}
> >
<Trans>Provide Feedback</Trans> <Trans>Provide Feedback</Trans>
</Button> </Button>

View File

@@ -70,7 +70,7 @@ export default function Login() {
) : ( ) : (
<> <>
<Paper radius="md" p="xl" withBorder> <Paper radius="md" p="xl" withBorder>
<Text size="lg" weight={500}> <Text size="lg" fw={500}>
{loginMode ? ( {loginMode ? (
<Trans>Welcome, log in below</Trans> <Trans>Welcome, log in below</Trans>
) : ( ) : (

View File

@@ -168,7 +168,7 @@ function EmailContent({}: {}) {
<TextInput <TextInput
label={t`E-Mail`} label={t`E-Mail`}
placeholder={t`E-Mail address`} placeholder={t`E-Mail address`}
icon={<IconAt />} leftSection={<IconAt />}
value={newEmailValue} value={newEmailValue}
onChange={(event) => setNewEmailValue(event.currentTarget.value)} onChange={(event) => setNewEmailValue(event.currentTarget.value)}
/> />

View File

@@ -19,7 +19,7 @@ export function TableSearchInput({
return ( return (
<TextInput <TextInput
value={value} value={value}
icon={<IconSearch />} leftSection={<IconSearch />}
placeholder={t`Search`} placeholder={t`Search`}
onChange={(event) => setValue(event.target.value)} onChange={(event) => setValue(event.target.value)}
rightSection={ rightSection={

View File

@@ -38,7 +38,7 @@ export function TableHoverCard({
<Stack gap="xs"> <Stack gap="xs">
<Group gap="xs" justify="left"> <Group gap="xs" justify="left">
<IconInfoCircle size="16" color="blue" /> <IconInfoCircle size="16" color="blue" />
<Text weight="bold">{title}</Text> <Text fw="bold">{title}</Text>
</Group> </Group>
<Divider /> <Divider />
{extra} {extra}

View File

@@ -37,7 +37,7 @@ export default function PartTestTemplateTable({ partId }: { partId: number }) {
render: (record: any) => { render: (record: any) => {
return ( return (
<Text <Text
weight={record.required && 700} fw={record.required && 700}
c={record.enabled ? undefined : 'red'} c={record.enabled ? undefined : 'red'}
> >
{record.test_name} {record.test_name}