Skip to content

Commit

Permalink
Merge pull request #482 from NYPL/NO-REF_remove_featured_edition_logic
Browse files Browse the repository at this point in the history
NOREF: Remove featured edition logic
  • Loading branch information
jackiequach authored Feb 26, 2024
2 parents 18b7dd7 + 72b72e8 commit b7a7778
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Add error Modal for failed download requests
- Update preview item to prioritize UP item
- Hotfix: Update package-lock pdfjs-dist version
- Remove featured edition logic from frontend

## [0.17.6]

Expand Down
23 changes: 4 additions & 19 deletions src/util/EditionCardUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,34 +182,19 @@ export default class EditionCardUtils {
return oclcLink;
}

// Get readable item or non-catalog item
// return first item if links are available
static getPreviewItem(items: ApiItem[] | undefined) {
if (!items) return undefined;

const firstUpItem = items.find((item) => {
return EditionCardUtils.getUpLink(item);
});

const firstReadableItem = items.find((item) => {
return (
EditionCardUtils.getReadLink(item, "reader") ||
EditionCardUtils.getReadLink(item, "embed")
);
});
const firstItem = items[0];

// If no readable link found, we just return any link that's not a catalog (edd)
return (
firstUpItem ??
firstReadableItem ??
items.find((items) => {
return items.links && items.links.find((link) => !link.flags.catalog);
})
);
return firstItem.links ? firstItem : undefined;
}

static isAvailableOnline(item: ApiItem) {
return (
item &&
item.links &&
item.links.find((link: ItemLink) => {
return (
link.flags["reader"] || link.flags["embed"] || link.flags["download"]
Expand Down

0 comments on commit b7a7778

Please sign in to comment.