mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 11:07:55 -05:00
refac
This commit is contained in:
1 parent
cbca97a6b8
commit
48999b3369
6 files changed
+82
-23
No files matched your search
@@ -154,6 +154,7 @@
|
||||
}[];
|
||||
$: void resolveNames([...grants, { principal_type: 'user', principal_id: owner }]);
|
||||
$: owner = folder.user_id ?? '';
|
||||
$: people = sharedWith.filter((entry) => entry.kind === 'user');
|
||||
$: sharedWith = ((): SharedEntry[] => {
|
||||
const byPrincipal = new Map<string, SharedEntry>();
|
||||
for (const grant of grants) {
|
||||
@@ -224,7 +225,11 @@
|
||||
// Models aren't links, so their rows don't darken.
|
||||
const plainRow =
|
||||
'flex min-h-8 items-center gap-2 py-[0.375rem] text-[0.8125rem] leading-5 text-base-800 dark:text-base-200';
|
||||
const railLabel = 'mb-1.5 text-[0.6875rem] text-base-400 dark:text-base-500';
|
||||
// The rail's rows sit closer than the main column's, as in the team Overview's sidebar.
|
||||
const railRow =
|
||||
'group -mx-2 flex h-7 items-center gap-2 rounded-xl px-2 text-left text-[0.8125rem] text-base-800 transition-colors hover:text-base-1000 dark:text-base-200 dark:hover:text-base-0';
|
||||
const railPlain = 'flex h-7 items-center gap-2 text-[0.8125rem] text-base-800 dark:text-base-200';
|
||||
const railLabel = 'mb-1 text-[0.6875rem] text-base-400 dark:text-base-500';
|
||||
const railIcon =
|
||||
'flex size-4 shrink-0 items-center justify-center text-base-400 dark:text-base-500';
|
||||
</script>
|
||||
@@ -504,23 +509,41 @@
|
||||
</div>
|
||||
|
||||
<!-- Borderless rail, as on the team Overview. -->
|
||||
<aside class="flex flex-col gap-5">
|
||||
<aside class="flex flex-col gap-4">
|
||||
<!-- Who can open the folder: like the team Overview's members, but a folder is shared
|
||||
with people, groups, teams or everyone, each able to view or edit. -->
|
||||
<div>
|
||||
<div class={railLabel}>{$i18n.t('Shared with')}</div>
|
||||
{#each sharedWith as entry (entry.key)}
|
||||
<!-- People as one avatar stack with a count, as the team Overview shows members. -->
|
||||
<div
|
||||
class="{railPlain} -mx-2 px-2"
|
||||
title={people.map((entry) => (entry.owner ? `${entry.name} (${$i18n.t('Owner')})` : entry.name)).join(', ')}
|
||||
>
|
||||
<span class="flex -space-x-1.5">
|
||||
{#each people.slice(0, 5) as entry (entry.key)}
|
||||
<img
|
||||
class="size-5 rounded-full object-cover ring-2 ring-base-0 dark:ring-base-900"
|
||||
src={`${WEBUI_API_BASE_URL}/users/${entry.id}/profile/image`}
|
||||
alt=""
|
||||
/>
|
||||
{/each}
|
||||
</span>
|
||||
<span class="text-base-500 dark:text-base-400"
|
||||
>{$i18n.t('{{COUNT}} people', { COUNT: people.length })}</span
|
||||
>
|
||||
</div>
|
||||
{#each sharedWith.filter((entry) => entry.kind !== 'user') as entry (entry.key)}
|
||||
{#if entry.href}
|
||||
<a
|
||||
href={entry.href}
|
||||
class={overviewRow}
|
||||
class={railRow}
|
||||
title={entry.edit ? $i18n.t('Can edit') : $i18n.t('Can view')}
|
||||
>
|
||||
{@render sharedEntry(entry)}
|
||||
</a>
|
||||
{:else}
|
||||
<div
|
||||
class="{plainRow} -mx-2 px-2"
|
||||
class="{railPlain} -mx-2 px-2"
|
||||
title={entry.owner
|
||||
? $i18n.t('Owner')
|
||||
: entry.edit
|
||||
@@ -537,17 +560,12 @@
|
||||
<div>
|
||||
<div class={railLabel}>{$i18n.t('Working Directory')}</div>
|
||||
{#if onFiles}
|
||||
<button
|
||||
type="button"
|
||||
class="{overviewRow} w-full"
|
||||
title={directory}
|
||||
on:click={onFiles}
|
||||
>
|
||||
<button type="button" class="{railRow} w-full" title={directory} on:click={onFiles}>
|
||||
<span class={railIcon}><Icon name="folder" size={14} /></span>
|
||||
<span class="min-w-0 truncate">{directory}</span>
|
||||
</button>
|
||||
{:else}
|
||||
<div class="{plainRow} -mx-2 px-2" title={directory}>
|
||||
<div class="{railPlain} -mx-2 px-2" title={directory}>
|
||||
<span class={railIcon}><Icon name="folder" size={14} /></span>
|
||||
<span class="min-w-0 truncate">{directory}</span>
|
||||
</div>
|
||||
@@ -557,12 +575,12 @@
|
||||
|
||||
<div>
|
||||
<div class={railLabel}>{$i18n.t('Go to')}</div>
|
||||
<button type="button" class="{overviewRow} w-full" on:click={onChats}>
|
||||
<button type="button" class="{railRow} w-full" on:click={onChats}>
|
||||
<span class={railIcon}><Icon name="chat-bubble" size={14} /></span>
|
||||
{$i18n.t('Chats')}
|
||||
</button>
|
||||
{#if !readOnly}
|
||||
<button type="button" class="{overviewRow} w-full" on:click={onEdit}>
|
||||
<button type="button" class="{railRow} w-full" on:click={onEdit}>
|
||||
<span class={railIcon}><SettingsAlt className="size-3.5" /></span>
|
||||
{$i18n.t('Edit Folder')}
|
||||
</button>
|
||||
@@ -573,7 +591,7 @@
|
||||
<div>
|
||||
<div class={railLabel}>{$i18n.t('Folders')}</div>
|
||||
{#each subfolders as child (child.id)}
|
||||
<a href="/folders/{child.id}" class={overviewRow}>
|
||||
<a href="/folders/{child.id}" class={railRow}>
|
||||
<span class={railIcon}
|
||||
><TeamItemIcon
|
||||
type="folder"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
export let glyph: StatusGlyph | undefined = undefined;
|
||||
export let color: TagColor | undefined = undefined;
|
||||
export let emoji: string | undefined = undefined;
|
||||
/** A status without a glyph: a dot in its color. */
|
||||
/** A status without a glyph (no category): the muted dash "No status" uses. */
|
||||
export let dot = false;
|
||||
export let className = 'size-3.5';
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
{#if shownEmoji}
|
||||
<Emoji shortCode={shownEmoji} className="shrink-0 {className}" />
|
||||
{:else if !shape}
|
||||
<!-- No status -->
|
||||
{:else if !shape || shape === 'dot'}
|
||||
<!-- No status, or a status without a category -->
|
||||
<svg
|
||||
class="shrink-0 text-base-300 dark:text-base-600 {className}"
|
||||
viewBox="0 0 14 14"
|
||||
@@ -42,9 +42,7 @@
|
||||
</svg>
|
||||
{:else}
|
||||
<svg class="shrink-0 {tone} {className}" viewBox="0 0 14 14" fill="none" aria-hidden="true">
|
||||
{#if shape === 'dot'}
|
||||
<circle cx="7" cy="7" r="3" fill="currentColor" />
|
||||
{:else if shape === 'done'}
|
||||
{#if shape === 'done'}
|
||||
<circle cx="7" cy="7" r="6.25" fill="currentColor" />
|
||||
<path
|
||||
d="M4.4 7.2 6.1 8.9 9.6 5.4"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
let dragId = '';
|
||||
|
||||
const glyphLabels: Record<string, string> = {
|
||||
dot: 'Dot',
|
||||
dot: 'No category',
|
||||
backlog: 'Dashed',
|
||||
todo: 'Ring',
|
||||
in_progress: 'Half',
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import ChevronRight from '$lib/components/icons/ChevronRight.svelte';
|
||||
import FolderTags from '$lib/components/chat/Placeholder/FolderTags.svelte';
|
||||
import TaskAssignee from './TaskAssignee.svelte';
|
||||
import ChatParticipants from '$lib/components/common/ChatParticipants.svelte';
|
||||
import TaskDueDate from './TaskDueDate.svelte';
|
||||
import TaskGroupIcon from './TaskGroupIcon.svelte';
|
||||
import TaskPriority from './TaskPriority.svelte';
|
||||
@@ -240,6 +241,11 @@
|
||||
disabled={!editable}
|
||||
onChange={(person) => onUpdate(task, { assignee_id: person?.id ?? null })}
|
||||
/>
|
||||
{#if task.user}
|
||||
<div class="flex" title={$i18n.t('Created by {{name}}', { name: task.user.name })}>
|
||||
<ChatParticipants owner={task.user} />
|
||||
</div>
|
||||
{/if}
|
||||
<span
|
||||
class="max-w-24 shrink-0 truncate text-right text-[0.6875rem] tabular-nums text-base-400 dark:text-base-500"
|
||||
title={taskLabel(task, inFolder)}>{taskLabel(task, inFolder)}</span
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
import FolderTags from '$lib/components/chat/Placeholder/FolderTags.svelte';
|
||||
import TaskPriority from './TaskPriority.svelte';
|
||||
import TaskAssignee from './TaskAssignee.svelte';
|
||||
import ChatParticipants from '$lib/components/common/ChatParticipants.svelte';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import { formatDateDetails, formatShortDate } from '$lib/utils';
|
||||
import TaskDueDate from './TaskDueDate.svelte';
|
||||
import TaskGroupIcon from './TaskGroupIcon.svelte';
|
||||
import type { TaskGroup } from './groups';
|
||||
@@ -191,6 +194,40 @@
|
||||
show={pickerOpen(task, 'assignee')}
|
||||
onChange={(person) => onUpdate(task, { assignee_id: person?.id ?? null })}
|
||||
/>
|
||||
<!-- After the assignee, the creator, shown as chat rows show their owner. -->
|
||||
{#if task.user}
|
||||
<div
|
||||
class="hidden @sm:flex"
|
||||
title={$i18n.t('Created by {{name}}', { name: task.user.name })}
|
||||
>
|
||||
<ChatParticipants owner={task.user} />
|
||||
</div>
|
||||
{/if}
|
||||
<!-- Updated, as chat rows show it; created beside it on wider lists. -->
|
||||
<Tooltip
|
||||
as="span"
|
||||
className="hidden shrink-0 @lg:flex"
|
||||
placement="top-end"
|
||||
content={`${$i18n.t('Created')} · ${formatDateDetails(task.created_at, $i18n.language)}`}
|
||||
>
|
||||
<time
|
||||
class="w-14 text-right text-[0.6875rem] text-base-400 tabular-nums dark:text-base-500"
|
||||
datetime={new Date(task.created_at * 1000).toISOString()}
|
||||
>{formatShortDate(task.created_at, $i18n.language)}</time
|
||||
>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
as="span"
|
||||
className="flex shrink-0"
|
||||
placement="top-end"
|
||||
content={`${$i18n.t('Updated')} · ${formatDateDetails(task.updated_at, $i18n.language)}`}
|
||||
>
|
||||
<time
|
||||
class="w-14 text-right text-[0.6875rem] text-base-400 tabular-nums dark:text-base-500"
|
||||
datetime={new Date(task.updated_at * 1000).toISOString()}
|
||||
>{formatShortDate(task.updated_at, $i18n.language)}</time
|
||||
>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const statusGlyphs = [
|
||||
] as const;
|
||||
export type StatusGlyph = (typeof statusGlyphs)[number];
|
||||
export type FolderStatus = string;
|
||||
// A status shows an emoji when `icon` is set, otherwise its glyph in its color, or a dot when it has none.
|
||||
// A status shows an emoji when `icon` is set, otherwise its glyph in its color, or a muted dash when it has none.
|
||||
// For tasks the glyph is also the status's category; a status without one has no category.
|
||||
export type CustomStatus = {
|
||||
id: string;
|
||||
|
||||
Reference in new issue
Block a user