💄 Stylize detected timezone (#1311)

This commit is contained in:
Luke Vella 2024-09-05 22:11:59 +01:00 committed by GitHub
parent 6ed89c897b
commit c093066f9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View file

@ -270,7 +270,7 @@
"downloadICSFile": "Download ICS File", "downloadICSFile": "Download ICS File",
"schedulateDate": "Scheduled Date", "schedulateDate": "Scheduled Date",
"timeZoneChangeDetectorTitle": "Timezone Change Detected", "timeZoneChangeDetectorTitle": "Timezone Change Detected",
"timeZoneChangeDetectorMessage": "Your timezone has changed to {currentTimeZone}. Do you want to update your preferences?", "timeZoneChangeDetectorMessage": "Your timezone has changed to <b>{currentTimeZone}</b>. Do you want to update your preferences?",
"yesUpdateTimezone": "Yes, update my timezone", "yesUpdateTimezone": "Yes, update my timezone",
"noKeepCurrentTimezone": "No, keep the current timezone", "noKeepCurrentTimezone": "No, keep the current timezone",
"annualBenefit": "{count} months free" "annualBenefit": "{count} months free"

View file

@ -8,6 +8,7 @@ import {
DialogHeader, DialogHeader,
DialogTitle, DialogTitle,
} from "@rallly/ui/dialog"; } from "@rallly/ui/dialog";
import * as Sentry from "@sentry/nextjs";
import { usePostHog } from "posthog-js/react"; import { usePostHog } from "posthog-js/react";
import React, { useState } from "react"; import React, { useState } from "react";
@ -25,7 +26,7 @@ export function TimeZoneChangeDetector() {
return cachedPreviousTimeZone; return cachedPreviousTimeZone;
} }
} catch (e) { } catch (e) {
console.error(e); Sentry.captureException(e);
} }
const timeZone = preferences.timeZone ?? getBrowserTimeZone(); const timeZone = preferences.timeZone ?? getBrowserTimeZone();
@ -33,7 +34,7 @@ export function TimeZoneChangeDetector() {
try { try {
localStorage.setItem("previousTimeZone", timeZone); localStorage.setItem("previousTimeZone", timeZone);
} catch (e) { } catch (e) {
console.error(e); Sentry.captureException(e);
} }
return timeZone; return timeZone;
@ -61,10 +62,11 @@ export function TimeZoneChangeDetector() {
/> />
</DialogTitle> </DialogTitle>
</DialogHeader> </DialogHeader>
<p className="text-muted-foreground text-sm"> <p className="text-muted-foreground text-sm leading-relaxed">
<Trans <Trans
i18nKey="timeZoneChangeDetectorMessage" i18nKey="timeZoneChangeDetectorMessage"
defaults="Your timezone has changed to {currentTimeZone}. Do you want to update your preferences?" defaults="Your timezone has changed to <b>{currentTimeZone}</b>. Do you want to update your preferences?"
components={{ b: <b className="text-foreground font-medium" /> }}
values={{ currentTimeZone }} values={{ currentTimeZone }}
/> />
</p> </p>