1368ffe55d
* refactor: move data-table hooks/contexts/provider from features to web modules Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: update broken useColumnResizing import path in DataTable.tsx Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: update remaining broken import paths for moved hooks Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * docs: update GUIDE.md import paths and file references for moved modules Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { useMemo } from "react";
|
|
|
|
import { useDataTable } from "~/data-table/hooks/useDataTable";
|
|
import NoSSR from "@calcom/lib/components/NoSSR";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants";
|
|
import { Tooltip } from "@calcom/ui/components/tooltip";
|
|
import { InfoIcon } from "@coss/ui/icons";
|
|
|
|
const TimezoneBadgeContent = () => {
|
|
const { t } = useLocale();
|
|
const { timeZone: userTimezone } = useDataTable();
|
|
|
|
const timezoneData = useMemo(() => {
|
|
// Use Cal's standard CURRENT_TIMEZONE constant
|
|
const browserTimezone = CURRENT_TIMEZONE;
|
|
|
|
if (!browserTimezone || !userTimezone || browserTimezone === userTimezone) return null;
|
|
|
|
const tooltipContent = t("timezone_mismatch_tooltip", {
|
|
browserTimezone,
|
|
userTimezone,
|
|
interpolation: { escapeValue: false },
|
|
});
|
|
|
|
return {
|
|
browser: browserTimezone,
|
|
user: userTimezone,
|
|
tooltipContent,
|
|
badgeContent: userTimezone,
|
|
};
|
|
}, [userTimezone, t]);
|
|
|
|
// Don't render anything if no timezone mismatch
|
|
if (!timezoneData) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Tooltip content={timezoneData.tooltipContent}>
|
|
<InfoIcon data-testid="timezone-mismatch-badge" className="text-subtle" />
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export const TimezoneBadge = () => {
|
|
return (
|
|
<NoSSR fallback={null}>
|
|
<TimezoneBadgeContent />
|
|
</NoSSR>
|
|
);
|
|
};
|