Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
CTW-1537 / Canvas badge patch (#1393)
Browse files Browse the repository at this point in the history
Jira Ticket Number: CTW-1537

## What does this PR accomplish?

A function I added meant to provide an easier way to get the unread tab
count was not working in the app. I'm removing it and exposing the
function described in ticket that Canvas can use instead.

## How did you test it?

Tested in CTW locally.
<img width="958" alt="image"
src="https://github.com/zeus-health/ctw-component-library/assets/33408946/a6431c6e-fcea-469f-85c8-18246be9a488">

## How will you know that this is working after deployment?

View deployment.

_NOTE:_ This template comes from
[here](https://github.com/zeus-health/.github/blob/main/PULL_REQUEST_TEMPLATE.md).
If you would like to suggest modifications to this template, open a PR.
  • Loading branch information
melocule committed Nov 21, 2023
1 parent f25ff86 commit 00571ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-zebras-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zus-health/ctw-component-library": patch
---

Make a function unavailable because it wasn't working in CTW.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions src/components/content/unread-records-notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,8 @@ export const UnreadRecordsNotification = ({
return null;
};

// Provides the number of ZAP resources with unread notifications
export function useUnreadZAPTabsCount(resources = defaultZAPTabs): number {
const unreadRecordsMap = useUnreadRecordsByResource(resources);
return [...unreadRecordsMap.values()].reduce(
(count, hasUnread) => (hasUnread ? count + 1 : count),
0
);
}

// Maps whether each ZAP resource has any unread notifications
function useUnreadRecordsByResource(resources = defaultZAPTabs): Map<ZAPTabName, boolean> {
export function useUnreadRecordsByResource(resources = defaultZAPTabs): Map<ZAPTabName, boolean> {
const userBuilderId = useUserBuilderId();
const allergiesQuery = usePatientAllergies(resources.includes("allergies"));
const conditionsQuery = usePatientConditionsAll(resources.includes("conditions-all"));
Expand All @@ -67,7 +58,7 @@ function useUnreadRecordsByResource(resources = defaultZAPTabs): Map<ZAPTabName,
resources.includes("encounters")
);
const immunizationsQuery = usePatientImmunizations(resources.includes("immunizations"));
const medicationsQuery = useQueryAllPatientMedications(resources.includes("medications"));
const medicationsQuery = useQueryAllPatientMedications(resources.includes("medications-all"));

const map = new Map<ZAPTabName, boolean>();
for (const zapTabName of ZAP_TAB_NAMES) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export * from "@/hooks/use-medications";
export * from "@/components/content/resource/resource-table-actions";
export * from "@/components/content/resource/helpers/filters";
export * from "@/services/fqs/client";
export { useUnreadZAPTabsCount } from "@/components/content/unread-records-notification";
export { useUnreadRecordsByResource } from "@/components/content/unread-records-notification";

// Models
export * from "@/fhir/models";
Expand Down

0 comments on commit 00571ac

Please sign in to comment.