add initial data page
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user