refac
This commit is contained in:
1 parent
45fcf272ef
commit
76854d1424
10 files changed
+146
-83
No files matched your search
@@ -39,6 +39,7 @@
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
export let shareEnabled: boolean = false;
|
||||
export let readOnly: boolean = false;
|
||||
|
||||
export let shareHandler: Function;
|
||||
export let moveChatHandler: Function;
|
||||
@@ -364,7 +365,7 @@
|
||||
<hr class="border-gray-50/30 dark:border-gray-800/30 my-1" />
|
||||
{/if}
|
||||
|
||||
{#if !$temporaryChatEnabled && ($user?.role === 'admin' || ($user.permissions?.chat?.share ?? true))}
|
||||
{#if !readOnly && !$temporaryChatEnabled && ($user?.role === 'admin' || ($user.permissions?.chat?.share ?? true))}
|
||||
<button
|
||||
draggable="false"
|
||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||
@@ -438,7 +439,7 @@
|
||||
<div class="flex items-center">{$i18n.t('Copy')}</div>
|
||||
</button>
|
||||
|
||||
{#if !$temporaryChatEnabled && chat?.id}
|
||||
{#if !readOnly && !$temporaryChatEnabled && chat?.id}
|
||||
<hr class="border-gray-50/30 dark:border-gray-800/30 my-1" />
|
||||
|
||||
{#if $folders.length > 0}
|
||||
|
||||
@@ -65,6 +65,9 @@
|
||||
export let shiftKey = false;
|
||||
export let readonly = false;
|
||||
|
||||
export let ownerName: string | null = null;
|
||||
export let ownerUserId: string | null = null;
|
||||
|
||||
export let onDragEnd = () => {};
|
||||
|
||||
function formatTimeAgo(timestamp: number): string {
|
||||
@@ -534,6 +537,15 @@
|
||||
{/if}
|
||||
|
||||
<div class="flex self-center flex-1 w-full min-w-0">
|
||||
{#if ownerUserId}
|
||||
<Tooltip content={ownerName || 'Unknown'}>
|
||||
<img
|
||||
src="/api/v1/users/{ownerUserId}/profile/image"
|
||||
alt=""
|
||||
class="size-4 rounded-full shrink-0 object-cover mr-1.5"
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
{#if unread}
|
||||
<div class="shrink-0 self-center pr-2.5 flex transition-opacity duration-300">
|
||||
<div class="size-1.5 bg-sky-500 rounded-full" />
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
import { chatId, mobile, selectedFolder, showSidebar } from '$lib/stores';
|
||||
import { chatId, mobile, selectedFolder, showSidebar, user } from '$lib/stores';
|
||||
|
||||
import {
|
||||
deleteFolderById,
|
||||
@@ -703,6 +703,9 @@
|
||||
createdAt={chat.created_at}
|
||||
updatedAt={chat.updated_at}
|
||||
lastReadAt={chat.last_read_at}
|
||||
ownerName={chat.owner_name ?? null}
|
||||
ownerUserId={chat.owner_name ? chat.user_id : null}
|
||||
readonly={chat.user_id !== $user?.id}
|
||||
{shiftKey}
|
||||
on:change={(e) => {
|
||||
dispatch('change', e.detail);
|
||||
|
||||
@@ -108,6 +108,8 @@
|
||||
title={chat.title}
|
||||
createdAt={chat.created_at}
|
||||
updatedAt={chat.updated_at}
|
||||
ownerName={chat.owner_name}
|
||||
ownerUserId={chat.user_id}
|
||||
readonly={chat.readonly ?? !isWritable}
|
||||
/>
|
||||
{/each}
|
||||
|
||||
Reference in new issue
Block a user