Skip to content

Commit 82782fc

Browse files
fix: added timezonebadge to insights/routing which appears on timezone mismatch (#25138)
* fix: added timezonebadge to insights/routing which appears on timezone mismatch * update: removed user repository and directly used prisma * clean up code --------- Co-authored-by: Eunjae Lee <[email protected]>
1 parent 2477220 commit 82782fc

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

apps/web/app/(use-page-wrapper)/insights/routing/page.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { _generateMetadata } from "app/_utils";
22

3+
import { prisma } from "@calcom/prisma";
4+
35
import InsightsRoutingPage from "~/insights/insights-routing-view";
46

57
import { checkInsightsPagePermission } from "../checkInsightsPagePermission";
@@ -14,7 +16,14 @@ export const generateMetadata = async () =>
1416
);
1517

1618
export default async function Page() {
17-
await checkInsightsPagePermission();
19+
const session = await checkInsightsPagePermission();
20+
21+
const { timeZone } = await prisma.user.findUniqueOrThrow({
22+
where: { id: session?.user.id ?? -1 },
23+
select: {
24+
timeZone: true,
25+
},
26+
});
1827

19-
return <InsightsRoutingPage />;
28+
return <InsightsRoutingPage timeZone={timeZone} />;
2029
}

apps/web/modules/insights/insights-routing-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import {
1313
import { InsightsOrgTeamsProvider } from "@calcom/features/insights/context/InsightsOrgTeamsProvider";
1414
import { useLocale } from "@calcom/lib/hooks/useLocale";
1515

16-
export default function InsightsRoutingFormResponsesPage() {
16+
export default function InsightsRoutingFormResponsesPage({ timeZone }: { timeZone: string }) {
1717
const { t } = useLocale();
1818
const pathname = usePathname();
1919

2020
if (!pathname) return null;
2121

2222
return (
23-
<DataTableProvider tableIdentifier={pathname} useSegments={useSegments}>
23+
<DataTableProvider tableIdentifier={pathname} useSegments={useSegments} timeZone={timeZone}>
2424
<InsightsOrgTeamsProvider>
2525
<div className="mb-4 space-y-4">
2626
<RoutingFormResponsesTable />

packages/features/insights/components/routing/RoutingFormResponsesTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use client";
22

33
import { useReactTable, getCoreRowModel, getSortedRowModel } from "@tanstack/react-table";
4-
4+
import { TimezoneBadge } from "@calcom/features/insights/components/booking";
5+
56
import { useMemo, useEffect } from "react";
67
import { createPortal } from "react-dom";
78

@@ -155,6 +156,7 @@ export function RoutingFormResponsesTable() {
155156
<>
156157
<DateRangeFilter column={createdAtColumn} options={{ convertToTimeZone: true }} />
157158
<RoutingFormResponsesDownload sorting={sorting} />
159+
<TimezoneBadge />
158160
</>,
159161
ctaContainerRef.current
160162
)}

0 commit comments

Comments
 (0)