import { Suspense, useEffect } from "react"; import dynamic from "next/dynamic"; import type { BlitzPage } from "blitz"; import { Routes } from "blitz"; import { atom, useAtom } from "jotai"; import Layout from "../../core/layouts/layout"; import ConversationsList from "../components/conversations-list"; import NewMessageButton from "../components/new-message-button"; import useRequireOnboarding from "../../core/hooks/use-require-onboarding"; import useNotifications from "../../core/hooks/use-notifications"; const Messages: BlitzPage = () => { useRequireOnboarding(); const { subscription, subscribe } = useNotifications(); const setIsOpen = useAtom(bottomSheetOpenAtom)[1]; useEffect(() => { if (!subscription) { subscribe(); } }, [subscription?.endpoint]); return ( <>

Messages

setIsOpen(true)} /> ); }; const NewMessageBottomSheet = dynamic(() => import("../components/new-message-bottom-sheet"), { ssr: false, loading: () => null, }); export const bottomSheetOpenAtom = atom(false); Messages.getLayout = (page) => {page}; Messages.authenticate = { redirectTo: Routes.SignIn().pathname }; export default Messages;