refac
This commit is contained in:
1 parent
db934a3b4f
commit
ba067258de
39 files changed
+1540
-1442
No files matched your search
@@ -13,6 +13,8 @@
|
||||
import SharedChatsModal from '$lib/components/layout/SharedChatsModal.svelte';
|
||||
import FilesModal from '$lib/components/layout/FilesModal.svelte';
|
||||
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
|
||||
import UserSettingRow from './UserSettingRow.svelte';
|
||||
import UserSettingSection from './UserSettingSection.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -27,6 +29,8 @@
|
||||
let showFilesModal = false;
|
||||
|
||||
let chatImportInputElement: HTMLInputElement;
|
||||
const actionButtonClass =
|
||||
'text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-gray-500 dark:hover:text-white';
|
||||
|
||||
$: if (importFiles) {
|
||||
console.log(importFiles);
|
||||
@@ -137,7 +141,7 @@
|
||||
{$i18n.t('Data Controls')}
|
||||
</h2>
|
||||
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5 space-y-3">
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<input
|
||||
id="chat-import-input"
|
||||
bind:this={chatImportInputElement}
|
||||
@@ -147,106 +151,102 @@
|
||||
hidden
|
||||
/>
|
||||
|
||||
<div>
|
||||
<div class="text-xs text-gray-400 dark:text-gray-600 mb-2">{$i18n.t('Chats')}</div>
|
||||
|
||||
<UserSettingSection title={$i18n.t('Chats')} first>
|
||||
{#if $user?.role === 'admin' || ($user.permissions?.chat?.import ?? true)}
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Import Chats')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
chatImportInputElement.click();
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Import')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Import Chats')}
|
||||
description={$i18n.t('Import chat history from a JSON export file.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
chatImportInputElement.click();
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Import')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
{/if}
|
||||
|
||||
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Export Chats')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
exportChats();
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Export')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Export Chats')}
|
||||
description={$i18n.t('Download your chat history as a JSON export.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
exportChats();
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Export')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Shared Chats')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
showSharedChatsModal = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Manage')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Shared Chats')}
|
||||
description={$i18n.t('Review and manage chats you have shared.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
showSharedChatsModal = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Manage')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Archive All Chats')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
showArchiveConfirmDialog = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Archive All')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Archive All Chats')}
|
||||
description={$i18n.t('Move every chat into the archive after confirmation.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
showArchiveConfirmDialog = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Archive All')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Delete All Chats')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
showDeleteConfirmDialog = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Delete All')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Delete All Chats')}
|
||||
description={$i18n.t('Permanently delete every chat after confirmation.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
showDeleteConfirmDialog = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Delete All')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
</UserSettingSection>
|
||||
|
||||
<div>
|
||||
<div class="text-xs text-gray-400 dark:text-gray-600 mb-2">{$i18n.t('Files')}</div>
|
||||
|
||||
<div>
|
||||
<div class="py-0.5 flex w-full justify-between">
|
||||
<div class="self-center text-xs">{$i18n.t('Manage Files')}</div>
|
||||
<button
|
||||
class="p-1 px-3 text-xs flex rounded-sm transition"
|
||||
on:click={() => {
|
||||
showFilesModal = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<span class="self-center">{$i18n.t('Manage')}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<UserSettingSection title={$i18n.t('Files')}>
|
||||
<UserSettingRow
|
||||
label={$i18n.t('Manage Files')}
|
||||
description={$i18n.t('Open the file manager for uploaded files.')}
|
||||
>
|
||||
<button
|
||||
class={actionButtonClass}
|
||||
on:click={() => {
|
||||
showFilesModal = true;
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
{$i18n.t('Manage')}
|
||||
</button>
|
||||
</UserSettingRow>
|
||||
</UserSettingSection>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user