Repository navigation
Upgrade to clover v4.x - #517
Conversation
|
This looks great. I would like to spend a bit of time combing through the site in detail. At first glance, the viewer is looking nice but the slider in Related Items could use some touchups. Thanks for pushing through. Also we are now at 4.5.6!!! |
Slider notes (Explore Further / related-items sliders)1. Prev/next buttons sit ~24px too high. Clover positions them off a variable this branch doesn't update: :is(button.clover-items-scroll-prev, button.clover-items-scroll-next) {
position: absolute;
top: calc(var(--clover-items-picture-height) / 2);
translate: 0 -50%;
}
.clover-items { --clover-items-picture-height: var(--clover-items-height, 8rem); }Clover's slider sizes pictures by height ( They should be vertically centered on the card image (not the card including its caption). Setting .styledSliderIIIFWrapper :global(.clover-items-frame) { container-type: inline-size; }
.styledSliderIIIFWrapper :global(.clover-items) {
--clover-items-picture-height: calc(
(100cqw - (var(--slider-columns) - 1) * var(--slider-gap)) / var(--slider-columns)
);
}2. Buttons should hang off the slider edge. Clover insets them ( 3. Style the clamped-label overlay like the "View as IIIF" popover. The full-text box that appears on hover/focus is Also: upgrade to Clover 4.9.2
|
Download and Share crashes on a video workOpening Download and Share on an Audio/Video work throws Cause. // components/Work/ActionsDialog/ContentState/ContentState.tsx:78-79
const targetSelector = contentState?.json?.target?.selector;
const selectorValue = targetSelector?.t || targetSelector?.value;Clover 4 always writes a FragmentSelector instead ( const fragment = time != null && time > 0 ? `t=${Math.round(time * 100) / 100}` : region ? `xywh=…` : null;
selector: { type: "FragmentSelector", value: fragment }So Scope. A/V only: Fix direction. Parse seconds out of the fragment rather than reading const seconds =
targetSelector?.t ??
Number(/(?:^|[?&#])?t=([\d.]+)/.exec(targetSelector?.value ?? "")?.[1]);and guard |
Viewer thumbnail rail needs a max width for very wide itemsOn a work with a panoramic still — e.g. Measured in the rail (
Cause. Clover's slider sizes thumbnails by height alone, with no cap: .clover-items[data-layout=slider] .clover-items-picture img {
width: auto;
height: var(--clover-items-picture-height);
}
Suggested fix — cap the width and crop rather than squash, alongside the existing .viewerWrapperStyled :global(.clover-items[data-layout="slider"]) .clover-items-picture img {
max-width: calc(2 * var(--clover-items-picture-height));
object-fit: cover;
}Related, worth fixing in the same pass: |
…and a min width for narrow items in the viewer rail — squaring them handles both endsSame root cause as the max-width note above (Clover's slider sizes thumbnails by height,
Thumbnail widths span 82px to 196px in a single strip — a 2.4× spread — and the two narrowest squeeze their labels onto two lines while their neighbours stay on one, which is what makes the row look ragged. The strip isn't even full (~585px of items in an 842px frame), so the cramping buys nothing. Rather than a separate .viewerWrapperStyled :global(.clover-items[data-layout="slider"]) .clover-items-picture {
width: var(--clover-items-picture-height);
}
.viewerWrapperStyled :global(.clover-items[data-layout="slider"]) .clover-items-picture img {
width: 100%;
height: 100%;
object-fit: contain;
}
Two things to check when implementing:
|
"View all" on the sliders should read as a link, not a filled pillAs it stands the pill sits awkwardly next to the work page's other controls — measured on
Rather than growing the pill to match the button, drop the pill and style it as a text link. It is a navigational affordance in a section header, not an action, and DC already has a house pattern for exactly that: That means removing the fill, the white text and the radius from /* current */
.styledSliderIIIFWrapper :global(.clover-items-homepage) {
padding: 0 var(--dc-space-legacy-3);
border-radius: 38px;
background-color: var(--dc-color-purple);
color: var(--dc-color-white);
font-size: var(--dc-font-size-gr3);
line-height: 1.4rem;
text-decoration: none;
}and letting it inherit the site's link treatment instead, matching One constraint worth knowing: Clover renders the header link as bare text — <a className="clover-items-homepage" href={heading.homepage}>{t("commonViewAll")}</a>— with no icon slot, so if the forward arrow is wanted to complete the match with This supersedes the height-matching suggestion in my earlier comment. |
There was a problem hiding this comment.
Note comments. Thanks for chatting it through @kdid. In additional be sure to update to latest. Sorry for the moving target.
|
@mathewjordan - Here's what's addressed in the latest push: Clover 4.9.2
Download and Share crashes
Related-items sliders
Viewer thumbnail rail
Tests and docs
|

Summary
Upgrades Digital Collections from the deprecated
@samvera/clover-iiif3.17.0 to@nulib/clover4.4.2 (now maintained innulib-ds/clover) for the work-page viewer, the IIIF primitives (title, summary, metadata, thumbnails) and the collection/related-item sliders.Clover 4 is a rewrite, not a drop-in upgrade: settings are props instead of an
optionsobject, the markup and class names are new, and the package is ESM-only. This PR moves DC onto it while keeping the current look and behavior. Users get Clover 4's viewer, with highlighted content-search hits, a transcript view for A/V, and new image controls, while panel tabs, sliders and typography still look like current DC.User-facing:
Changes
@samvera/clover-iiifwith@nulib/clover4.4.2.pages/_app.tsxnow imports@nulib/clover/styles.css.components/Clover/ViewerWrapper.tsx, `components/Work/EmbeddedViewer.tsx):optionsto Clover 4 props:header,defaultPanelOpen,panelLayout="tabs",panelSections,panelLabels,request,searchQuery,onContentStateChange. The 640px canvas height is now--clover-body-height.searchQueryis set.components/Clover/CloverViewer.tsx, becausenext/dynamic'srequire.resolveWeakcan't resolve an import-only package.components/Clover/clover-request.ts, new): Clover 4 applies one request setting to everything it fetches.info.json, search, annotation pages), so restricted works keep working./public/vtt/) are fetched without cross-origin credentials, because that host answersAccess-Control-Allow-Origin: *, which browsers reject for credentialed requests. Without this, the transcript tab was blank.TopInfo,Metadata,Hero,Homepage/Overview,EmbedResources):value=. Metadata's custom search links moved fromcustomValueContenttorenderValue.Thumbnailhas noregionprop.components/Clover/SliderWrapper.tsx):<Items layout="slider">.homepage.ViewerWrapper.module.css,SliderWrapper.module.css): rewrote the overrides for Clover 4's markup.gr3size. Clover 4 sizes text inrem, and DC's root is 19px, so panel text came out too large.jest.config.js): transform@nulib/cloverand@iiif/parser, which are ESM-only. Slider and viewer tests were updated for Clover 4, andclover-request.test.tswas added.lib/constants/homepage.ts): one homepage overview thumbnail URL contained//full/and returned 403. Clover 3 built a different URL from the image service and hid the typo.Testing
https://preview-clover-4.dc.rdc-staging.library.northwestern.edu/
Known differences / follow-ups
nulib-ds/cloverCenter searches around user and start from current canvas. nulib-ds/clover#397, h. Once it's released, bump@nulib/clover.?content-search=. Clover 4 has nocontentSearchCallback; there's a TODO inViewerWrapper.tsx. Searches started from the URL still work..m3u8) didn't play, because Clover 4'sThumbnailonly renders<img>. The video tile is now a still poster frame.