refac
This commit is contained in:
1 parent
ed2d7d4acd
commit
9802b0d135
4 files changed
+66
-34
No files matched your search
@@ -19,6 +19,7 @@
|
||||
export let allChatsLoaded = false;
|
||||
|
||||
export let loadHandler: Function = null;
|
||||
export let showOwnerInfo = false;
|
||||
|
||||
let chatList = null;
|
||||
|
||||
@@ -163,12 +164,12 @@
|
||||
{dayjs(chat?.updated_at * 1000).calendar()}
|
||||
</div>
|
||||
|
||||
{#if chat.user_id && chat.owner_name}
|
||||
{#if showOwnerInfo && chat.user_id && chat.owner_name}
|
||||
<Tooltip content={chat.owner_name}>
|
||||
<img
|
||||
src="/api/v1/users/{chat.user_id}/profile/image"
|
||||
alt=""
|
||||
class="size-5 rounded-full shrink-0 object-cover"
|
||||
class="size-4 rounded-full shrink-0 object-cover"
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
let chatListLoading = false;
|
||||
let allChatsLoaded = false;
|
||||
|
||||
$: showOwnerInfo = Boolean(
|
||||
folder?.shared ||
|
||||
(folder?.user_id && folder.user_id !== $user?.id) ||
|
||||
(folder?.access_grants?.length ?? 0) > 0
|
||||
);
|
||||
|
||||
const loadChats = async () => {
|
||||
// getSharedFolderChats returns all users' chats in one shot; no pagination
|
||||
allChatsLoaded = true;
|
||||
@@ -96,7 +102,13 @@
|
||||
<FolderKnowledge />
|
||||
{:else if selectedTab === 'chats'}
|
||||
{#if chats !== null}
|
||||
<ChatList {chats} {chatListLoading} {allChatsLoaded} loadHandler={loadChats} />
|
||||
<ChatList
|
||||
{chats}
|
||||
{chatListLoading}
|
||||
{allChatsLoaded}
|
||||
loadHandler={loadChats}
|
||||
{showOwnerInfo}
|
||||
/>
|
||||
{:else}
|
||||
<div class="py-10">
|
||||
<Spinner />
|
||||
|
||||
Reference in new issue
Block a user