|
1 | 1 | <script lang="ts"> |
2 | | - import { DragDropProvider } from "@dnd-kit-svelte/svelte"; |
3 | | - import { RestrictToVerticalAxis } from "@dnd-kit/abstract/modifiers"; |
4 | | - import { move } from "@dnd-kit/helpers"; |
5 | 2 | import { onDestroy } from "svelte"; |
6 | 3 | import { flip } from "svelte/animate"; |
7 | 4 | import { app } from "$lib/app.svelte"; |
8 | 5 | import type { Channel } from "$lib/models/channel.svelte"; |
9 | 6 | import { settings } from "$lib/settings"; |
10 | 7 | import Draggable from "./Draggable.svelte"; |
| 8 | + import DraggableChannel from "./DraggableChannel.svelte"; |
11 | 9 | import Droppable from "./Droppable.svelte"; |
12 | 10 | import { getSidebarContext } from "./Sidebar.svelte"; |
13 | | - import StreamTooltip from "./StreamTooltip.svelte"; |
14 | 11 | import { Separator } from "./ui/separator"; |
15 | 12 |
|
16 | 13 | const sidebar = getSidebarContext(); |
|
79 | 76 | onDestroy(() => clearInterval(interval)); |
80 | 77 | </script> |
81 | 78 |
|
82 | | -<DragDropProvider |
83 | | - modifiers={[ |
84 | | - // @ts-expect-error - type mismatch |
85 | | - RestrictToVerticalAxis, |
86 | | - ]} |
87 | | - onDragOver={(event) => { |
88 | | - settings.state.pinned = move(settings.state.pinned, event); |
89 | | - }} |
90 | | -> |
91 | | - {#each groups as group} |
92 | | - {#if sidebar.collapsed} |
93 | | - <Separator /> |
94 | | - {:else} |
95 | | - <span |
96 | | - class="text-muted-foreground mt-2 inline-block px-2 text-xs font-semibold uppercase" |
97 | | - > |
98 | | - {group.type} |
99 | | - </span> |
100 | | - {/if} |
| 79 | +{#each groups as group} |
| 80 | + {#if sidebar.collapsed} |
| 81 | + <Separator /> |
| 82 | + {:else} |
| 83 | + <span class="text-muted-foreground mt-2 inline-block px-2 text-xs font-semibold uppercase"> |
| 84 | + {group.type} |
| 85 | + </span> |
| 86 | + {/if} |
101 | 87 |
|
102 | | - {#if group.type === "Pinned"} |
103 | | - <Droppable id="pinned-channels" class="space-y-1.5"> |
104 | | - {#each group.channels as channel, i (channel.user.id)} |
105 | | - <Draggable id={channel.id} index={i} {channel} /> |
106 | | - {/each} |
107 | | - </Droppable> |
108 | | - {:else} |
109 | | - {#each group.channels as channel (channel.user.id)} |
110 | | - <div class="px-1.5" animate:flip={{ duration: 500 }}> |
111 | | - <StreamTooltip {channel} /> |
112 | | - </div> |
| 88 | + {#if group.type === "Pinned"} |
| 89 | + <Droppable id="pinned-channels" class="space-y-1.5"> |
| 90 | + {#each group.channels as channel, i (channel.user.id)} |
| 91 | + <Draggable index={i} {channel} /> |
113 | 92 | {/each} |
114 | | - {/if} |
115 | | - {/each} |
116 | | -</DragDropProvider> |
| 93 | + </Droppable> |
| 94 | + {:else} |
| 95 | + {#each group.channels as channel (channel.user.id)} |
| 96 | + <div animate:flip={{ duration: 500 }}> |
| 97 | + <DraggableChannel {channel} /> |
| 98 | + </div> |
| 99 | + {/each} |
| 100 | + {/if} |
| 101 | +{/each} |
0 commit comments