diff --git a/src/frontend/src/components/details/Details.tsx b/src/frontend/src/components/details/Details.tsx index 5395033a05..52883d1242 100644 --- a/src/frontend/src/components/details/Details.tsx +++ b/src/frontend/src/components/details/Details.tsx @@ -380,16 +380,15 @@ export function DetailsTableField({ - + {field.label} - + @@ -409,7 +408,11 @@ export function DetailsTable({ title?: string; }>) { return ( - + {title && {title}} diff --git a/src/frontend/src/components/details/DetailsImage.tsx b/src/frontend/src/components/details/DetailsImage.tsx index 09104900e5..89a61f4159 100644 --- a/src/frontend/src/components/details/DetailsImage.tsx +++ b/src/frontend/src/components/details/DetailsImage.tsx @@ -2,6 +2,7 @@ import { Trans, t } from '@lingui/macro'; import { AspectRatio, Button, + Grid, Group, Image, Overlay, @@ -421,31 +422,39 @@ export function DetailsImage(props: Readonly) { return ( <> {downloadImage.modal} - - <> - - {permissions.hasChangeRole(props.appRole) && - hasOverlay && - hovered && ( - - - - )} - - + + + <> + + {permissions.hasChangeRole(props.appRole) && + hasOverlay && + hovered && ( + + + + )} + + + ); } diff --git a/src/frontend/src/components/details/ItemDetails.tsx b/src/frontend/src/components/details/ItemDetails.tsx index 77750caf7e..1d0b79d7da 100644 --- a/src/frontend/src/components/details/ItemDetails.tsx +++ b/src/frontend/src/components/details/ItemDetails.tsx @@ -1,16 +1,15 @@ import { Paper, SimpleGrid } from '@mantine/core'; -import { useElementSize } from '@mantine/hooks'; import type React from 'react'; -import { useMemo } from 'react'; export function ItemDetailsGrid(props: React.PropsWithChildren<{}>) { - const { ref, width } = useElementSize(); - - const cols = useMemo(() => (width > 700 ? 2 : 1), [width]); - return ( - + {props.children} diff --git a/src/frontend/src/components/nav/PageDetail.tsx b/src/frontend/src/components/nav/PageDetail.tsx index 28cfecd037..0382516068 100644 --- a/src/frontend/src/components/nav/PageDetail.tsx +++ b/src/frontend/src/components/nav/PageDetail.tsx @@ -1,7 +1,8 @@ -import { Group, Paper, Space, Stack, Text } from '@mantine/core'; +import { Group, Paper, SimpleGrid, Stack, Text } from '@mantine/core'; import { useHotkeys } from '@mantine/hooks'; -import { Fragment, type ReactNode } from 'react'; +import { Fragment, type ReactNode, useMemo } from 'react'; +import { shortenString } from '../../functions/tables'; import { ApiImage } from '../images/ApiImage'; import { StylishText } from '../items/StylishText'; import { type Breadcrumb, BreadcrumbList } from './BreadcrumbList'; @@ -51,9 +52,41 @@ export function PageDetail({ ] ]); + const pageTitleString = useMemo( + () => + shortenString({ + str: title, + len: 50 + }), + [title] + ); + + const description = useMemo( + () => + shortenString({ + str: subtitle, + len: 75 + }), + [subtitle] + ); + + const maxCols = useMemo(() => { + let cols = 1; + + if (!!detail) { + cols++; + } + + if (!!badges) { + cols++; + } + + return cols; + }, [detail, badges]); + return ( <> - + {breadcrumbs && breadcrumbs.length > 0 && ( )} - - + + {imageUrl && ( )} @@ -79,30 +124,33 @@ export function PageDetail({ {subtitle && ( {icon} - - {subtitle} - + {description} )} - - {detail} - - {badges?.map((badge, idx) => ( - {badge} - ))} - - - {actions && ( - - {actions.map((action, idx) => ( - {action} + {detail &&
{detail}
} + {badges && ( + + {badges?.map((badge, idx) => ( + {badge} ))} )} -
-
+ + {actions && ( + + {actions.map((action, idx) => ( + {action} + ))} + + )} +
diff --git a/src/frontend/src/pages/build/BuildDetail.tsx b/src/frontend/src/pages/build/BuildDetail.tsx index ec0bbecd4d..c28090d6bd 100644 --- a/src/frontend/src/pages/build/BuildDetail.tsx +++ b/src/frontend/src/pages/build/BuildDetail.tsx @@ -239,16 +239,14 @@ export default function BuildDetail() { return ( - - - - - + + + diff --git a/src/frontend/src/pages/company/CompanyDetail.tsx b/src/frontend/src/pages/company/CompanyDetail.tsx index 56c4b3ecff..11e4c8dce6 100644 --- a/src/frontend/src/pages/company/CompanyDetail.tsx +++ b/src/frontend/src/pages/company/CompanyDetail.tsx @@ -145,22 +145,20 @@ export default function CompanyDetail(props: Readonly) { return ( - - - - - + + + diff --git a/src/frontend/src/pages/company/ManufacturerPartDetail.tsx b/src/frontend/src/pages/company/ManufacturerPartDetail.tsx index c68136fe01..6b8350eab9 100644 --- a/src/frontend/src/pages/company/ManufacturerPartDetail.tsx +++ b/src/frontend/src/pages/company/ManufacturerPartDetail.tsx @@ -133,19 +133,17 @@ export default function ManufacturerPartDetail() { return ( - - - - - + + + diff --git a/src/frontend/src/pages/company/SupplierPartDetail.tsx b/src/frontend/src/pages/company/SupplierPartDetail.tsx index e3e4bec417..f5c9c51f0d 100644 --- a/src/frontend/src/pages/company/SupplierPartDetail.tsx +++ b/src/frontend/src/pages/company/SupplierPartDetail.tsx @@ -217,18 +217,16 @@ export default function SupplierPartDetail() { return ( - - - - + + diff --git a/src/frontend/src/pages/part/PartDetail.tsx b/src/frontend/src/pages/part/PartDetail.tsx index 248298612d..90953b271f 100644 --- a/src/frontend/src/pages/part/PartDetail.tsx +++ b/src/frontend/src/pages/part/PartDetail.tsx @@ -5,7 +5,6 @@ import { Grid, Loader, Skeleton, - Space, Stack, Text } from '@mantine/core'; @@ -439,23 +438,21 @@ export default function PartDetail() { return part ? ( - - - - - + + + @@ -1040,9 +1037,7 @@ export default function PartDetail() { }} /> - ) : ( - - ) + ) : null } /> - - - - - + + + diff --git a/src/frontend/src/pages/sales/ReturnOrderDetail.tsx b/src/frontend/src/pages/sales/ReturnOrderDetail.tsx index d598134805..e63f484dd3 100644 --- a/src/frontend/src/pages/sales/ReturnOrderDetail.tsx +++ b/src/frontend/src/pages/sales/ReturnOrderDetail.tsx @@ -233,16 +233,14 @@ export default function ReturnOrderDetail() { return ( - - - - - + + + diff --git a/src/frontend/src/pages/sales/SalesOrderDetail.tsx b/src/frontend/src/pages/sales/SalesOrderDetail.tsx index c0b7e0fa23..282dcf2d49 100644 --- a/src/frontend/src/pages/sales/SalesOrderDetail.tsx +++ b/src/frontend/src/pages/sales/SalesOrderDetail.tsx @@ -243,16 +243,14 @@ export default function SalesOrderDetail() { return ( - - - - - + + + diff --git a/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx b/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx index 1a5e3631b6..a40c1b9b49 100644 --- a/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx +++ b/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx @@ -175,22 +175,20 @@ export default function SalesOrderShipmentDetail() { return ( <> - - - - - + + + diff --git a/src/frontend/src/pages/stock/StockDetail.tsx b/src/frontend/src/pages/stock/StockDetail.tsx index a4ffb6c3ad..3b069e99f4 100644 --- a/src/frontend/src/pages/stock/StockDetail.tsx +++ b/src/frontend/src/pages/stock/StockDetail.tsx @@ -346,19 +346,16 @@ export default function StockDetail() { return ( - - - - - + + +