Skip to content

Commit

Permalink
Merge pull request #1288 from danskernesdigitalebibliotek/fix/dashboa…
Browse files Browse the repository at this point in the history
…rd-loans-reservations

Fix dashboard loans not showing
  • Loading branch information
Adamik10 authored Jun 25, 2024
2 parents 263e2f5 + 37458e8 commit 6398e76
Showing 1 changed file with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
soonOverdue: loansSoonOverduePhysical,
farFromOverdue: loansFarFromOverduePhysical,
isLoading: isLoadingLoansPhysical
},
publizon: {
soonOverdue: loansSoonOverdueDigital,
farFromOverdue: loansFarFromOverdueDigital,
isLoading: isLoadingLoansDigital
}
} = useLoans();

Expand Down Expand Up @@ -120,12 +125,16 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
break;

case soon:
setLoansToDisplay(loansSoonOverduePhysical);
setLoansToDisplay(
loansSoonOverduePhysical.concat(loansSoonOverdueDigital)
);
setModalHeader(t("loansSoonOverdueText"));
break;

case longer:
setLoansToDisplay(loansFarFromOverduePhysical);
setLoansToDisplay(
loansFarFromOverduePhysical.concat(loansFarFromOverdueDigital)
);
setModalHeader(t("loansNotOverdueText"));
break;

Expand All @@ -140,6 +149,8 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
loansFarFromOverduePhysical,
loansOverduePhysical,
loansSoonOverduePhysical,
loansSoonOverdueDigital,
loansFarFromOverdueDigital,
t
]
);
Expand All @@ -158,7 +169,8 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
: openDueDateModal(yesterday)
},
{
listLength: loansSoonOverduePhysical.length,
listLength:
loansSoonOverduePhysical.length + loansSoonOverdueDigital.length,
badge: t("statusBadgeWarningText"),
header: t("loansSoonOverdueText"),
color: "warning",
Expand All @@ -170,7 +182,8 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
: openDueDateModal(soon)
},
{
listLength: loansFarFromOverduePhysical.length,
listLength:
loansFarFromOverduePhysical.length + loansFarFromOverdueDigital.length,
header: t("loansNotOverdueText"),
dataCy: "loans-not-overdue",
color: "neutral",
Expand Down Expand Up @@ -218,7 +231,11 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
materialsCount={loans.length}
header={t("physicalLoansText")}
emptyListText={t("noPhysicalLoansText")}
isLoading={isLoadingLoans || isLoadingLoansPhysical}
isLoading={
isLoadingLoans ||
isLoadingLoansPhysical ||
isLoadingLoansDigital
}
linkText={t("dashboardLoansLinkText")}
linkUrl={physicalLoansUrl}
/>
Expand All @@ -242,7 +259,10 @@ const DashboardNotificationList: FC<DashboardNotificationListProps> = ({
...dashboardNotificationsReservations
]}
isLoading={
isLoadingLoans || isLoadingLoansPhysical || isLoadingReservations
isLoadingLoans ||
isLoadingLoansPhysical ||
isLoadingLoansDigital ||
isLoadingReservations
}
/>
)}
Expand Down

0 comments on commit 6398e76

Please sign in to comment.