shellphone.app/app/messages/pages/messages.tsx

35 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-08-01 07:40:18 +00:00
import { Suspense, useState } from "react";
import type { BlitzPage } from "blitz";
2021-08-01 03:05:40 +00:00
import { Routes } from "blitz";
2021-08-01 07:40:18 +00:00
import { useAtom } from "jotai";
2021-07-31 14:33:18 +00:00
import Layout from "../../core/layouts/layout";
import ConversationsList from "../components/conversations-list";
2021-08-01 07:40:18 +00:00
import NewMessageButton from "../components/new-message-button";
import NewMessageBottomSheet, { bottomSheetOpenAtom } from "../components/new-message-bottom-sheet";
import useRequireOnboarding from "../../core/hooks/use-require-onboarding";
2021-07-31 14:33:18 +00:00
const Messages: BlitzPage = () => {
useRequireOnboarding();
2021-08-01 07:40:18 +00:00
const setIsOpen = useAtom(bottomSheetOpenAtom)[1];
2021-07-31 14:33:18 +00:00
return (
2021-08-01 03:05:40 +00:00
<>
2021-07-31 14:33:18 +00:00
<div className="flex flex-col space-y-6 p-6">
2021-08-01 07:40:18 +00:00
<h2 className="text-3xl font-bold">Messages</h2>
2021-07-31 14:33:18 +00:00
</div>
<Suspense fallback="Loading...">
<ConversationsList />
</Suspense>
2021-08-01 07:40:18 +00:00
<NewMessageButton onClick={() => setIsOpen(true)} />
<NewMessageBottomSheet />
2021-08-01 03:05:40 +00:00
</>
);
};
2021-07-31 14:33:18 +00:00
2021-08-01 03:05:40 +00:00
Messages.getLayout = (page) => <Layout title="Messages">{page}</Layout>;
2021-08-01 10:36:32 +00:00
Messages.authenticate = { redirectTo: Routes.SignIn().pathname };
2021-07-31 14:33:18 +00:00
export default Messages;