mirror of
https://github.com/open-webui/open-webui
synced 2024-11-06 16:59:42 +00:00
refac
This commit is contained in:
parent
cad31f6f2b
commit
8648a330f2
@ -48,6 +48,7 @@
|
|||||||
try {
|
try {
|
||||||
const fileContent = JSON.parse(event.target.result);
|
const fileContent = JSON.parse(event.target.result);
|
||||||
console.log('Parsed JSON Content: ', fileContent);
|
console.log('Parsed JSON Content: ', fileContent);
|
||||||
|
open = true;
|
||||||
dispatch('import', fileContent);
|
dispatch('import', fileContent);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing JSON file:', error);
|
console.error('Error parsing JSON file:', error);
|
||||||
@ -59,12 +60,12 @@
|
|||||||
} else {
|
} else {
|
||||||
console.error('Only JSON file types are supported.');
|
console.error('Only JSON file types are supported.');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(file);
|
|
||||||
} else {
|
} else {
|
||||||
// Handle the drag-and-drop data for folders or chats (same as before)
|
open = true;
|
||||||
|
|
||||||
const dataTransfer = e.dataTransfer.getData('text/plain');
|
const dataTransfer = e.dataTransfer.getData('text/plain');
|
||||||
const data = JSON.parse(dataTransfer);
|
const data = JSON.parse(dataTransfer);
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
dispatch('drop', data);
|
dispatch('drop', data);
|
||||||
}
|
}
|
||||||
@ -98,7 +99,7 @@
|
|||||||
<div bind:this={folderElement} class="relative {className}">
|
<div bind:this={folderElement} class="relative {className}">
|
||||||
{#if draggedOver}
|
{#if draggedOver}
|
||||||
<div
|
<div
|
||||||
class="absolute top-0 left-0 w-full h-full rounded-sm bg-[hsla(258,88%,66%,0.1)] bg-opacity-50 dark:bg-opacity-10 z-50 pointer-events-none touch-none"
|
class="absolute top-0 left-0 w-full h-full rounded-sm bg-[hsla(260,85%,65%,0.1)] bg-opacity-50 dark:bg-opacity-10 z-50 pointer-events-none touch-none"
|
||||||
></div>
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@
|
|||||||
|
|
||||||
<Folder
|
<Folder
|
||||||
collapsible={!search}
|
collapsible={!search}
|
||||||
className="px-2"
|
className="px-2 mt-0.5"
|
||||||
name={$i18n.t('All chats')}
|
name={$i18n.t('All chats')}
|
||||||
on:import={(e) => {
|
on:import={(e) => {
|
||||||
importChatHandler(e.detail);
|
importChatHandler(e.detail);
|
||||||
|
@ -207,7 +207,7 @@
|
|||||||
<div bind:this={itemElement} class=" w-full {className} relative group" draggable="true">
|
<div bind:this={itemElement} class=" w-full {className} relative group" draggable="true">
|
||||||
{#if confirmEdit}
|
{#if confirmEdit}
|
||||||
<div
|
<div
|
||||||
class=" w-full flex justify-between rounded-lg px-[11px] py-[7px] {id === $chatId ||
|
class=" w-full flex justify-between rounded-lg px-[11px] py-[6px] {id === $chatId ||
|
||||||
confirmEdit
|
confirmEdit
|
||||||
? 'bg-gray-200 dark:bg-gray-900'
|
? 'bg-gray-200 dark:bg-gray-900'
|
||||||
: selected
|
: selected
|
||||||
@ -222,7 +222,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<a
|
<a
|
||||||
class=" w-full flex justify-between rounded-lg px-[11px] py-[7px] {id === $chatId ||
|
class=" w-full flex justify-between rounded-lg px-[11px] py-[6px] {id === $chatId ||
|
||||||
confirmEdit
|
confirmEdit
|
||||||
? 'bg-gray-200 dark:bg-gray-900'
|
? 'bg-gray-200 dark:bg-gray-900'
|
||||||
: selected
|
: selected
|
||||||
@ -267,7 +267,7 @@
|
|||||||
: 'invisible group-hover:visible from-gray-100 dark:from-gray-950'}
|
: 'invisible group-hover:visible from-gray-100 dark:from-gray-950'}
|
||||||
absolute {className === 'pr-2'
|
absolute {className === 'pr-2'
|
||||||
? 'right-[8px]'
|
? 'right-[8px]'
|
||||||
: 'right-0'} top-[5px] py-1 pr-0.5 mr-2 pl-5 bg-gradient-to-l from-80%
|
: 'right-0'} top-[4px] py-1 pr-0.5 mr-1.5 pl-5 bg-gradient-to-l from-80%
|
||||||
|
|
||||||
to-transparent"
|
to-transparent"
|
||||||
on:mouseenter={(e) => {
|
on:mouseenter={(e) => {
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
reader.onload = async function (event) {
|
reader.onload = async function (event) {
|
||||||
try {
|
try {
|
||||||
const fileContent = JSON.parse(event.target.result);
|
const fileContent = JSON.parse(event.target.result);
|
||||||
|
open = true;
|
||||||
dispatch('import', {
|
dispatch('import', {
|
||||||
folderId: folderId,
|
folderId: folderId,
|
||||||
items: fileContent
|
items: fileContent
|
||||||
@ -325,7 +326,7 @@
|
|||||||
<div bind:this={folderElement} class="relative {className}" draggable="true">
|
<div bind:this={folderElement} class="relative {className}" draggable="true">
|
||||||
{#if draggedOver}
|
{#if draggedOver}
|
||||||
<div
|
<div
|
||||||
class="absolute top-0 left-0 w-full h-full rounded-sm bg-[hsla(258,88%,66%,0.1)] bg-opacity-50 dark:bg-opacity-10 z-50 pointer-events-none touch-none"
|
class="absolute top-0 left-0 w-full h-full rounded-sm bg-[hsla(260,85%,65%,0.1)] bg-opacity-50 dark:bg-opacity-10 z-50 pointer-events-none touch-none"
|
||||||
></div>
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<slot name="content">
|
<slot name="content">
|
||||||
<DropdownMenu.Content
|
<DropdownMenu.Content
|
||||||
class="w-full {className} text-sm rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow font-primary"
|
class="w-full {className} text-sm rounded-xl px-1 py-1.5 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-xl font-primary"
|
||||||
sideOffset={8}
|
sideOffset={8}
|
||||||
side="bottom"
|
side="bottom"
|
||||||
align="start"
|
align="start"
|
||||||
@ -68,7 +68,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class=" self-center font-medium">{$i18n.t('Settings')}</div>
|
<div class=" self-center">{$i18n.t('Settings')}</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@ -85,7 +85,7 @@
|
|||||||
<div class=" self-center mr-3">
|
<div class=" self-center mr-3">
|
||||||
<ArchiveBox className="size-5" strokeWidth="1.5" />
|
<ArchiveBox className="size-5" strokeWidth="1.5" />
|
||||||
</div>
|
</div>
|
||||||
<div class=" self-center font-medium">{$i18n.t('Archived Chats')}</div>
|
<div class=" self-center">{$i18n.t('Archived Chats')}</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if role === 'admin'}
|
{#if role === 'admin'}
|
||||||
@ -116,7 +116,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class=" self-center font-medium">{$i18n.t('Playground')}</div>
|
<div class=" self-center">{$i18n.t('Playground')}</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@ -146,7 +146,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class=" self-center font-medium">{$i18n.t('Admin Panel')}</div>
|
<div class=" self-center">{$i18n.t('Admin Panel')}</div>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class=" self-center font-medium">{$i18n.t('Sign Out')}</div>
|
<div class=" self-center">{$i18n.t('Sign Out')}</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if $activeUserCount}
|
{#if $activeUserCount}
|
||||||
@ -201,7 +201,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" ">
|
<div class=" ">
|
||||||
<span class=" font-medium">
|
<span class="">
|
||||||
{$i18n.t('Active Users')}:
|
{$i18n.t('Active Users')}:
|
||||||
</span>
|
</span>
|
||||||
<span class=" font-semibold">
|
<span class=" font-semibold">
|
||||||
@ -212,7 +212,7 @@
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- <DropdownMenu.Item class="flex items-center px-3 py-2 text-sm font-medium">
|
<!-- <DropdownMenu.Item class="flex items-center px-3 py-2 text-sm ">
|
||||||
<div class="flex items-center">Profile</div>
|
<div class="flex items-center">Profile</div>
|
||||||
</DropdownMenu.Item> -->
|
</DropdownMenu.Item> -->
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user