Skip to content
Merged
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
10 changes: 6 additions & 4 deletions app/src/components/items/overview/metadata/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import { Fragment } from "react";
import parse from "html-react-parser";
import { metadataFieldToDisplay } from "@/src/utils/metadata/filterRenderableMetadata";

interface MetadataOverviewProps {
metadata: Record<string, string>;
}

// Designs use DS Link component but I wonder if we can get away with not using them for the
// Items page since the manifests are returning the links
const StructuredCollectionsList = (rawCollections) => {
Expand All @@ -35,16 +39,14 @@ const StructuredCollectionsList = (rawCollections) => {
);
};

const MetadataOverview = ({ metadata }) => {
const typedMetadata = metadata as Record<string, string>;

const MetadataOverview = ({ metadata }: MetadataOverviewProps) => {
return (
<>
<Box>
<Heading size="heading6" marginBottom="xs">
Item data
</Heading>
{Object.entries(typedMetadata).map(([field, value]) => {
{Object.entries(metadata).map(([field, value]) => {
if (field === "collection") {
const collections = value.split("<br>");
return (
Expand Down
7 changes: 6 additions & 1 deletion app/src/components/items/overview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import ExternalLinksOverview from "./external/overview";
import PrintOverview from "./print/overview";
import CitationsOverview from "./citations/overview";
import AVMaterialManifest from "./audiovisual/manifest";
import { ItemModel } from "@/src/models/item";

const ItemOverview = ({ item }) => {
interface ItemOverviewProps {
item: ItemModel;
}

const ItemOverview = ({ item }: ItemOverviewProps) => {
return (
<>
<ChakraSimpleGrid
Expand Down
1 change: 1 addition & 0 deletions app/src/types/NormalizedItemMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type NormalizedItemMetadata = {
title: string;
altTitle?: string;
names?: string;
collection?: string;
origin: string;
Expand Down
1 change: 1 addition & 0 deletions app/src/utils/metadata/filterRenderableMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const metadataFieldToDisplay: Record<string, string> = {
title: "Title",
altTitle: "Alt Title",
collection: "Collection",
names: "Names",
origin: "Date / Origin",
Expand Down
1 change: 1 addition & 0 deletions app/src/utils/metadata/normalizeItemMetdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function normalizeItemMetadataFromManifest(
): NormalizedItemMetadata {
return {
title: raw["Title"]?.[0] || "",
altTitle: joinWithBr(raw["Alt Title"]),
collection: joinWithBr(raw["Collection"]),
names: joinWithBr(raw["Names"]),
origin: joinWithBr(raw["Dates / Origin"]),
Expand Down