Skip to content

Commit

Permalink
Display comments, tags for an empty playlist (#5773)
Browse files Browse the repository at this point in the history
* Display comments, tags for an empty playlist

* Ramp build with related changes
  • Loading branch information
Dananji authored Apr 10, 2024
1 parent fc6e3da commit f958701
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 41 deletions.
81 changes: 44 additions & 37 deletions app/javascript/components/PlaylistRamp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ const Ramp = ({
let url = `${base_url}/playlists/${playlist_id}/manifest.json`;
if (token) url += `?token=${token}`;

let [fullpath, position] = fullpath_url.split('?position=');
let start_canvas = playlist_item_ids[position - 1]
let [_, position] = fullpath_url.split('?position=');
let start_canvas = playlist_item_ids[position - 1];
setStartCanvasId(
start_canvas && start_canvas != undefined
? `${base_url}/playlists/${playlist_id}/manifest/canvas/${start_canvas}`
: undefined
? `${base_url}/playlists/${playlist_id}/manifest/canvas/${start_canvas}`
: undefined
);
setManifestUrl(url);

Expand Down Expand Up @@ -97,40 +97,43 @@ const Ramp = ({
return (
<IIIFPlayer manifestUrl={manifestUrl}
customErrorMessage='This playlist is empty.'
emptyManifestMessage='This playlist currently has no playable items.'
startCanvasId={startCanvasId}>
<Row className="ramp--all-components ramp--playlist">
<Col sm={8}>
<MediaPlayer enableFileDownload={false} />
<Card className="ramp--playlist-accordion">
<Card.Header>
<h4>{activeItemTitle}</h4>
{activeItemSummary && <div>{activeItemSummary}</div>}
</Card.Header>
<Card.Body>
<Accordion>
<Card>
<Accordion.Collapse eventKey="0" id="markers">
<Card.Body>
<MarkersDisplay showHeading={false} />
</Card.Body>
</Accordion.Collapse>
<Accordion.Toggle as={Card.Header} variant="link" eventKey="0" className="ramp--playlist-accordion-header">
<ExpandCollapseArrow /> Markers
</Accordion.Toggle>
</Card>
<Card>
<Accordion.Collapse eventKey="1">
<Card.Body className="p-3">
<MetadataDisplay displayOnlyCanvasMetadata={true} showHeading={false} />
</Card.Body>
</Accordion.Collapse>
<Accordion.Toggle as={Card.Header} variant="link" eventKey="1" className="ramp--playlist-accordion-header">
<ExpandCollapseArrow /> Source Item Details
</Accordion.Toggle>
</Card>
</Accordion>
</Card.Body>
</Card>
{playlist_item_ids?.lenght > 0 && (
<Card className="ramp--playlist-accordion">
<Card.Header>
<h4>{activeItemTitle}</h4>
{activeItemSummary && <div>{activeItemSummary}</div>}
</Card.Header>
<Card.Body>
<Accordion>
<Card>
<Accordion.Collapse eventKey="0" id="markers">
<Card.Body>
<MarkersDisplay showHeading={false} />
</Card.Body>
</Accordion.Collapse>
<Accordion.Toggle as={Card.Header} variant="link" eventKey="0" className="ramp--playlist-accordion-header">
<ExpandCollapseArrow /> Markers
</Accordion.Toggle>
</Card>
<Card>
<Accordion.Collapse eventKey="1">
<Card.Body className="p-3">
<MetadataDisplay displayOnlyCanvasMetadata={true} showHeading={false} />
</Card.Body>
</Accordion.Collapse>
<Accordion.Toggle as={Card.Header} variant="link" eventKey="1" className="ramp--playlist-accordion-header">
<ExpandCollapseArrow /> Source Item Details
</Accordion.Toggle>
</Card>
</Accordion>
</Card.Body>
</Card>
)}
</Col>
<Col sm={4} className={`ramp--playlist-items-column ${IS_MOBILE ? 'mobile-view' : ''}`}>
<Row>
Expand All @@ -154,16 +157,20 @@ const Ramp = ({
}
</Col>
</Row>
<Row className="mx-0">
<Row className="mx-0 mb-2">
<Col md={12} lg={12} sm={12} className="px-0">
<div className="collapse" id="shareList">
<div dangerouslySetInnerHTML={{ __html: share.content }} />
</div>
</Col>
</Row>
<div dangerouslySetInnerHTML={{ __html: comment_tag.content }} />
<h4 className="mt-3">Playlist Items</h4>
<StructuredNavigation />
{playlist_item_ids?.length > 0 && (
<React.Fragment>
<h4 className="mt-3">Playlist Items</h4>
<StructuredNavigation />
</React.Fragment>
)}
</Col>
</Row>
</IIIFPlayer>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "7",
"@samvera/ramp": "^3.1.0",
"@samvera/ramp": "https://github.com/samvera-labs/ramp.git",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"buffer": "^6.0.3",
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1440,10 +1440,9 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@samvera/ramp@^3.1.0":
"@samvera/ramp@https://github.com/samvera-labs/ramp.git":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@samvera/ramp/-/ramp-3.1.0.tgz#6254646f34b9a434ff6e6046f1e013130d036e28"
integrity sha512-B5UiU0DDxi7Ub+DfbKC7j80zjMCmkuLnmDJNUqnftjO1L2gocdMOuUfYZ30pAh9SO9HbMCEtAFtLUHPlizPz3A==
resolved "https://github.com/samvera-labs/ramp.git#e3b34b978f8f8448317b3717db2ae52b359481da"
dependencies:
"@rollup/plugin-json" "^6.0.1"
"@silvermine/videojs-quality-selector" "^1.2.4"
Expand Down

0 comments on commit f958701

Please sign in to comment.