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.

feat(study): add sleep timer and listen together features, enhance equalizer panel

Tonho420a9f52d403
diff --git a/src/lib/study-music-components/EqualizerPanel.svelte b/src/lib/study-music-components/EqualizerPanel.svelte
index 9511a53b..2dd5efac 100644
--- a/src/lib/study-music-components/EqualizerPanel.svelte
+++ b/src/lib/study-music-components/EqualizerPanel.svelte
@@ -106,6 +106,53 @@
{/each}
</div>
+ <div class="crossfade-row">
+ <div class="crossfade-head">
+ <span class="crossfade-label">{$t("study.music.crossfade_label")}</span>
+ <span class="crossfade-value">
+ {musicPlayer.crossfadeSec === 0
+ ? $t("study.music.crossfade_off")
+ : `${musicPlayer.crossfadeSec}s`}
+ </span>
+ </div>
+ <input
+ type="range"
+ min="0"
+ max="12"
+ step="1"
+ value={musicPlayer.crossfadeSec}
+ oninput={(e) =>
+ musicPlayer.setCrossfade(Number((e.currentTarget as HTMLInputElement).value))}
+ />
+ </div>
+
+ <div class="extras-row">
+ <label class="toggle">
+ <input
+ type="checkbox"
+ checked={musicPlayer.normalizationEnabled}
+ onchange={(e) =>
+ musicPlayer.setNormalization((e.currentTarget as HTMLInputElement).checked)}
+ />
+ <span>
+ <strong>{$t("study.music.normalization_label")}</strong>
+ <em>{$t("study.music.normalization_hint")}</em>
+ </span>
+ </label>
+ <label class="toggle">
+ <input
+ type="checkbox"
+ checked={musicPlayer.skipSilenceEnabled}
+ onchange={(e) =>
+ musicPlayer.setSkipSilence((e.currentTarget as HTMLInputElement).checked)}
+ />
+ <span>
+ <strong>{$t("study.music.skip_silence_label")}</strong>
+ <em>{$t("study.music.skip_silence_hint")}</em>
+ </span>
+ </label>
+ </div>
+
<footer class="foot">
<button
type="button"
@@ -243,12 +290,73 @@
.band input[type="range"] {
writing-mode: vertical-lr;
direction: rtl;
- appearance: slider-vertical;
- -webkit-appearance: slider-vertical;
width: 18px;
height: 160px;
accent-color: var(--accent);
}
+ .crossfade-row {
+ padding: 12px 20px 4px;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ border-top: 1px solid rgba(255, 255, 255, 0.06);
+ margin-top: 12px;
+ }
+ .crossfade-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+ .crossfade-label {
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: rgba(255, 255, 255, 0.5);
+ }
+ .crossfade-value {
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.85);
+ font-variant-numeric: tabular-nums;
+ }
+ .crossfade-row input[type="range"] {
+ width: 100%;
+ accent-color: var(--accent);
+ }
+ .extras-row {
+ padding: 8px 20px 12px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ }
+ .extras-row .toggle {
+ display: flex;
+ align-items: flex-start;
+ gap: 10px;
+ cursor: pointer;
+ }
+ .extras-row .toggle input {
+ margin-top: 3px;
+ width: 14px;
+ height: 14px;
+ accent-color: var(--accent);
+ flex-shrink: 0;
+ }
+ .extras-row .toggle span {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ }
+ .extras-row .toggle strong {
+ font-size: 13px;
+ font-weight: 600;
+ color: rgba(255, 255, 255, 0.85);
+ }
+ .extras-row .toggle em {
+ font-size: 11px;
+ color: rgba(255, 255, 255, 0.5);
+ font-style: normal;
+ line-height: 1.3;
+ }
.freq {
font-size: 10px;
color: rgba(255, 255, 255, 0.45);
diff --git a/src/lib/study-music-components/ListenTogetherPanel.svelte b/src/lib/study-music-components/ListenTogetherPanel.svelte
new file mode 100644
index 00000000..7fbfba80
--- /dev/null
+++ b/src/lib/study-music-components/ListenTogetherPanel.svelte
@@ -0,0 +1,496 @@
+<script lang="ts">
+ import { listenTogether } from "$lib/study-music/listen-together-store.svelte";
+ import { t } from "$lib/i18n";
+
+ type Props = {
+ open: boolean;
+ onClose: () => void;
+ };
+
+ let { open, onClose }: Props = $props();
+
+ let codeInput = $state("");
+ let chatInput = $state("");
+ let copied = $state(false);
+
+ function copyCode() {
+ if (!listenTogether.roomCode) return;
+ void navigator.clipboard.writeText(listenTogether.roomCode).then(() => {
+ copied = true;
+ setTimeout(() => (copied = false), 1200);
+ });
+ }
+
+ function createRoom() {
+ listenTogether.createRoom();
+ }
+
+ function joinRoom() {
+ const code = codeInput.trim().toUpperCase();
+ if (code.length < 4) return;
+ listenTogether.joinRoom(code);
+ codeInput = "";
+ }
+
+ function leave() {
+ listenTogether.disconnect();
+ }
+
+ function sendChat() {
+ listenTogether.sendChat(chatInput);
+ chatInput = "";
+ }
+
+ function onChatKey(e: KeyboardEvent) {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ sendChat();
+ }
+ }
+
+ function onKey(e: KeyboardEvent) {
+ if (e.key === "Escape") {
+ e.preventDefault();
+ onClose();
+ }
+ }
+</script>
+
+{#if open}
+ <div
+ class="overlay"
+ role="presentation"
+ onclick={(e) => {
+ if (e.target === e.currentTarget) onClose();
+ }}
+ onkeydown={onKey}
+ >
+ <div class="dialog" role="dialog" aria-modal="true" tabindex="-1">
+ <header class="head">
+ <h3>{$t("study.music.listen_together_title")}</h3>
+ <button
+ type="button"
+ class="close"
+ onclick={onClose}
+ aria-label={$t("study.common.close") as string}
+ >×</button>
+ </header>
+
+ <div class="body">
+ {#if listenTogether.status === "idle" || listenTogether.status === "error"}
+ <p class="intro">{$t("study.music.listen_together_intro")}</p>
+
+ <label class="field">
+ <span class="field-label">{$t("study.music.listen_together_relay_url")}</span>
+ <input
+ type="text"
+ class="text-input"
+ placeholder="ws://localhost:8787"
+ value={listenTogether.relayUrl}
+ oninput={(e) =>
+ listenTogether.setRelayUrl((e.currentTarget as HTMLInputElement).value)}
+ />
+ <span class="field-hint">{$t("study.music.listen_together_relay_hint")}</span>
+ </label>
+
+ <label class="field">
+ <span class="field-label">{$t("study.music.listen_together_name")}</span>
+ <input
+ type="text"
+ class="text-input"
+ maxlength="40"
+ value={listenTogether.displayName}
+ oninput={(e) =>
+ listenTogether.setDisplayName((e.currentTarget as HTMLInputElement).value)}
+ />
+ </label>
+
+ {#if listenTogether.errorMessage}
+ <div class="error-row">{listenTogether.errorMessage}</div>
+ {/if}
+
+ <div class="actions">
+ <button
+ type="button"
+ class="primary"
+ onclick={createRoom}
+ disabled={!listenTogether.relayUrl || !listenTogether.displayName}
+ >
+ {$t("study.music.listen_together_create")}
+ </button>
+ <div class="join-row">
+ <input
+ type="text"
+ class="text-input code"
+ placeholder="ABCDEF"
+ maxlength="12"
+ bind:value={codeInput}
+ />
+ <button
+ type="button"
+ class="ghost"
+ onclick={joinRoom}
+ disabled={!listenTogether.relayUrl || !listenTogether.displayName || codeInput.trim().length < 4}
+ >
+ {$t("study.music.listen_together_join")}
+ </button>
+ </div>
+ </div>
+ {:else if listenTogether.status === "connecting"}
+ <div class="status connecting">{$t("study.music.listen_together_connecting")}</div>
+ {:else if listenTogether.status === "connected"}
+ <div class="connected-head">
+ <div class="room-info">
+ <span class="room-label">{$t("study.music.listen_together_room")}</span>
+ <button type="button" class="room-code" onclick={copyCode} title="Copy code">
+ {listenTogether.roomCode}
+ {#if copied}<em>{$t("study.music.listen_together_copied")}</em>{/if}
+ </button>
+ </div>
+ <span class="role-badge" class:host={listenTogether.isHost}>
+ {listenTogether.isHost
+ ? $t("study.music.listen_together_role_host")
+ : $t("study.music.listen_together_role_guest")}
+ </span>
+ </div>
+
+ <div class="members">
+ <h4>{$t("study.music.listen_together_members")} ({listenTogether.members.length})</h4>
+ <ul>
+ {#each listenTogether.members as m (m.id)}
+ <li>
+ <span class="dot" class:host={m.role === "host"}></span>
+ <span class="member-name">{m.name}</span>
+ {#if m.role === "host"}<span class="member-role">host</span>{/if}
+ {#if m.id === listenTogether.selfId}<span class="member-you">{$t("study.music.listen_together_you")}</span>{/if}
+ </li>
+ {/each}
+ </ul>
+ </div>
+
+ <div class="chat">
+ <h4>{$t("study.music.listen_together_chat")}</h4>
+ <div class="chat-log">
+ {#each listenTogether.chat as line (line.at)}
+ <div class="chat-line">
+ <strong>{line.name}:</strong>
+ <span>{line.text}</span>
+ </div>
+ {:else}
+ <span class="chat-empty">{$t("study.music.listen_together_chat_empty")}</span>
+ {/each}
+ </div>
+ <div class="chat-input-row">
+ <input
+ type="text"
+ class="text-input"
+ placeholder={$t("study.music.listen_together_chat_placeholder") as string}
+ bind:value={chatInput}
+ onkeydown={onChatKey}
+ />
+ <button type="button" class="ghost" onclick={sendChat} disabled={!chatInput.trim()}>
+ {$t("study.music.listen_together_send")}
+ </button>
+ </div>
+ </div>
+
+ <div class="actions end">
+ <button type="button" class="danger" onclick={leave}>
+ {$t("study.music.listen_together_leave")}
+ </button>
+ </div>
+ {/if}
+ </div>
+ </div>
+ </div>
+{/if}
+
+<style>
+ .overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ display: grid;
+ place-items: center;
+ z-index: 999;
+ }
+ .dialog {
+ background: var(--bg-card, #1a1a1a);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ width: min(520px, 92vw);
+ max-height: 86vh;
+ overflow: auto;
+ display: flex;
+ flex-direction: column;
+ }
+ .head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 14px 18px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+ }
+ .head h3 {
+ margin: 0;
+ font-size: 16px;
+ }
+ .close {
+ background: transparent;
+ border: none;
+ color: inherit;
+ font-size: 22px;
+ cursor: pointer;
+ line-height: 1;
+ }
+ .body {
+ padding: 16px 18px 18px;
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ }
+ .intro {
+ margin: 0;
+ color: rgba(255, 255, 255, 0.6);
+ font-size: 13px;
+ line-height: 1.5;
+ }
+ .field {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+ .field-label {
+ font-size: 12px;
+ color: rgba(255, 255, 255, 0.55);
+ text-transform: uppercase;
+ letter-spacing: 0.04em;
+ }
+ .field-hint {
+ font-size: 11px;
+ color: rgba(255, 255, 255, 0.4);
+ }
+ .text-input {
+ appearance: none;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ color: inherit;
+ padding: 8px 12px;
+ border-radius: 8px;
+ font: inherit;
+ font-size: 14px;
+ }
+ .text-input.code {
+ font-family: ui-monospace, "Cascadia Code", monospace;
+ letter-spacing: 0.12em;
+ text-transform: uppercase;
+ width: 140px;
+ }
+ .error-row {
+ background: rgba(255, 100, 80, 0.1);
+ border: 1px solid rgba(255, 100, 80, 0.3);
+ color: #ffb5a4;
+ padding: 8px 12px;
+ border-radius: 8px;
+ font-size: 12px;
+ }
+ .actions {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin-top: 4px;
+ }
+ .actions.end {
+ flex-direction: row;
+ justify-content: flex-end;
+ margin-top: 6px;
+ }
+ .primary {
+ appearance: none;
+ background: var(--accent, #6f4eff);
+ border: none;
+ color: white;
+ padding: 9px 16px;
+ border-radius: 8px;
+ cursor: pointer;
+ font: inherit;
+ font-weight: 600;
+ }
+ .primary:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .ghost {
+ appearance: none;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ color: inherit;
+ padding: 8px 14px;
+ border-radius: 8px;
+ cursor: pointer;
+ font: inherit;
+ }
+ .ghost:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .danger {
+ appearance: none;
+ background: transparent;
+ border: 1px solid rgba(255, 100, 80, 0.3);
+ color: #ffb5a4;
+ padding: 7px 14px;
+ border-radius: 8px;
+ cursor: pointer;
+ font: inherit;
+ }
+ .danger:hover {
+ background: rgba(255, 100, 80, 0.1);
+ }
+ .join-row {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ }
+ .status {
+ text-align: center;
+ color: rgba(255, 255, 255, 0.7);
+ padding: 24px 0;
+ }
+ .connected-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 12px;
+ background: rgba(111, 78, 255, 0.08);
+ border: 1px solid rgba(111, 78, 255, 0.18);
+ border-radius: 8px;
+ }
+ .room-info {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ }
+ .room-label {
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ color: rgba(255, 255, 255, 0.5);
+ }
+ .room-code {
+ appearance: none;
+ background: transparent;
+ border: none;
+ color: inherit;
+ font-family: ui-monospace, "Cascadia Code", monospace;
+ font-size: 18px;
+ letter-spacing: 0.12em;
+ font-weight: 700;
+ cursor: pointer;
+ padding: 0;
+ text-align: left;
+ }
+ .room-code em {
+ font-size: 11px;
+ font-style: normal;
+ color: #6f4eff;
+ margin-left: 8px;
+ letter-spacing: 0;
+ }
+ .role-badge {
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ padding: 3px 8px;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: rgba(255, 255, 255, 0.7);
+ }
+ .role-badge.host {
+ background: rgba(255, 213, 100, 0.15);
+ color: #ffd564;
+ }
+ .members h4,
+ .chat h4 {
+ margin: 0 0 6px;
+ font-size: 11px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: rgba(255, 255, 255, 0.5);
+ font-weight: 500;
+ }
+ .members ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+ .members li {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 13px;
+ }
+ .dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: rgba(255, 255, 255, 0.4);
+ }
+ .dot.host {
+ background: #ffd564;
+ }
+ .member-name {
+ flex: 1;
+ color: rgba(255, 255, 255, 0.85);
+ }
+ .member-role {
+ font-size: 10px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: rgba(255, 213, 100, 0.8);
+ }
+ .member-you {
+ font-size: 11px;
+ color: rgba(111, 78, 255, 0.8);
+ }
+ .chat-log {
+ max-height: 160px;
+ overflow-y: auto;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ background: rgba(255, 255, 255, 0.03);
+ border-radius: 8px;
+ padding: 8px 10px;
+ }
+ .chat-line {
+ font-size: 13px;
+ line-height: 1.35;
+ }
+ .chat-line strong {
+ color: rgba(255, 255, 255, 0.85);
+ margin-right: 4px;
+ }
+ .chat-line span {
+ color: rgba(255, 255, 255, 0.7);
+ word-break: break-word;
+ }
+ .chat-empty {
+ color: rgba(255, 255, 255, 0.35);
+ font-size: 12px;
+ font-style: italic;
+ text-align: center;
+ padding: 16px 0;
+ }
+ .chat-input-row {
+ display: flex;
+ gap: 8px;
+ margin-top: 6px;
+ }
+ .chat-input-row .text-input {
+ flex: 1;
+ }
+</style>
diff --git a/src/lib/study-music-components/PlayerBar.svelte b/src/lib/study-music-components/PlayerBar.svelte
index 02637863..d477e5a8 100644
--- a/src/lib/study-music-components/PlayerBar.svelte
+++ b/src/lib/study-music-components/PlayerBar.svelte
@@ -2,6 +2,7 @@
import { goto } from "$app/navigation";
import { musicPlayer } from "$lib/study-music/player-store.svelte";
import { musicUI } from "$lib/study-music/ui-store.svelte";
+ import { listenTogether } from "$lib/study-music/listen-together-store.svelte";
import { t } from "$lib/i18n";
import CoverImage from "./CoverImage.svelte";
import ProgressBar from "./ProgressBar.svelte";
@@ -266,6 +267,33 @@
<line x1="3" y1="13" x2="7" y2="13"/>
</svg>
</button>
+ <button
+ type="button"
+ class="ctrl-btn"
+ class:active={listenTogether.connected}
+ onclick={() => musicUI.toggleListenTogether()}
+ aria-label={$t("study.music.listen_together_title") as string}
+ title={$t("study.music.listen_together_title") as string}
+ >
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/>
+ <circle cx="9" cy="7" r="4"/>
+ <path d="M22 21v-2a4 4 0 0 0-3-3.87"/>
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"/>
+ </svg>
+ </button>
+ <button
+ type="button"
+ class="ctrl-btn"
+ class:active={musicPlayer.sleepTimerEndsAt !== null || musicPlayer.sleepTimerEndOfTrack}
+ onclick={() => musicUI.toggleSleepTimer()}
+ aria-label={$t("study.music.sleep_timer_title") as string}
+ title={$t("study.music.sleep_timer_title") as string}
+ >
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
+ </svg>
+ </button>
<button
type="button"
class="ctrl-btn"
@@ -499,7 +527,7 @@
border: 0;
border-radius: 50%;
background: var(--secondary);
- color: var(--primary);
+ color: var(--secondary);
cursor: pointer;
display: grid;
place-items: center;
diff --git a/src/lib/study-music-components/SleepTimerPanel.svelte b/src/lib/study-music-components/SleepTimerPanel.svelte
new file mode 100644
index 00000000..d72d5c5e
--- /dev/null
+++ b/src/lib/study-music-components/SleepTimerPanel.svelte
@@ -0,0 +1,272 @@
+<script lang="ts">
+ import { musicPlayer } from "$lib/study-music/player-store.svelte";
+ import { t } from "$lib/i18n";
+
+ type Props = {
+ open: boolean;
+ onClose: () => void;
+ };
+
+ let { open, onClose }: Props = $props();
+
+ const PRESETS_MIN = [5, 15, 30, 45, 60, 90, 120];
+
+ let customMinutes = $state(20);
+ let now = $state(Date.now());
+
+ $effect(() => {
+ if (!open) return;
+ const tick = setInterval(() => {
+ now = Date.now();
+ }, 1000);
+ return () => clearInterval(tick);
+ });
+
+ const remainingSec = $derived.by(() => {
+ const ends = musicPlayer.sleepTimerEndsAt;
+ if (!ends) return 0;
+ return Math.max(0, Math.floor((ends - now) / 1000));
+ });
+
+ const remainingLabel = $derived.by(() => {
+ const s = remainingSec;
+ const m = Math.floor(s / 60);
+ const sec = s % 60;
+ return `${m.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
+ });
+
+ function applyPreset(minutes: number) {
+ musicPlayer.setSleepTimerMinutes(minutes);
+ }
+
+ function applyCustom() {
+ const m = Math.max(1, Math.min(720, Math.floor(customMinutes)));
+ musicPlayer.setSleepTimerMinutes(m);
+ }
+
+ function endOfTrack() {
+ musicPlayer.setSleepEndOfTrack(true);
+ }
+
+ function cancel() {
+ musicPlayer.cancelSleepTimer();
+ }
+
+ function onKey(e: KeyboardEvent) {
+ if (e.key === "Escape") {
+ e.preventDefault();
+ onClose();
+ }
+ }
+</script>
+
+{#if open}
+ <div
+ class="overlay"
+ role="presentation"
+ onclick={(e) => {
+ if (e.target === e.currentTarget) onClose();
+ }}
+ onkeydown={onKey}
+ >
+ <div class="dialog" role="dialog" aria-modal="true" tabindex="-1">
+ <header class="head">
+ <h3>{$t("study.music.sleep_timer_title")}</h3>
+ <button type="button" class="close" onclick={onClose} aria-label={$t("study.common.close") as string}>×</button>
+ </header>
+
+ {#if musicPlayer.sleepTimerEndsAt}
+ <div class="active">
+ <span class="active-label">{$t("study.music.sleep_timer_active")}</span>
+ <span class="active-value">{remainingLabel}</span>
+ </div>
+ {:else if musicPlayer.sleepTimerEndOfTrack}
+ <div class="active">
+ <span class="active-label">{$t("study.music.sleep_timer_active")}</span>
+ <span class="active-value">{$t("study.music.sleep_timer_end_of_track")}</span>
+ </div>
+ {/if}
+
+ <div class="body">
+ <h4>{$t("study.music.sleep_timer_presets")}</h4>
+ <div class="presets">
+ {#each PRESETS_MIN as min (min)}
+ <button type="button" class="preset" onclick={() => applyPreset(min)}>
+ {min} {$t("study.music.sleep_timer_minutes_short")}
+ </button>
+ {/each}
+ </div>
+
+ <h4>{$t("study.music.sleep_timer_custom")}</h4>
+ <div class="custom-row">
+ <input
+ type="number"
+ class="num"
+ min="1"
+ max="720"
+ step="1"
+ bind:value={customMinutes}
+ />
+ <span class="unit">{$t("study.music.sleep_timer_minutes")}</span>
+ <button type="button" class="apply" onclick={applyCustom}>
+ {$t("study.music.sleep_timer_apply")}
+ </button>
+ </div>
+
+ <h4>{$t("study.music.sleep_timer_other")}</h4>
+ <div class="row">
+ <button type="button" class="alt" onclick={endOfTrack}>
+ {$t("study.music.sleep_timer_end_of_track")}
+ </button>
+ <button type="button" class="alt danger" onclick={cancel}>
+ {$t("study.music.sleep_timer_cancel")}
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+{/if}
+
+<style>
+ .overlay {
+ position: fixed;
+ inset: 0;
+ background: rgba(0, 0, 0, 0.6);
+ display: grid;
+ place-items: center;
+ z-index: 999;
+ }
+ .dialog {
+ background: var(--bg-card, #1a1a1a);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ width: min(440px, 90vw);
+ max-height: 80vh;
+ overflow: auto;
+ display: flex;
+ flex-direction: column;
+ }
+ .head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 14px 18px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);
+ }
+ .head h3 {
+ margin: 0;
+ font-size: 16px;
+ }
+ .close {
+ background: transparent;
+ border: none;
+ color: inherit;
+ font-size: 22px;
+ cursor: pointer;
+ line-height: 1;
+ }
+ .active {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px 18px;
+ background: rgba(255, 213, 100, 0.08);
+ border-bottom: 1px solid rgba(255, 213, 100, 0.18);
+ }
+ .active-label {
+ font-size: 12px;
+ color: rgba(255, 255, 255, 0.7);
+ }
+ .active-value {
+ font-family: ui-monospace, "Cascadia Code", monospace;
+ font-size: 15px;
+ color: #ffd564;
+ }
+ .body {
+ padding: 14px 18px;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+ .body h4 {
+ margin: 8px 0 4px;
+ font-size: 12px;
+ color: rgba(255, 255, 255, 0.5);
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ font-weight: 500;
+ }
+ .presets {
+ display: flex;
+ gap: 6px;
+ flex-wrap: wrap;
+ }
+ .preset {
+ appearance: none;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ color: inherit;
+ padding: 6px 12px;
+ border-radius: 8px;
+ cursor: pointer;
+ font-size: 13px;
+ }
+ .preset:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+ .custom-row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+ .num {
+ width: 80px;
+ appearance: textfield;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ color: inherit;
+ padding: 6px 10px;
+ border-radius: 8px;
+ font: inherit;
+ font-variant-numeric: tabular-nums;
+ }
+ .unit {
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.6);
+ }
+ .apply {
+ appearance: none;
+ background: var(--accent, #6f4eff);
+ border: none;
+ color: white;
+ padding: 6px 14px;
+ border-radius: 8px;
+ cursor: pointer;
+ font: inherit;
+ font-weight: 500;
+ }
+ .row {
+ display: flex;
+ gap: 8px;
+ }
+ .alt {
+ appearance: none;
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ color: inherit;
+ padding: 8px 14px;
+ border-radius: 8px;
+ cursor: pointer;
+ font: inherit;
+ }
+ .alt:hover {
+ background: rgba(255, 255, 255, 0.1);
+ }
+ .alt.danger {
+ color: #ff8b6f;
+ border-color: rgba(255, 139, 111, 0.3);
+ }
+ .alt.danger:hover {
+ background: rgba(255, 139, 111, 0.1);
+ }
+</style>
diff --git a/src/lib/study-music-components/SoundCloudError.svelte b/src/lib/study-music-components/SoundCloudError.svelte
index 498e98ac..002b95ad 100644
--- a/src/lib/study-music-components/SoundCloudError.svelte
+++ b/src/lib/study-music-components/SoundCloudError.svelte
@@ -122,7 +122,7 @@
.msg {
margin: 0;
- color: var(--primary);
+ color: var(--secondary);
font-size: 14px;
font-weight: 700;
line-height: 1.35;
@@ -168,7 +168,7 @@
}
.btn.ghost:hover {
- color: var(--primary);
+ color: var(--secondary);
background: color-mix(in oklab, var(--button) 80%, transparent);
}
diff --git a/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte b/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
index c3bdd58b..5905b918 100644
--- a/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
@@ -53,7 +53,7 @@
margin: 6px 0 0 0;
font-size: 13px;
font-weight: 600;
- color: var(--primary);
+ color: var(--secondary);
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
diff --git a/src/lib/study-music-youtube-components/YoutubeConnectHero.svelte b/src/lib/study-music-youtube-components/YoutubeConnectHero.svelte
index cab5bc53..8229ad3d 100644
--- a/src/lib/study-music-youtube-components/YoutubeConnectHero.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeConnectHero.svelte
@@ -91,7 +91,7 @@
margin: 0;
font-size: 22px;
font-weight: 700;
- color: var(--primary);
+ color: var(--secondary);
line-height: 1.25;
}
.hero-body {
diff --git a/src/lib/study-music-youtube-components/YoutubeError.svelte b/src/lib/study-music-youtube-components/YoutubeError.svelte
index 9bc2bdcd..8008970b 100644
--- a/src/lib/study-music-youtube-components/YoutubeError.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeError.svelte
@@ -81,7 +81,7 @@
}
.yt-error svg { color: var(--tertiary); margin-top: 2px; }
.body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
- .msg { margin: 0; font-size: 14px; color: var(--primary); }
+ .msg { margin: 0; font-size: 14px; color: var(--secondary); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
padding: 6px 12px;
diff --git a/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte b/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
index 922ab294..89f5cb94 100644
--- a/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
+++ b/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
@@ -83,7 +83,7 @@
margin: 0;
font-size: 13px;
font-weight: 600;
- color: var(--primary);
+ color: var(--secondary);
line-height: 1.3;
display: -webkit-box;
-webkit-line-clamp: 2;
diff --git a/src/routes/study/progress/+layout.svelte b/src/routes/study/progress/+layout.svelte
new file mode 100644
index 00000000..b0086619
--- /dev/null
+++ b/src/routes/study/progress/+layout.svelte
@@ -0,0 +1,16 @@
+<script lang="ts">
+ import MaintenanceCard from "$lib/study-components/MaintenanceCard.svelte";
+ import { STUDY_PROGRESS_ENABLED } from "$lib/study-feature-flags";
+ import { t } from "$lib/i18n";
+
+ let { children } = $props();
+</script>
+
+{#if !STUDY_PROGRESS_ENABLED}
+ <MaintenanceCard
+ feature={$t("study.maintenance.feature_progress") as string}
+ detail={$t("study.maintenance.detail_progress") as string}
+ />
+{:else}
+ {@render children?.()}
+{/if}