Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 7 additions & 41 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/components/BomTable/BomTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { convertCircuitJsonToBomRows } from "circuit-json-to-bom-csv"
import { useEffect, useState } from "react"
import type React from "react"
import { loadBomCsvConverter } from "../../optional-features/exporting/dynamic-converters"
import { getBomCellDescriptors, getBomMetadata } from "./bom-table.columns"
import type { BomRow, BomTableProps } from "./bom-table.types"

Expand All @@ -16,6 +16,7 @@ export const BomTable: React.FC<BomTableProps> = ({ circuitJson }) => {
setError(null)
setRows(null)

const { convertCircuitJsonToBomRows } = await loadBomCsvConverter()
const bomRows = await convertCircuitJsonToBomRows({
circuitJson,
})
Expand Down
16 changes: 12 additions & 4 deletions lib/components/BomTable/bom-table.types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import type { AnyCircuitElement } from "circuit-json"
import type { convertCircuitJsonToBomRows } from "circuit-json-to-bom-csv"
import type React from "react"

export interface BomTableProps {
circuitJson: AnyCircuitElement[]
}

export type BomRow = Awaited<
ReturnType<typeof convertCircuitJsonToBomRows>
>[number]
export type BomRow = {
designator?: string
comment?: string
value?: string
footprint?: string
supplier_part_number_columns?: Record<string, string>
extra_columns?: Record<string, string>
manufacturer_mpn_pairs?: Array<{
manufacturer: string
mpn: string
}>
}

export type BomMetadata = {
extraColumnNames: string[]
Expand Down
Loading