Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

add +layout.svelte for main layout structure and navigation

Tonho43a110ead54c
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
new file mode 100644
index 00000000..10da12fa
--- /dev/null
+++ b/src/routes/+layout.svelte
@@ -0,0 +1,116 @@
+<script lang="ts">
+ import "../app.css";
+ import { page } from "$app/state";
+ import type { Snippet } from "svelte";
+
+ let { children }: { children: Snippet } = $props();
+
+ const nav = [
+ { href: "/", label: "Home", icon: "home" },
+ { href: "/downloads", label: "Downloads", icon: "downloads" },
+ { href: "/hotmart", label: "Hotmart", icon: "hotmart" },
+ { href: "/settings", label: "Settings", icon: "settings" },
+ ] as const;
+
+ function isActive(href: string): boolean {
+ if (href === "/") return page.url.pathname === "/";
+ return page.url.pathname.startsWith(href);
+ }
+</script>
+
+<div class="layout">
+ <nav class="sidebar">
+ {#each nav as item}
+ <a
+ href={item.href}
+ class="nav-item"
+ class:active={isActive(item.href)}
+ title={item.label}
+ >
+ <span class="indicator"></span>
+ <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
+ {#if item.icon === "home"}
+ <path d="M3 12L12 3l9 9" />
+ <path d="M5 10v9a1 1 0 001 1h3v-5h6v5h3a1 1 0 001-1v-9" />
+ {:else if item.icon === "downloads"}
+ <path d="M12 3v12m0 0l-4-4m4 4l4-4" />
+ <path d="M4 17v2a1 1 0 001 1h14a1 1 0 001-1v-2" />
+ {:else if item.icon === "hotmart"}
+ <path d="M6 4v16" />
+ <path d="M18 4v16" />
+ <path d="M6 12h12" />
+ {:else if item.icon === "settings"}
+ <circle cx="12" cy="12" r="3" />
+ <path d="M12 1v2m0 18v2M4.22 4.22l1.42 1.42m12.72 12.72l1.42 1.42M1 12h2m18 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" />
+ {/if}
+ </svg>
+ </a>
+ {/each}
+ </nav>
+
+ <main class="content">
+ {@render children()}
+ </main>
+</div>
+
+<style>
+ .layout {
+ display: flex;
+ height: 100vh;
+ overflow: hidden;
+ }
+
+ .sidebar {
+ width: var(--sidebar-width);
+ min-width: var(--sidebar-width);
+ height: 100vh;
+ background: var(--bg-secondary);
+ border-right: 1px solid var(--border);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding-top: 12px;
+ gap: 4px;
+ }
+
+ .nav-item {
+ position: relative;
+ width: 44px;
+ height: 44px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 10px;
+ color: var(--text-muted);
+ transition: color 0.2s, background-color 0.2s;
+ }
+
+ .nav-item:hover {
+ color: var(--text);
+ background-color: rgba(255, 255, 255, 0.05);
+ }
+
+ .nav-item.active {
+ color: var(--accent);
+ }
+
+ .indicator {
+ position: absolute;
+ left: -8px;
+ width: 3px;
+ height: 0;
+ background: var(--accent);
+ border-radius: 0 2px 2px 0;
+ transition: height 0.2s;
+ }
+
+ .nav-item.active .indicator {
+ height: 20px;
+ }
+
+ .content {
+ flex: 1;
+ overflow-y: auto;
+ padding: 32px;
+ }
+</style>