Skip to content

Commit 62bb609

Browse files
committed
#3918 feat: add isCopied icon and tooltip
1 parent 8cb5c14 commit 62bb609

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const BOMTable: React.FC<BOMTableProps> = ({ setHideColumn, assignMaterial, colu
6363
subtotal: '',
6464
link: '',
6565
notes: '',
66-
assemblyId: assembly.assemblyId
66+
assemblyId: assembly.assemblyId,
67+
isCopied: false
6768
});
6869

6970
assemblyMaterials.forEach((material, indx) => materialsWithAssemblies.push(materialToRow(material, indx)));

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTableWrapper.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { useToast } from '../../../../hooks/toasts.hooks';
1111
import { useAssignMaterialToAssembly, useDeleteAssembly, useDeleteMaterial } from '../../../../hooks/bom.hooks';
1212
import LoadingIndicator from '../../../../components/LoadingIndicator';
1313
import EditMaterialModal from './MaterialForm/EditMaterialModal';
14-
import { Button, Link, Typography } from '@mui/material';
14+
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
15+
import { Button, Link, Tooltip, Typography } from '@mui/material';
1516
import { bomBaseColDef } from '../../../../utils/bom.utils';
1617
import NERModal from '../../../../components/NERModal';
1718
import { renderStatusBOM } from './BOMTableCustomCells';
@@ -292,10 +293,22 @@ const BOMTableWrapper: React.FC<BOMTableWrapperProps> = ({
292293
flex: 1.5,
293294
field: 'name',
294295
headerName: 'Name',
295-
type: 'string',
296296
sortable: false,
297297
filterable: false,
298-
hide: hideColumn[3]
298+
hide: hideColumn[3],
299+
renderCell: (params) => {
300+
const material = materials.find((m) => m.materialId === params.row.materialId);
301+
return (
302+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
303+
<Typography variant="body2">{params.value}</Typography>
304+
{material?.isCopied && (
305+
<Tooltip title="Copied from another BOM">
306+
<ContentCopyIcon sx={{ fontSize: 14, color: 'warning.main' }} />
307+
</Tooltip>
308+
)}
309+
</Box>
310+
);
311+
}
299312
},
300313
{
301314
...bomBaseColDef,

src/frontend/src/utils/bom.utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface BomRow extends GridValidRowModel {
2020
link: string;
2121
notes: string | undefined;
2222
assemblyId: string | undefined;
23+
isCopied: boolean;
2324
}
2425

2526
export const materialToRow = (material: Material, idx: number): BomRow => {
@@ -38,7 +39,8 @@ export const materialToRow = (material: Material, idx: number): BomRow => {
3839
subtotal: material.subtotal !== undefined ? `$${centsToDollar(material.subtotal)}` : '',
3940
link: material.linkUrl,
4041
notes: material.notes,
41-
assemblyId: material.assemblyId ?? 'assembly-misc'
42+
assemblyId: material.assemblyId ?? 'assembly-misc',
43+
isCopied: material.isCopied
4244
};
4345
};
4446

0 commit comments

Comments
 (0)