2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-01-28 09:03:41 +00:00

[UI] Add notification dot to all notes panel tabs when there's a note (#11195)

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
Sam W
2026-01-27 00:55:54 +00:00
committed by GitHub
parent 89ff4be082
commit ec60a37cd1
13 changed files with 51 additions and 24 deletions

View File

@@ -10,11 +10,13 @@ import type { PanelType } from './Panel';
export default function NotesPanel({ export default function NotesPanel({
model_type, model_type,
model_id, model_id,
editable editable,
has_note
}: { }: {
model_type: ModelType; model_type: ModelType;
model_id: number | undefined; model_id: number | undefined;
editable?: boolean; editable?: boolean;
has_note?: boolean;
}): PanelType { }): PanelType {
const user = useUserState.getState(); const user = useUserState.getState();
@@ -22,6 +24,7 @@ export default function NotesPanel({
name: 'notes', name: 'notes',
label: t`Notes`, label: t`Notes`,
icon: <IconNotes />, icon: <IconNotes />,
notification_dot: has_note ? 'info' : null,
content: content:
model_type && model_id ? ( model_type && model_id ? (
<NotesEditor <NotesEditor

View File

@@ -8,6 +8,7 @@ export type PanelType = {
label: string; label: string;
controls?: ReactNode; controls?: ReactNode;
icon?: ReactNode; icon?: ReactNode;
notification_dot?: 'info' | 'warning' | 'danger' | null;
content?: ReactNode; content?: ReactNode;
hidden?: boolean; hidden?: boolean;
disabled?: boolean; disabled?: boolean;

View File

@@ -3,6 +3,7 @@ import {
Box, Box,
Divider, Divider,
Group, Group,
Indicator,
Loader, Loader,
Paper, Paper,
Stack, Stack,
@@ -253,19 +254,31 @@ function BasePanelGroup({
handlePanelChange(panel.name, event) handlePanelChange(panel.name, event)
} }
> >
<Group justify='left' gap='xs' wrap='nowrap'> <Indicator
<UnstyledButton color={
component={'a'} panel.notification_dot == 'info'
style={{ ? 'blue'
textAlign: 'left' : panel.notification_dot == 'warning'
}} ? 'yellow'
href={generateUrl( : 'red'
`/${getBaseUrl()}${location.pathname}/${panel.name}` }
)} position='middle-end'
> disabled={!panel.notification_dot}
{expanded && panel.label} >
</UnstyledButton> <Group justify='left' gap='xs' wrap='nowrap'>
</Group> <UnstyledButton
component={'a'}
style={{
textAlign: 'left'
}}
href={generateUrl(
`/${getBaseUrl()}${location.pathname}/${panel.name}`
)}
>
{expanded && panel.label}
</UnstyledButton>
</Group>
</Indicator>
</Tabs.Tab> </Tabs.Tab>
</Tooltip> </Tooltip>
) )

View File

@@ -530,7 +530,8 @@ export default function BuildDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.build, model_type: ModelType.build,
model_id: build.pk model_id: build.pk,
has_note: !!build.notes
}) })
]; ];
}, [ }, [

View File

@@ -276,7 +276,8 @@ export default function CompanyDetail(props: Readonly<CompanyDetailProps>) {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.company, model_type: ModelType.company,
model_id: company.pk model_id: company.pk,
has_note: !!company.notes
}) })
]; ];
}, [id, company, user]); }, [id, company, user]);

View File

@@ -198,7 +198,8 @@ export default function ManufacturerPartDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.manufacturerpart, model_type: ModelType.manufacturerpart,
model_id: manufacturerPart?.pk model_id: manufacturerPart?.pk,
has_note: !!manufacturerPart?.notes
}) })
]; ];
}, [user, manufacturerPart]); }, [user, manufacturerPart]);

View File

@@ -295,7 +295,8 @@ export default function SupplierPartDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.supplierpart, model_type: ModelType.supplierpart,
model_id: supplierPart?.pk model_id: supplierPart?.pk,
has_note: !!supplierPart?.notes
}) })
]; ];
}, [supplierPart]); }, [supplierPart]);

View File

@@ -971,7 +971,8 @@ export default function PartDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.part, model_type: ModelType.part,
model_id: part?.pk model_id: part?.pk,
has_note: !!part?.notes
}) })
]; ];
}, [id, part, user, globalSettings, userSettings, detailsPanel]); }, [id, part, user, globalSettings, userSettings, detailsPanel]);

View File

@@ -400,7 +400,8 @@ export default function PurchaseOrderDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.purchaseorder, model_type: ModelType.purchaseorder,
model_id: order.pk model_id: order.pk,
has_note: !!order.notes
}) })
]; ];
}, [order, id, user]); }, [order, id, user]);

View File

@@ -365,7 +365,8 @@ export default function ReturnOrderDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.returnorder, model_type: ModelType.returnorder,
model_id: order.pk model_id: order.pk,
has_note: !!order.notes
}) })
]; ];
}, [order, id, user]); }, [order, id, user]);

View File

@@ -438,7 +438,8 @@ export default function SalesOrderDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.salesorder, model_type: ModelType.salesorder,
model_id: order.pk model_id: order.pk,
has_note: !!order.notes
}) })
]; ];
}, [order, id, user, soStatus, user]); }, [order, id, user, soStatus, user]);

View File

@@ -275,7 +275,8 @@ export default function SalesOrderShipmentDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.salesordershipment, model_type: ModelType.salesordershipment,
model_id: shipment.pk model_id: shipment.pk,
has_note: !!shipment.notes
}) })
]; ];
}, [isPending, shipment, detailsPanel]); }, [isPending, shipment, detailsPanel]);

View File

@@ -623,7 +623,8 @@ export default function StockDetail() {
}), }),
NotesPanel({ NotesPanel({
model_type: ModelType.stockitem, model_type: ModelType.stockitem,
model_id: stockitem.pk model_id: stockitem.pk,
has_note: !!stockitem.notes
}) })
]; ];
}, [ }, [