Sİdebar'da music kategorisi oluşturuldu

This commit is contained in:
2025-12-01 01:50:33 +03:00
parent cd36080b3a
commit 1c39ef5d37
8 changed files with 536 additions and 18 deletions

View File

@@ -1,8 +1,9 @@
<script>
import { Link } from "svelte-routing";
import { createEventDispatcher, onDestroy, onMount, tick } from "svelte";
import { movieCount } from "../stores/movieStore.js";
import { tvShowCount } from "../stores/tvStore.js";
import { movieCount } from "../stores/movieStore.js";
import { tvShowCount } from "../stores/tvStore.js";
import { musicCount } from "../stores/musicStore.js";
import { trashCount } from "../stores/trashStore.js";
import { apiFetch } from "../utils/api.js";
@@ -10,7 +11,8 @@
const dispatch = createEventDispatcher();
let hasMovies = false;
let hasShows = false;
let hasTrash = false;
let hasTrash = false;
let hasMusic = false;
// Svelte store kullanarak reaktivite sağla
import { writable } from 'svelte/store';
const diskSpaceStore = writable({ totalGB: '0', usedGB: '0', usedPercent: 0 });
@@ -39,14 +41,19 @@
hasShows = (count ?? 0) > 0;
});
const unsubscribeTrash = trashCount.subscribe((count) => {
hasTrash = (count ?? 0) > 0;
});
const unsubscribeTrash = trashCount.subscribe((count) => {
hasTrash = (count ?? 0) > 0;
});
const unsubscribeMusic = musicCount.subscribe((count) => {
hasMusic = (count ?? 0) > 0;
});
onDestroy(() => {
unsubscribeMovie();
unsubscribeTv();
unsubscribeTrash();
unsubscribeMusic();
if (unsubscribeDiskSpace) {
unsubscribeDiskSpace();
}
@@ -167,6 +174,20 @@
</Link>
{/if}
{#if hasMusic}
<Link
to="/music"
class="item"
getProps={({ isCurrent }) => ({
class: isCurrent ? "item active" : "item",
})}
on:click={handleLinkClick}
>
<i class="fa-solid fa-music icon"></i>
Music
</Link>
{/if}
<Link
to="/transfers"
class="item"