feat(ui): add drag-to-reorder for pinned notes in sidebar (#25677)

This commit is contained in:
G30 authored and GitHub committed 2026-06-29 03:22:33 -05:00
1 parent 3fd0384ffc
commit 70b89d01c2
3 files changed
+102 -45

No files matched your search

+2 -45
View File
@@ -78,6 +78,7 @@
import FolderModal from './Sidebar/Folders/FolderModal.svelte';
import Sidebar from '../icons/Sidebar.svelte';
import PinnedModelList from './Sidebar/PinnedModelList.svelte';
import PinnedNoteList from './Sidebar/PinnedNoteList.svelte';
import Note from '../icons/Note.svelte';
import Code from '../icons/Code.svelte';
import { slide } from 'svelte/transition';
@@ -1257,51 +1258,7 @@
}}
onAddLabel={$i18n.t('New Note')}
>
<div class="mt-0.5 pb-1.5">
{#each $pinnedNotes as note (note.id)}
<a
class="w-full flex items-center gap-2.5 rounded-xl px-2.5 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-900 transition group text-sm"
href={`/notes/${note.id}`}
on:click={() => {
itemClickHandler();
}}
draggable="false"
>
<div class="self-center">
<Note className="size-4" strokeWidth="2" />
</div>
<div class="flex-1 text-ellipsis line-clamp-1">
{note.title}
</div>
<button
class="invisible group-hover:visible self-center p-0.5 hover:bg-gray-200 dark:hover:bg-gray-800 rounded-lg transition"
on:click|preventDefault|stopPropagation={async () => {
await toggleNotePinnedStatusById(localStorage.token, note.id);
const _pinnedNotes = await getPinnedNoteList(localStorage.token).catch(
() => []
);
pinnedNotes.set(_pinnedNotes);
}}
aria-label={$i18n.t('Unpin')}
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
class="size-3.5"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6 18 18 6M6 6l12 12"
/>
</svg>
</button>
</a>
{/each}
</div>
<PinnedNoteList bind:selectedChatId />
</Folder>
{/if}