Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOREF: Remove featured edition logic #482

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading