From 47c746982805fa72af15442dc191775ffd2a66af Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 25 Sep 2021 07:34:48 +0800 Subject: [PATCH] empty state for messages --- .../components/conversations-list.tsx | 4 +- app/messages/components/empty-messages.tsx | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 app/messages/components/empty-messages.tsx diff --git a/app/messages/components/conversations-list.tsx b/app/messages/components/conversations-list.tsx index 82757a8..340ec7f 100644 --- a/app/messages/components/conversations-list.tsx +++ b/app/messages/components/conversations-list.tsx @@ -5,6 +5,7 @@ import getConversationsQuery from "../queries/get-conversations"; import { formatRelativeDate } from "../../core/helpers/date-formatter"; import { useEffect } from "react"; import PhoneInitLoader from "../../core/components/phone-init-loader"; +import EmptyMessages from "./empty-messages"; export default function ConversationsList() { const [conversations, query] = useQuery(getConversationsQuery, {}); @@ -17,11 +18,12 @@ export default function ConversationsList() { }, [conversations, query]); if (!conversations) { + // we're still importing messages from twilio return ; } if (Object.keys(conversations).length === 0) { - return
empty state
; + return ; } return ( diff --git a/app/messages/components/empty-messages.tsx b/app/messages/components/empty-messages.tsx new file mode 100644 index 0000000..d027f8f --- /dev/null +++ b/app/messages/components/empty-messages.tsx @@ -0,0 +1,43 @@ +import { HiPlus } from "react-icons/hi"; +import { useAtom } from "jotai"; +import { bottomSheetOpenAtom } from "../pages/messages"; + +export default function EmptyMessages() { + const setIsBottomSheetOpen = useAtom(bottomSheetOpenAtom)[1]; + const openNewMessageArea = () => setIsBottomSheetOpen(true); + + return ( +
+ +

No messages

+

+ Get started by sending a message +
+ to someone you know. +

+
+ +
+
+ ); +}