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

Make articles always show as available in availability labels #1075

Merged
merged 1 commit into from
Apr 8, 2024
Merged
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
14 changes: 12 additions & 2 deletions src/components/availability-label/availability-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "../../core/dbc-gateway/generated/graphql";
import AvailabilityLabelInside from "./availability-label-inside";
import { FaustId } from "../../core/utils/types/ids";
import { ManifestationMaterialType } from "../../core/utils/types/material-type";

export interface AvailabilityLabelProps {
manifestText: string;
Expand Down Expand Up @@ -47,9 +48,13 @@ export const AvailabilityLabel: React.FC<AvailabilityLabelProps> = ({
isbn: isbns ? isbns[0] : null
});

const availabilityText = isAvailable
let availabilityText = isAvailable
? t("availabilityAvailableText")
: t("availabilityUnavailableText");
// Articles are always available
if (manifestText === ManifestationMaterialType.article) {
availabilityText = t("availabilityAvailableText");
}

useDeepCompareEffect(() => {
// Track material availability (status) if the button is active - also meaning
Expand All @@ -71,7 +76,12 @@ export const AvailabilityLabel: React.FC<AvailabilityLabelProps> = ({
<AvailabilityLabelInside
selected={selected}
isLoading={!!isLoading}
isAvailable={!!isAvailable}
// Articles are always available
isAvailable={
manifestText === ManifestationMaterialType.article
? true
: !!isAvailable
}
manifestText={manifestText}
availabilityText={availabilityText}
/>
Expand Down
Loading