diff --git a/src/components/ItemTable/ItemTable.tsx b/src/components/ItemTable/ItemTable.tsx
index 2729f8b41..f5beb92aa 100644
--- a/src/components/ItemTable/ItemTable.tsx
+++ b/src/components/ItemTable/ItemTable.tsx
@@ -10,9 +10,11 @@ interface ItemTableProps {
* The ItemTable displays the Item info, StatusLinks, and RequestButtons
*/
const ItemTable = ({ itemTableData }: ItemTableProps) => {
- console.log(itemTableData)
return (
-
+
)
diff --git a/src/models/ItemTableData.ts b/src/models/ItemTableData.ts
index c5f26a99c..a550330a0 100644
--- a/src/models/ItemTableData.ts
+++ b/src/models/ItemTableData.ts
@@ -14,7 +14,6 @@ export default class ItemTableData {
isDesktop: boolean
isBibPage: boolean
isArchiveCollection: boolean
- tableHeadings: string[]
tableData: string[][]
constructor(items: Item[], itemTableParams: ItemTableParams) {
@@ -22,11 +21,34 @@ export default class ItemTableData {
this.isDesktop = itemTableParams.isDesktop
this.isBibPage = itemTableParams.isBibPage
this.isArchiveCollection = itemTableParams.isArchiveCollection
- this.tableHeadings = []
this.tableData = [[]]
}
+ get tableHeadings(): string[] {
+ return [
+ ...(this.hasStatusColumn() ? ["Status"] : []),
+ ...(this.hasVolumeColumn() ? [this.volumeColumnHeading()] : []),
+ "Format",
+ ...(!this.hasVolumeColumn() && !this.isDesktop ? ["Call Number"] : []),
+ ...(this.isBibPage && this.isDesktop ? ["Access"] : []),
+ ...(this.isDesktop ? ["Call Number"] : []),
+ ...(this.hasLocationColumn ? ["Item Location"] : []),
+ ]
+ }
+
hasVolumeColumn(): boolean {
return this.items.some((item) => item.volume?.length) && this.isBibPage
}
+
+ hasStatusColumn(): boolean {
+ return this.isBibPage
+ }
+
+ hasLocationColumn(): boolean {
+ return this.isDesktop
+ }
+
+ volumeColumnHeading(): string {
+ return this.isArchiveCollection ? "Vol/Date" : "Container"
+ }
}
diff --git a/src/utils/itemUtils.ts b/src/utils/itemUtils.ts
index fbdc6106d..1e779bb13 100644
--- a/src/utils/itemUtils.ts
+++ b/src/utils/itemUtils.ts
@@ -33,22 +33,3 @@ export const locationEndpointsMap: Record<
export function locationLabelToKey(label: string): ItemLocationKey {
return label.replace(/SASB/, "Schwarzman").split(" ")[0] as ItemLocationKey
}
-
-export const getItemTableHeadings = (
- isDesktop = true,
- isBibPage = false,
- isArchiveCollection = false,
- includeVolColumn = false
-) => {
- const volColumnHeading = isArchiveCollection ? "Vol/Date" : "Container"
-
- return [
- ...(isBibPage ? ["Status"] : []),
- ...(includeVolColumn ? [volColumnHeading] : []),
- "Format",
- ...(!includeVolColumn && !isDesktop ? ["Call Number"] : []),
- ...(isBibPage && isDesktop ? ["Access"] : []),
- ...(isDesktop ? ["Call Number"] : []),
- ...(isDesktop ? ["Item Location"] : []),
- ]
-}