This commit is contained in:
Timothy J. Baek 2024-10-17 19:45:18 -07:00
parent c171e624eb
commit e6f4da2bfc
3 changed files with 14 additions and 18 deletions

View File

@ -373,6 +373,7 @@ class ChatTable:
all_chats = (
db.query(Chat)
.filter_by(user_id=user_id, pinned=True, archived=False)
.filter(Chat.folder_id == None)
.order_by(Chat.updated_at.desc())
)
return [ChatModel.model_validate(chat) for chat in all_chats]
@ -520,9 +521,7 @@ class ChatTable:
) -> list[ChatModel]:
with get_db() as db:
query = db.query(Chat).filter_by(folder_id=folder_id, user_id=user_id)
query = query.filter_by(archived=False)
query = query.filter(or_(Chat.pinned == False, Chat.pinned == None))
query = query.order_by(Chat.updated_at.desc())

View File

@ -22,11 +22,13 @@
const onDragOver = (e) => {
e.preventDefault();
e.stopPropagation();
draggedOver = true;
};
const onDrop = (e) => {
e.preventDefault();
e.stopPropagation();
if (folderElement.contains(e.target)) {
console.log('Dropped on the Button');
@ -47,6 +49,8 @@
const onDragLeave = (e) => {
e.preventDefault();
e.stopPropagation();
draggedOver = false;
};

View File

@ -246,21 +246,21 @@
}
};
let dragged = false;
let draggedOver = false;
const onDragOver = (e) => {
e.preventDefault();
// Check if a file is being dragged.
// Check if a file is being draggedOver.
if (e.dataTransfer?.types?.includes('Files')) {
dragged = true;
draggedOver = true;
} else {
dragged = false;
draggedOver = false;
}
};
const onDragLeave = () => {
dragged = false;
draggedOver = false;
};
const onDrop = async (e) => {
@ -277,7 +277,7 @@
}
}
dragged = false; // Reset dragged status after drop
draggedOver = false; // Reset draggedOver status after drop
};
let touchstart;
@ -406,17 +406,10 @@
"
data-state={$showSidebar}
>
{#if dragged}
{#if draggedOver}
<div
class="absolute w-full h-full max-h-full backdrop-blur bg-gray-800/40 flex justify-center z-[999] touch-none pointer-events-none"
>
<div class="m-auto pt-64 flex flex-col justify-center">
<AddFilesPlaceholder
title={$i18n.t('Drop Chat Export')}
content={$i18n.t('Drop a chat export file here to import it.')}
/>
</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"
></div>
{/if}
<div
class="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] overflow-x-hidden z-50 {$showSidebar