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

adapt arg names

This commit is contained in:
Matthias Mair
2024-04-15 10:04:03 +02:00
parent bd60b01a88
commit e43befc2cc
27 changed files with 59 additions and 47 deletions

View File

@@ -17,7 +17,7 @@ export function CopyButton({
onClick={copy} onClick={copy}
title={t`Copy to clipboard`} title={t`Copy to clipboard`}
variant="subtle" variant="subtle"
compact size="compact-md"
> >
<IconCopy size={10} /> <IconCopy size={10} />
{label && <div>&nbsp;</div>} {label && <div>&nbsp;</div>}

View File

@@ -50,7 +50,7 @@ export function SsoButton({ provider }: { provider: Provider }) {
return ( return (
<Button <Button
leftIcon={getBrandIcon(provider)} leftSection={getBrandIcon(provider)}
radius="xl" radius="xl"
component="a" component="a"
onClick={login} onClick={login}

View File

@@ -89,7 +89,7 @@ export function SplitButton({
option.onClick(); option.onClick();
}} }}
disabled={option.disabled} disabled={option.disabled}
icon={<option.icon />} leftSection={<option.icon />}
> >
<Tooltip label={option.tooltip} position="right"> <Tooltip label={option.tooltip} position="right">
<Text>{option.name}</Text> <Text>{option.name}</Text>

View File

@@ -7,11 +7,10 @@ import {
Overlay, Overlay,
Paper, Paper,
Text, Text,
rem, rem
useMantineTheme
} from '@mantine/core'; } from '@mantine/core';
import { Dropzone, FileWithPath, IMAGE_MIME_TYPE } from '@mantine/dropzone'; import { Dropzone, FileWithPath, IMAGE_MIME_TYPE } from '@mantine/dropzone';
import { useHover } from '@mantine/hooks'; import { useColorScheme, useHover } from '@mantine/hooks';
import { modals } from '@mantine/modals'; import { modals } from '@mantine/modals';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
@@ -21,6 +20,7 @@ import { cancelEvent } from '../../functions/events';
import { InvenTreeIcon } from '../../functions/icons'; import { InvenTreeIcon } from '../../functions/icons';
import { useUserState } from '../../states/UserState'; import { useUserState } from '../../states/UserState';
import { PartThumbTable } from '../../tables/part/PartThumbTable'; import { PartThumbTable } from '../../tables/part/PartThumbTable';
import { vars } from '../../theme';
import { ActionButton } from '../buttons/ActionButton'; import { ActionButton } from '../buttons/ActionButton';
import { ApiImage } from '../images/ApiImage'; import { ApiImage } from '../images/ApiImage';
import { StylishText } from '../items/StylishText'; import { StylishText } from '../items/StylishText';
@@ -87,8 +87,6 @@ function UploadModal({
const [file1, setFile] = useState<FileWithPath | null>(null); const [file1, setFile] = useState<FileWithPath | null>(null);
let uploading = false; let uploading = false;
const theme = useMantineTheme();
// Components to show in the Dropzone when no file is selected // Components to show in the Dropzone when no file is selected
const noFileIdle = ( const noFileIdle = (
<Group> <Group>
@@ -160,9 +158,11 @@ function UploadModal({
} }
}; };
const preferredColorScheme = useColorScheme();
const primaryColor = const primaryColor =
theme.colors[theme.primaryColor][theme.colorScheme === 'dark' ? 4 : 6]; vars.colors.primaryColors[preferredColorScheme === 'dark' ? 4 : 6];
const redColor = theme.colors.red[theme.colorScheme === 'dark' ? 4 : 6]; const redColor = vars.colors.red[preferredColorScheme === 'dark' ? 4 : 6];
return ( return (
<Paper sx={{ height: '220px' }}> <Paper sx={{ height: '220px' }}>
@@ -173,7 +173,7 @@ function UploadModal({
loading={uploading} loading={uploading}
> >
<Group <Group
position="center" justify="center"
gap="xl" gap="xl"
style={{ minHeight: rem(140), pointerEvents: 'none' }} style={{ minHeight: rem(140), pointerEvents: 'none' }}
> >

View File

@@ -223,7 +223,7 @@ export function TemplateEditor(props: TemplateEditorProps) {
<Split style={{ gap: '10px' }}> <Split style={{ gap: '10px' }}>
<Tabs <Tabs
value={editorValue} value={editorValue}
onTabChange={async (v) => { onChange={async (v) => {
codeRef.current = await getCodeFromEditor(); codeRef.current = await getCodeFromEditor();
setEditorValue(v); setEditorValue(v);
}} }}
@@ -240,7 +240,7 @@ export function TemplateEditor(props: TemplateEditorProps) {
<Tabs.Tab <Tabs.Tab
key={Editor.key} key={Editor.key}
value={Editor.key} value={Editor.key}
icon={<Editor.icon size="0.8rem" />} leftSection={<Editor.icon size="0.8rem" />}
> >
{Editor.name} {Editor.name}
</Tabs.Tab> </Tabs.Tab>
@@ -289,7 +289,7 @@ export function TemplateEditor(props: TemplateEditorProps) {
<Tabs <Tabs
value={previewValue} value={previewValue}
onTabChange={setPreviewValue} onChange={setPreviewValue}
style={{ style={{
minWidth: '200px', minWidth: '200px',
display: 'flex', display: 'flex',
@@ -301,7 +301,7 @@ export function TemplateEditor(props: TemplateEditorProps) {
<Tabs.Tab <Tabs.Tab
key={PreviewArea.key} key={PreviewArea.key}
value={PreviewArea.key} value={PreviewArea.key}
icon={<PreviewArea.icon size="0.8rem" />} leftSection={<PreviewArea.icon size="0.8rem" />}
> >
{PreviewArea.name} {PreviewArea.name}
</Tabs.Tab> </Tabs.Tab>

View File

@@ -70,7 +70,7 @@ export function HostOptionsForm({
</Text> </Text>
</Group> </Group>
) : ( ) : (
<Text color="dimmed" align="center"> <Text c="dimmed" align="center">
<Trans>No one here...</Trans> <Trans>No one here...</Trans>
</Text> </Text>
)} )}

View File

@@ -240,7 +240,7 @@ export function ApiFormField({
return `${1 * v.toFixed()}`; return `${1 * v.toFixed()}`;
}} }}
precision={definition.field_type == 'integer' ? 0 : 10} precision={definition.field_type == 'integer' ? 0 : 10}
onChange={(value: number) => onChange(value)} onChange={(value) => onChange(value)}
/> />
); );
case 'choice': case 'choice':

View File

@@ -63,7 +63,7 @@ export function ChoiceField({
placeholder={definition.placeholder} placeholder={definition.placeholder}
required={definition.required} required={definition.required}
disabled={definition.disabled} disabled={definition.disabled}
icon={definition.icon} leftSection={definition.icon}
withinPortal={true} withinPortal={true}
/> />
); );

View File

@@ -61,7 +61,7 @@ export default function DateField({
label={definition.label} label={definition.label}
description={definition.description} description={definition.description}
placeholder={definition.placeholder} placeholder={definition.placeholder}
icon={definition.icon} leftSection={definition.icon}
/> />
); );
} }

View File

@@ -77,7 +77,7 @@ export function ActionDropdown({
> >
<Tooltip label={action.tooltip}> <Tooltip label={action.tooltip}>
<Menu.Item <Menu.Item
icon={action.icon} leftSection={action.icon}
onClick={() => { onClick={() => {
if (action.onClick != undefined) { if (action.onClick != undefined) {
action.onClick(); action.onClick();

View File

@@ -31,7 +31,7 @@ export function PlaceholderPanel() {
title={t`This panel is a placeholder.`} title={t`This panel is a placeholder.`}
icon={<IconInfoCircle />} icon={<IconInfoCircle />}
> >
<Text color="gray">This panel has not yet been implemented</Text> <Text c="gray">This panel has not yet been implemented</Text>
</Alert> </Alert>
</Stack> </Stack>
); );

View File

@@ -177,7 +177,7 @@ export function QrCodeModal({
</Button> </Button>
</Group> </Group>
{values.length == 0 ? ( {values.length == 0 ? (
<Text color={'grey'}> <Text c={'grey'}>
<Trans>No scans yet!</Trans> <Trans>No scans yet!</Trans>
</Text> </Text>
) : ( ) : (

View File

@@ -128,11 +128,11 @@ function NavTabs() {
defaultValue="home" defaultValue="home"
classNames={{ classNames={{
root: classes.tabs, root: classes.tabs,
tabsList: classes.tabsList, list: classes.tabsList,
tab: classes.tab tab: classes.tab
}} }}
value={tabValue} value={tabValue}
onTabChange={(value) => onChange={(value) =>
value == '/' ? navigate('/') : navigate(`/${value}`) value == '/' ? navigate('/') : navigate(`/${value}`)
} }
> >

View File

@@ -38,12 +38,16 @@ export function MainMenu() {
<Menu.Label> <Menu.Label>
<Trans>Settings</Trans> <Trans>Settings</Trans>
</Menu.Label> </Menu.Label>
<Menu.Item icon={<IconUserCog />} component={Link} to="/settings/user"> <Menu.Item
leftSection={<IconUserCog />}
component={Link}
to="/settings/user"
>
<Trans>Account settings</Trans> <Trans>Account settings</Trans>
</Menu.Item> </Menu.Item>
{userState.user?.is_staff && ( {userState.user?.is_staff && (
<Menu.Item <Menu.Item
icon={<IconSettings />} leftSection={<IconSettings />}
component={Link} component={Link}
to="/settings/system" to="/settings/system"
> >
@@ -53,7 +57,7 @@ export function MainMenu() {
{userState.user?.is_staff && <Menu.Divider />} {userState.user?.is_staff && <Menu.Divider />}
{userState.user?.is_staff && ( {userState.user?.is_staff && (
<Menu.Item <Menu.Item
icon={<IconUserBolt />} leftSection={<IconUserBolt />}
component={Link} component={Link}
to="/settings/admin" to="/settings/admin"
> >
@@ -62,7 +66,7 @@ export function MainMenu() {
)} )}
<Menu.Divider /> <Menu.Divider />
<Menu.Item <Menu.Item
icon={<IconLogout />} leftSection={<IconLogout />}
onClick={() => { onClick={() => {
doLogout(navigate); doLogout(navigate);
}} }}

View File

@@ -108,7 +108,7 @@ function BasePanelGroup({
<Tabs <Tabs
value={panel} value={panel}
orientation="vertical" orientation="vertical"
onTabChange={handlePanelChange} onChange={handlePanelChange}
keepMounted={false} keepMounted={false}
> >
<Tabs.List position="left"> <Tabs.List position="left">
@@ -124,7 +124,7 @@ function BasePanelGroup({
p="xs" p="xs"
value={panel.name} value={panel.name}
// icon={(<InvenTreeIcon icon={panel.name}/>)} // Enable when implementing Icon manager everywhere // icon={(<InvenTreeIcon icon={panel.name}/>)} // Enable when implementing Icon manager everywhere
icon={panel.icon} leftSection={panel.icon}
hidden={panel.hidden} hidden={panel.hidden}
disabled={panel.disabled} disabled={panel.disabled}
style={{ cursor: panel.disabled ? 'unset' : 'pointer' }} style={{ cursor: panel.disabled ? 'unset' : 'pointer' }}

View File

@@ -59,7 +59,7 @@ export function PartCategoryTree({
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

@@ -337,7 +337,7 @@ export function SearchDrawer({
radius="xs" radius="xs"
value={value} value={value}
onChange={(event) => setValue(event.currentTarget.value)} onChange={(event) => setValue(event.currentTarget.value)}
icon={<IconSearch size="0.8rem" />} leftSection={<IconSearch size="0.8rem" />}
rightSection={ rightSection={
value && ( value && (
<IconBackspace color="red" onClick={() => setValue('')} /> <IconBackspace color="red" onClick={() => setValue('')} />

View File

@@ -160,13 +160,13 @@ function WidgetControlBar({
<Trans>Layout</Trans> <Trans>Layout</Trans>
</Menu.Label> </Menu.Label>
<Menu.Item <Menu.Item
icon={<IconArrowBackUpDouble size={14} />} leftSection={<IconArrowBackUpDouble size={14} />}
onClick={resetLayout} onClick={resetLayout}
> >
<Trans>Reset Layout</Trans> <Trans>Reset Layout</Trans>
</Menu.Item> </Menu.Item>
<Menu.Item <Menu.Item
icon={ leftSection={
<IconLayout2 size={14} color={editable ? 'red' : undefined} /> <IconLayout2 size={14} color={editable ? 'red' : undefined} />
} }
onClick={editFnc} onClick={editFnc}
@@ -185,7 +185,7 @@ function WidgetControlBar({
<Trans>Appearance</Trans> <Trans>Appearance</Trans>
</Menu.Label> </Menu.Label>
<Menu.Item <Menu.Item
icon={ leftSection={
boxShown ? ( boxShown ? (
<IconSquareCheck size={14} /> <IconSquareCheck size={14} />
) : ( ) : (

View File

@@ -11,7 +11,6 @@ import {
Table, Table,
Title Title
} from '@mantine/core'; } from '@mantine/core';
import { LoaderType } from '@mantine/styles/lib/theme/types/MantineTheme';
import { useState } from 'react'; import { useState } from 'react';
import { SizeMarks } from '../../../../defaults/defaults'; import { SizeMarks } from '../../../../defaults/defaults';
@@ -67,8 +66,8 @@ export function UserTheme({ height }: { height: number }) {
{ value: 'oval', label: t`oval` }, { value: 'oval', label: t`oval` },
{ value: 'dots', label: t`dots` } { value: 'dots', label: t`dots` }
]; ];
const [loader, setLoader] = useState<LoaderType>(theme.loader); const [loader, setLoader] = useState<string>(theme.loader);
function changeLoader(value: LoaderType) { function changeLoader(value: string) {
setLoader(value); setLoader(value);
useLocalState.setState({ loader: value }); useLocalState.setState({ loader: value });
} }

View File

@@ -114,7 +114,7 @@ export function RowActions({
> >
<Menu.Item <Menu.Item
color={action.color} color={action.color}
icon={action.icon} leftSection={action.icon}
onClick={(event) => { onClick={(event) => {
// Prevent clicking on the action from selecting the row itself // Prevent clicking on the action from selecting the row itself
cancelEvent(event); cancelEvent(event);

View File

@@ -217,7 +217,7 @@ export function BomTable({
can_build = Math.trunc(can_build); can_build = Math.trunc(can_build);
return ( return (
<Text color={can_build <= 0 ? 'red' : undefined}>{can_build}</Text> <Text c={can_build <= 0 ? 'red' : undefined}>{can_build}</Text>
); );
} }
}, },

View File

@@ -109,7 +109,7 @@ export default function BuildLineTable({ params = {} }: { params?: any }) {
available > 0 ? ( available > 0 ? (
available available
) : ( ) : (
<Text color="red" italic>{t`No stock available`}</Text> <Text c="red" italic>{t`No stock available`}</Text>
) )
} }
title={t`Available Stock`} title={t`Available Stock`}

View File

@@ -287,7 +287,10 @@ function MachineDrawer({
</ActionIcon> </ActionIcon>
</Group> </Group>
<Stack pos="relative" gap="xs"> <Stack pos="relative" gap="xs">
<LoadingOverlay visible={isFetching} overlayOpacity={0} /> <LoadingOverlay
visible={isFetching}
overlayProps={{ opacity: 0 }}
/>
<InfoItem name={t`Machine Type`}> <InfoItem name={t`Machine Type`}>
<Group gap="xs"> <Group gap="xs">
{machineType ? ( {machineType ? (

View File

@@ -102,7 +102,10 @@ function MachineTypeDrawer({ machineTypeSlug }: { machineTypeSlug: string }) {
</Group> </Group>
<Stack pos="relative" gap="xs"> <Stack pos="relative" gap="xs">
<LoadingOverlay visible={isFetching} overlayOpacity={0} /> <LoadingOverlay
visible={isFetching}
overlayProps={{ opacity: 0 }}
/>
<InfoItem name={t`Name`} value={machineType?.name} type="text" /> <InfoItem name={t`Name`} value={machineType?.name} type="text" />
<InfoItem name={t`Slug`} value={machineType?.slug} type="text" /> <InfoItem name={t`Slug`} value={machineType?.slug} type="text" />
<InfoItem <InfoItem
@@ -206,7 +209,10 @@ function MachineDriverDrawer({
</Group> </Group>
<Stack pos="relative" gap="xs"> <Stack pos="relative" gap="xs">
<LoadingOverlay visible={isFetching} overlayOpacity={0} /> <LoadingOverlay
visible={isFetching}
overlayProps={{ opacity: 0 }}
/>
<InfoItem name={t`Name`} value={machineDriver?.name} type="text" /> <InfoItem name={t`Name`} value={machineDriver?.name} type="text" />
<InfoItem name={t`Slug`} value={machineDriver?.slug} type="text" /> <InfoItem name={t`Slug`} value={machineDriver?.slug} type="text" />
<InfoItem <InfoItem

View File

@@ -141,7 +141,7 @@ function partTableColumns(): TableColumn[] {
<TableHoverCard <TableHoverCard
value={ value={
<Group gap="xs" justify="left" wrap="nowrap"> <Group gap="xs" justify="left" wrap="nowrap">
<Text color={color}>{text}</Text> <Text c={color}>{text}</Text>
{record.units && ( {record.units && (
<Text size="xs" color={color}> <Text size="xs" color={color}>
[{record.units}] [{record.units}]

View File

@@ -158,7 +158,7 @@ export function PluginDrawer({
/> />
</Group> </Group>
<LoadingOverlay visible={isFetching} overlayOpacity={0} /> <LoadingOverlay visible={isFetching} overlayProps={{ opacity: 0 }} />
<Card withBorder> <Card withBorder>
<Stack gap="md"> <Stack gap="md">

View File

@@ -179,7 +179,7 @@ function stockItemTableColumns(): TableColumn[] {
<TableHoverCard <TableHoverCard
value={ value={
<Group gap="xs" justify="left" wrap="nowrap"> <Group gap="xs" justify="left" wrap="nowrap">
<Text color={color}>{text}</Text> <Text c={color}>{text}</Text>
{part.units && ( {part.units && (
<Text size="xs" color={color}> <Text size="xs" color={color}>
[{part.units}] [{part.units}]