2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 14:11:37 +00:00

Consolidate rendering of inline items (#10189)

* Consolidate rendering of inline items

* Bug fix for user rendering
This commit is contained in:
Oliver
2025-08-19 08:01:52 +10:00
committed by GitHub
parent b4982fde1d
commit 57970b53ec
3 changed files with 5 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
import { Text } from '@mantine/core';
import type { ReactNode } from 'react'; import type { ReactNode } from 'react';
import { ModelType } from '@lib/enums/ModelType'; import { ModelType } from '@lib/enums/ModelType';
@@ -38,7 +37,7 @@ export function RenderCompany(
{...props} {...props}
image={instance.thumbnail || instance.image} image={instance.thumbnail || instance.image}
primary={instance.name} primary={instance.name}
secondary={instance.description} suffix={instance.description}
url={ url={
props.link ? getDetailUrl(ModelType.company, instance.pk) : undefined props.link ? getDetailUrl(ModelType.company, instance.pk) : undefined
} }
@@ -73,9 +72,7 @@ export function RenderSupplierPart(
image={ image={
part?.thumbnail ?? part?.image ?? supplier?.thumbnail ?? supplier?.image part?.thumbnail ?? part?.image ?? supplier?.thumbnail ?? supplier?.image
} }
suffix={ suffix={part.full_name}
part.full_name ? <Text size='sm'>{part.full_name}</Text> : undefined
}
url={ url={
props.link props.link
? getDetailUrl(ModelType.supplierpart, instance.pk) ? getDetailUrl(ModelType.supplierpart, instance.pk)
@@ -100,9 +97,7 @@ export function RenderManufacturerPart(
{...props} {...props}
primary={manufacturer.name} primary={manufacturer.name}
secondary={instance.MPN} secondary={instance.MPN}
suffix={ suffix={part.full_name}
part.full_name ? <Text size='sm'>{part.full_name}</Text> : undefined
}
image={manufacturer?.thumbnail ?? manufacturer.image} image={manufacturer?.thumbnail ?? manufacturer.image}
url={ url={
props.link props.link

View File

@@ -119,7 +119,7 @@ export function RenderSalesOrderShipment({
return ( return (
<RenderInlineModel <RenderInlineModel
primary={order.reference} primary={order.reference}
suffix={<Text size='sm'>{`${t`Shipment`} ${instance.reference}`}</Text>} suffix={<Text size='xs'>{`${t`Shipment`} ${instance.reference}`}</Text>}
/> />
); );
} }

View File

@@ -33,7 +33,7 @@ export function RenderUser({
primary={instance.username} primary={instance.username}
secondary={ secondary={
<Group gap='xs'> <Group gap='xs'>
{!instance.is_active && ( {instance.is_active === false && (
<Badge autoContrast color='red'>{t`Inactive`}</Badge> <Badge autoContrast color='red'>{t`Inactive`}</Badge>
)} )}
</Group> </Group>