Skip to content

Commit

Permalink
Clean up patient login
Browse files Browse the repository at this point in the history
  • Loading branch information
bodhish committed Jan 5, 2025
1 parent 19ec68a commit 539862e
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 146 deletions.
6 changes: 0 additions & 6 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ REACT_GITHUB_URL=
# OHCN URL (default: https://ohc.network?ref=care)
REACT_OHCN_URL=

# Plausible site domain (default: care.ohc.network)
REACT_PLAUSIBLE_SITE_DOMAIN=

# Plausible server URL (default: https://plausible.ohc.network)
REACT_PLAUSIBLE_SERVER_URL=

# Care Apps. repo@branch seperated by commas
REACT_ENABLED_APPS="ohcnetwork/care_livekit_fe@main,ohcnetwork/care_scribe"

Expand Down
6 changes: 0 additions & 6 deletions care.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ const careConfig = {
minEncounterDate: new Date(env.REACT_MIN_ENCOUNTER_DATE || "2020-01-01"),

// Plugins related configs...

plausible: {
server: env.REACT_PLAUSIBLE_SERVER_URL || "https://plausible.ohc.network",
domain: env.REACT_PLAUSIBLE_SITE_DOMAIN || "care.ohc.network",
},

sentry: {
dsn:
env.REACT_SENTRY_DSN ||
Expand Down
7 changes: 0 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,5 @@
</div>
</div>
<script type="module" src="/src/index.tsx"></script>
<script nonce="f51b9742">
window.plausible =
window.plausible ||
function () {
(window.plausible.q = window.plausible.q || []).push(arguments);
};
</script>
</body>
</html>
2 changes: 0 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Content-Security-Policy-Report-Only = '''
default-src 'self';
script-src 'self' 'nonce-f51b9742' https://plausible.ohc.network;
style-src 'self' 'unsafe-inline';
connect-src 'self' https://plausible.ohc.network;
img-src 'self' https://cdn.ohc.network https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com;
object-src 'self' https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com;
report-uri https://csp-logger.ohc.network/
Expand Down
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const App = () => {

{/* Integrations */}
<Integrations.Sentry disabled={!import.meta.env.PROD} />
<Integrations.Plausible />
</HistoryAPIProvider>
<Sonner
position="top-right"
Expand Down
87 changes: 0 additions & 87 deletions src/Integrations/Plausible.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions src/Integrations/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Plausible from "@/Integrations/Plausible";
import Sentry from "@/Integrations/Sentry";

const Integrations = { Sentry, Plausible };
const Integrations = { Sentry };

export default Integrations;
2 changes: 2 additions & 0 deletions src/Routers/PatientRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import { PatientHome } from "@/components/Patient/PatientHome";

import PatientUserProvider from "@/Providers/PatientUserProvider";
import { AppointmentSuccess } from "@/pages/Appoinments/Success";
import { FacilitiesPage } from "@/pages/Facility/FacilitiesPage";
import PatientIndex from "@/pages/Patient/index";

import SessionRouter from "./SessionRouter";

const PatientRoutes = {
"/nearby_facilities": () => <FacilitiesPage />,
"/facility/:facilityId/appointments/:appointmentId/success": ({
appointmentId,
}: {
Expand Down
24 changes: 13 additions & 11 deletions src/components/ui/sidebar/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,28 @@ function generatePatientLinks(
): NavigationLink[] {
if (!selectedUser) return [];

const { state, district, ward, local_body } = selectedUser;
const { geo_organization } = selectedUser;
let parentOrganization = geo_organization?.parent;
while (parentOrganization?.parent) {
if (parentOrganization.level_cache === 1) {
break;
}
parentOrganization = parentOrganization.parent;
}

const queryParams = new URLSearchParams();

if (state) queryParams.set("state", String(state));
if (district) queryParams.set("district", String(district));
if (ward) queryParams.set("ward", String(ward));
if (local_body) queryParams.set("local_body", String(local_body));
if (parentOrganization) {
queryParams.set("organization", String(parentOrganization?.id));
}

return [
{ name: t("appointments"), url: "/patient/home", icon: "d-patient" },
{
name: t("nearby_facilities"),
url: `/facilities/?${queryParams.toString()}`,
url: `/nearby_facilities/?${queryParams.toString()}`,
icon: "d-patient",
},
{
name: t("medical_records"),
url: `/patient/${selectedUser.id}`,
icon: "d-book-open",
},
];
}

Expand Down
12 changes: 0 additions & 12 deletions src/hooks/useFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import GenericFilterBadge from "@/CAREUI/display/FilterBadge";

import PaginationComponent from "@/components/Common/Pagination";

import { triggerGoal } from "@/Integrations/Plausible";
import FiltersCache from "@/Utils/FiltersCache";
import { classNames, humanizeStrings } from "@/Utils/utils";

Expand Down Expand Up @@ -49,17 +48,6 @@ export default function useFilters({
) => {
query = FiltersCache.utils.clean(query);
_setQueryParams(query, options);

// For each of the newly applied filters (additional filters compared to
// previously applied ones), trigger a plausible goal "Advanced filter
// applied" with the applied filter's query key and current location as tags.
Object.keys(query).forEach((filter) =>
triggerGoal("Advanced filter applied", {
filter,
location: location.pathname,
}),
);

updateCache(query);
};

Expand Down
1 change: 0 additions & 1 deletion src/pages/Encounters/tabs/EncounterFeedTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// import useAuthUser from "@/hooks/useAuthUser";
// import useBreakpoints from "@/hooks/useBreakpoints";

// import { triggerGoal } from "@/Integrations/Plausible";
// import { Warn } from "@/Utils/Notifications";
// import request from "@/Utils/request/request";
// import useTanStackQueryInstead from "@/Utils/request/useQuery";
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Patient/Utils.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Organization } from "@/types/organization/organization";

export type AppointmentPatientRegister = {
name: string;
gender: string;
Expand All @@ -23,4 +25,5 @@ export type AppointmentPatient = {
ward: number;
pincode: number;
gender: string;
geo_organization: Organization;
};
2 changes: 0 additions & 2 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ interface ImportMetaEnv {
readonly REACT_ENABLED_APPS?: string;

// Plugins related envs...
readonly REACT_PLAUSIBLE_SERVER_URL?: string;
readonly REACT_PLAUSIBLE_SITE_DOMAIN?: string;
readonly REACT_SENTRY_DSN?: string;
readonly REACT_SENTRY_ENVIRONMENT?: string;
readonly REACT_ENABLE_HCX?: string;
Expand Down
9 changes: 0 additions & 9 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,6 @@ export default defineConfig(({ mode }) => {
REACT_SENTRY_DSN: z.string().url().optional(),
REACT_SENTRY_ENVIRONMENT: z.string().optional(),

REACT_PLAUSIBLE_SITE_DOMAIN: z
.string()
.regex(/^[a-zA-Z0-9][a-zA-Z0-9-_.]*\.[a-zA-Z]{2,}$/)
.optional()
.describe("Domain name without protocol (e.g., sub.domain.com)"),

REACT_PLAUSIBLE_SERVER_URL: z.string().url().optional(),
REACT_CDN_URLS: z
.string()
.optional()
Expand Down Expand Up @@ -302,9 +295,7 @@ export default defineConfig(({ mode }) => {
preview: {
headers: {
"Content-Security-Policy-Report-Only": `default-src 'self';\
script-src 'self' blob: 'nonce-f51b9742' https://plausible.10bedicu.in;\
style-src 'self' 'unsafe-inline';\
connect-src 'self' https://plausible.10bedicu.in;\
img-src 'self' https://cdn.ohc.network ${cdnUrls};\
object-src 'self' ${cdnUrls};`,
},
Expand Down

0 comments on commit 539862e

Please sign in to comment.