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

Track patient card button clicks #6521

Merged
merged 2 commits into from
Oct 31, 2023
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
27 changes: 25 additions & 2 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TELEMEDICINE_ACTIONS,
} from "../../Common/constants";
import { ConsultationModel, PatientCategory } from "../Facility/models";
import { Switch } from "@headlessui/react";
import { Switch, Menu } from "@headlessui/react";

import { Link } from "raviger";
import { useState } from "react";
Expand All @@ -26,8 +26,9 @@ import Beds from "../Facility/Consultations/Beds";
import { PatientModel } from "./models";
import request from "../../Utils/request/request.js";
import routes from "../../Redux/api.js";
import { Menu } from "@headlessui/react";
import DropdownMenu from "../Common/components/Menu.js";
import { triggerGoal } from "../../Integrations/Plausible.js";
import useAuthUser from "../../Common/hooks/useAuthUser.js";

export default function PatientInfoCard(props: {
patient: PatientModel;
Expand All @@ -36,6 +37,8 @@ export default function PatientInfoCard(props: {
consultationId: string;
showAbhaProfile?: boolean;
}) {
const authUser = useAuthUser();

const [open, setOpen] = useState(false);
const [showLinkABHANumber, setShowLinkABHANumber] = useState(false);
const [showABHAProfile, setShowABHAProfile] = useState(
Expand Down Expand Up @@ -459,6 +462,11 @@ export default function PatientInfoCard(props: {
});
setOpen(true);
}
triggerGoal("Patient Card Button Clicked", {
buttonName: action[1],
consultationId: consultation?.id,
userId: authUser?.id,
});
}}
>
<CareIcon
Expand Down Expand Up @@ -489,6 +497,11 @@ export default function PatientInfoCard(props: {
onClick={() => {
close();
setShowABHAProfile(true);
triggerGoal("Patient Card Button Clicked", {
buttonName: "Show ABHA Profile",
consultationId: consultation?.id,
userId: authUser?.id,
});
}}
>
<CareIcon className="care-l-user-square text-lg text-primary-500" />
Expand All @@ -497,6 +510,11 @@ export default function PatientInfoCard(props: {
<div
className="dropdown-item-primary pointer-events-auto m-2 flex cursor-pointer items-center justify-start gap-2 rounded border-0 p-2 text-sm font-normal transition-all duration-200 ease-in-out"
onClick={() => {
triggerGoal("Patient Card Button Clicked", {
buttonName: "Link Care Context",
consultationId: consultation?.id,
userId: authUser?.id,
});
close();
setShowLinkCareContext(true);
}}
Expand Down Expand Up @@ -532,6 +550,11 @@ export default function PatientInfoCard(props: {
<Switch
checked={medicoLegalCase}
onChange={(checked) => {
triggerGoal("Patient Card Button Clicked", {
buttonName: "Medico Legal Case",
consultationId: consultation?.id,
userId: authUser?.id,
});
setMedicoLegalCase(checked);
switchMedicoLegalCase(checked);
}}
Expand Down
Loading