add initial data page

This commit is contained in:
Ren Amamiya
2023-04-28 08:39:12 +07:00
parent 76bdeca4ab
commit 233a5bd2ad
7 changed files with 244 additions and 212 deletions

View File

@@ -1,19 +1,9 @@
import { AccountContext } from '@lume/shared/accountProvider';
import { ChatListItem } from '@lume/shared/chats/chatListItem';
import { ChatModal } from '@lume/shared/chats/chatModal';
import { DEFAULT_AVATAR } from '@lume/stores/constants';
import { useContext } from 'react';
let list: any = [];
if (typeof window !== 'undefined') {
const { getChats, getActiveAccount } = await import('@lume/utils/storage');
const activeAccount = await getActiveAccount();
list = await getChats(activeAccount.id);
}
export default function ChatList() {
const activeAccount: any = useContext(AccountContext);
const profile = typeof window !== 'undefined' ? JSON.parse(activeAccount.metadata) : null;
@@ -37,9 +27,6 @@ export default function ChatList() {
</h5>
</div>
</a>
{list.map((item: { id: string; pubkey: string }) => (
<ChatListItem key={item.id} pubkey={item.pubkey} />
))}
<ChatModal />
</div>
);

View File

@@ -1,6 +1,5 @@
import ActiveLink from '@lume/shared/activeLink';
import ChannelList from '@lume/shared/channels/channelList';
import ChatList from '@lume/shared/chats/chatList';
import { Disclosure } from '@headlessui/react';
import { Bonfire, NavArrowUp, PeopleTag } from 'iconoir-react';
@@ -80,9 +79,7 @@ export default function Navigation() {
</div>
<h3 className="text-[11px] font-bold uppercase tracking-widest text-zinc-600">Chats</h3>
</Disclosure.Button>
<Disclosure.Panel>
<ChatList />
</Disclosure.Panel>
<Disclosure.Panel></Disclosure.Panel>
</div>
)}
</Disclosure>