Skip to content

Commit

Permalink
'add aapb record block handling, remove aapb record group field handl…
Browse files Browse the repository at this point in the history
…ing'
  • Loading branch information
foglabs committed Dec 20, 2023
1 parent ba0a87e commit 56f7f67
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 30 deletions.
19 changes: 19 additions & 0 deletions app/classes/aapbRecordHelpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ import React, { Component } from 'react'

const AAPB_HOST = "https://americanarchive.org"

export function handleAapbRecordGroup(aapbRecordGroup, key){
// this func is where we split by whitespace v
var guids = parseAapbRecordGroup(aapbRecordGroup.value.guids)

// preserve these flags' effect for each aapb_record_group
var showThumbnail = aapbRecordGroup.value.show_thumbnail
var showTitle = aapbRecordGroup.value.show_title

var aapbRecords = guids.map( (guid, index) => {
return <AAPBRecord key={ index } guid={ guid } showTitle={ showTitle } showThumbnail={ showThumbnail } />
})

return (
<div key={ key } className="aapb-record-group">
{ aapbRecords }
</div>
)
}

export function parseAapbGuids(aapbRecordGroups){
// this flattens grousp into one group, will delete

Expand Down
27 changes: 1 addition & 26 deletions app/classes/collectionPresenter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { decode } from "html-entities"
import { renderAuthorBubble, renderPageLink, renderPageLinks, renderSidebar, renderSidebarSection, renderPageTitleBar } from "~/classes/pageHelpers"
import { renderBlocks, renderBlock, textContent, interviewsContent, archivalFootageContent, photographsContent, originalFootageContent, relatedContentContent, creditsContent, headingContent, imageContent } from "~/classes/contentHelpers"
import { parseAapbRecordGroup, AAPBRecord } from "~/classes/aapbRecordHelpers"
import { handleAapbRecordGroup, AAPBRecord } from "~/classes/aapbRecordHelpers"

export function renderCollection(collection){
// console.log( 'collection data', collection )
Expand Down Expand Up @@ -39,30 +39,6 @@ export function renderCollection(collection){
)
}

let aapbRecordGroups
if(collection.aapb_records){
// collection.aapb_records is an array of aapb_record_groups

aapbRecordGroups = collection.aapb_records.map( (aapbRecordGroup, index) => {
// this func is where we split by whitespace v
var guids = parseAapbRecordGroup(aapbRecordGroup.value.ids)

// preserve these flags' effect for each aapb_record_group
var showThumbnail = aapbRecordGroup.value.show_thumbnail
var showTitle = aapbRecordGroup.value.show_title

var aapbRecords = guids.map( (guid, index) => {
return <AAPBRecord key={ index } guid={ guid } showTitle={ showTitle } showThumbnail={ showThumbnail } />
})

return (
<div key={ index } className="aapb-record-group">
{ aapbRecords }
</div>
)
})
}

return (
<div>
<div className="page-container">
Expand All @@ -73,7 +49,6 @@ export function renderCollection(collection){
<div className="page-body">
{ introduction }
{ blockContent }
{ aapbRecordGroups }
</div>
</div>

Expand Down
14 changes: 11 additions & 3 deletions app/classes/contentHelpers.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { decode } from "html-entities"
import { AAPBRecord } from "~/classes/aapbRecordHelpers"
import { handleAapbRecordGroup, AAPBRecord } from "~/classes/aapbRecordHelpers"

export function renderBlocks(blocks){
// jsx likes to be in an array to be concatted when rendered
Expand All @@ -15,7 +15,15 @@ export function renderBlock(block, key){
if(block.type == "text"){
return textContent(block, key)
} else if(block.type == "interviews"){
return interviewsContent(block, key)

console.log( 'show me da block', block )
// here its an aapbrecordgroup
return (
<div>
<div className="guids-block-title" dangerouslySetInnerHTML={{ __html: decode(block.value.title) }} />
{ handleAapbRecordGroup(block, key) }
</div>
)
} else if(block.type == "programs"){
return programsContent(block, key)
// } else if(block.type == "archivalFootage"){
Expand All @@ -36,6 +44,7 @@ export function renderBlock(block, key){
return creditsContent(block, key)

} else if(block.type == "aapb_record"){
// just an example
// share the AAPBRecord component with the separate aapb_record_group feature
return <AAPBRecord key={ key } guid={ block.guid } />
} else {
Expand Down Expand Up @@ -137,7 +146,6 @@ function devImgSrc(src){
}
}

// export function interviewsContent(block){}
// export function archivalFootageContent(block){}
// export function photographsContent(block){}
// export function originalFootageContent(block){}
Expand Down
20 changes: 19 additions & 1 deletion app/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ a.content-aapbblock {
text-align: center;
display: inline-block;
position: relative;
margin-top: 4vh;
}

a.content-aapbblock div.shade-bar {
Expand Down Expand Up @@ -707,6 +706,16 @@ a.content-aapbblock div.blue-circle div {

div.aapb-record-group {}

div.guids-block-title {
font-size: 2vw;
font-weight: bold;
margin-left: 1vw;
}

div.guids-block-title p {
padding-left: 0;
}

@media only screen and (max-width: 900px) {
/* navigation */
.mobile-hidden {
Expand Down Expand Up @@ -903,4 +912,13 @@ div.aapb-record-group {}
div.bottom-bar-logos img {
width: 30vw;
}

div.page-authorbubble-container {
margin-left: 4vw;
}

div.page-authorbubble-container div.author-byline {
bottom: 0;
display: block;
}
}

0 comments on commit 56f7f67

Please sign in to comment.