Skip to content

Commit

Permalink
Make articles always show as available in the availability labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamik10 committed Apr 3, 2024
1 parent 11987cd commit a2cbc86
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit a2cbc86

Please sign in to comment.