* feat: web push notifications feature * Revert yarn.lock changes * added new env variables requirement in .env.example * moved useNotifications hook in packages/lib/hooks * fix: bug * use i18n * chore: move to new file * chore: add yarn.lock * Update .env.example Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com> * chore: add instruction for brave browser * fix: tooltip * chore: use enum * chore * small update --------- Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Udit Takkar <udit222001@gmail.com> Co-authored-by: Peer Richelsen <peer@cal.com> Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: unknown <adhabal2002@gmail.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import type { IncomingMessage } from "http";
|
|
import type { AppContextType } from "next/dist/shared/lib/utils";
|
|
import React, { useEffect } from "react";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
|
|
|
import type { AppProps } from "@lib/app-providers";
|
|
|
|
import "../styles/globals.css";
|
|
|
|
function MyApp(props: AppProps) {
|
|
const { Component, pageProps } = props;
|
|
|
|
useEffect(() => {
|
|
if (typeof window !== "undefined" && "serviceWorker" in navigator) {
|
|
navigator.serviceWorker.register("/service-worker.js");
|
|
}
|
|
}, []);
|
|
|
|
const content = Component.PageWrapper ? <Component.PageWrapper {...props} /> : <Component {...pageProps} />;
|
|
|
|
return content;
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
calNewLocale: string;
|
|
}
|
|
}
|
|
|
|
MyApp.getInitialProps = async (ctx: AppContextType) => {
|
|
const { req } = ctx.ctx;
|
|
|
|
let newLocale = "en";
|
|
|
|
if (req) {
|
|
const { getLocale } = await import("@calcom/features/auth/lib/getLocale");
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
newLocale = await getLocale(req as IncomingMessage & { cookies: Record<string, any> });
|
|
} else if (typeof window !== "undefined" && window.calNewLocale) {
|
|
newLocale = window.calNewLocale;
|
|
}
|
|
|
|
return {
|
|
pageProps: {
|
|
newLocale,
|
|
},
|
|
};
|
|
};
|
|
|
|
const WrappedMyApp = trpc.withTRPC(MyApp);
|
|
|
|
export default WrappedMyApp;
|