From 0223f683c5df09c45491960e00330578472da10b Mon Sep 17 00:00:00 2001 From: Raff Viglianti Date: Mon, 28 Oct 2024 16:06:12 -0400 Subject: [PATCH] pages for collections --- src/templates/collection.tsx | 108 +++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 src/templates/collection.tsx diff --git a/src/templates/collection.tsx b/src/templates/collection.tsx new file mode 100644 index 000000000..566ecb4c5 --- /dev/null +++ b/src/templates/collection.tsx @@ -0,0 +1,108 @@ +import * as React from "react" +import { graphql, Link, type HeadFC, type PageProps } from "gatsby" +import Layout from "../components/Layout" + +const Collection: React.FC = ({pageContext}) => { + const data = pageContext as Queries.qCollectionsQuery["allAirtableScdItems"]["nodes"][0]["data"] + const d = data! + const faURL = d._xxxcollectionFindingAidUrlxtxt && d._xxxcollectionFindingAidUrlxtxt.startsWith("http") ? d._xxxcollectionFindingAidUrlxtxt : `http://${d._xxxcollectionFindingAidUrlxtxt}` + const catURL = d._xxxcollectionCatalogUrlxtxt && d._xxxcollectionCatalogUrlxtxt.startsWith("http") ? d._xxxcollectionCatalogUrlxtxt : `http://${d._xxxcollectionCatalogUrlxtxt}` + const webURL = d._xxxcollectionWebsiteUrlxtxt && d._xxxcollectionWebsiteUrlxtxt.startsWith("http") ? d._xxxcollectionWebsiteUrlxtxt : `http://${d._xxxcollectionWebsiteUrlxtxt}` + const ctypes = d._xxxcollectionContentTypesxtxtxxxcollectionContentTypesxtxt || [] + const genres = d._xxxcollectionGenresxtxtxxxcollectionGenresxtxt || [] + const langs = d._xxxcollectionLanguagesxtxtxxxcollectionLanguagesxtxt || [] + const loc = [] + d._xxxcollectionOwnerLocationCityxtxt ? loc.push(d._xxxcollectionOwnerLocationCityxtxt) : false; + d._xxxcollectionOwnerLocationStatextxt ? loc.push(d._xxxcollectionOwnerLocationStatextxt) : false; + d._xxxcollectionOwnerLocationCountryxtxt ? loc.push(d._xxxcollectionOwnerLocationCountryxtxt) : false; + + return ( + +
+
+
+

+ {d._xxxcollectionTitlextxt} +

+

« Back to search

+ + + {d._xxxcollectionDescriptionxtxt && + + + } + { // additional fields for public entries. + d.scd_publish_status !== "collection-owner-title-description-only" && <> + + + + + {genres.length > 0 && + + + + + } + {d._xcollectionFormatsxtxtxxxcollectionFormatsxtxt && + + + } + {d._xxxcollectionExtentxtxt && + + + } + {langs.length > 0 && + + + + + } + {d._xxxcollectionNotesxtxt && + + + + + } + {d._xxxcollectionFindingAidUrlxtxt && + + + } + {d._xxxcollectionCatalogUrlxtxt && + + + } + {d._xxxcollectionWebsiteUrlxtxt && + + + } + + } + + + + + { // additional fields for public entries. + d.scd_publish_status !== "collection-owner-title-description-only" && <> + + + + + {d._xxxcollectionUsageStatementxtxt && + + + + + } + } + +
Description:{d._xxxcollectionDescriptionxtxt}
Content type{ctypes.length > 1 ? 's': ''}:{ctypes.join("; ")}
Genre{genres.length > 1 ? 's': ''}:{genres.join("; ")}
Format:{d._xcollectionFormatsxtxtxxxcollectionFormatsxtxt}
Extent:{d._xxxcollectionExtentxtxt}
Language{langs.length > 1 ? 's': ''}:{langs.join("; ")}
Additional notes:{d._xxxcollectionNotesxtxt}
Online finding aid:View on {new URL(faURL).hostname}
Online catalog:View on {new URL(catURL).hostname}
Collection website:View on {new URL(webURL).hostname}
Repository/Collector:{d._xxxcollectionOwnerNamextxt}
Location:{loc.join(", ")}
Usage statement:{d._xxxcollectionUsageStatementxtxt}
+
+
+
+
+ ) +} + +export default Collection + +export const Head: HeadFC = ({pageContext}) => {(pageContext as Queries.qCollectionsQuery["allAirtableScdItems"]["nodes"][0]["data"])?._xxxcollectionTitlextxt} | RPTF/ARSC Sound Collections Database