* feat: sound on notification * refactor: add load audio * chore: remove * fix: type error * fix: notification * fix: prevent multiple initialization = * feat: create notification page * chore: update the mp3 file
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import type { IncomingMessage } from "http";
|
|
import { SessionProvider } from "next-auth/react";
|
|
import type { AppContextType } from "next/dist/shared/lib/utils";
|
|
import React from "react";
|
|
import CacheProvider from "react-inlinesvg/provider";
|
|
|
|
import { WebPushProvider } from "@calcom/features/notifications/WebPushContext";
|
|
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;
|
|
|
|
return (
|
|
<SessionProvider session={pageProps.session ?? undefined}>
|
|
<WebPushProvider>
|
|
{/* @ts-expect-error FIXME remove this comment when upgrading typescript to v5 */}
|
|
<CacheProvider>
|
|
{Component.PageWrapper ? <Component.PageWrapper {...props} /> : <Component {...pageProps} />}
|
|
</CacheProvider>
|
|
</WebPushProvider>
|
|
</SessionProvider>
|
|
);
|
|
}
|
|
|
|
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;
|