From 2942669f53ff41552c8d11394067796740168eab Mon Sep 17 00:00:00 2001 From: Eduard Prigoana Date: Tue, 30 Sep 2025 22:36:04 +0300 Subject: [PATCH] main --- .gitignore | 27 + app/about/page.tsx | 199 ++ app/album/[id]/page.tsx | 137 ++ app/artist/[id]/page.tsx | 186 ++ app/globals.css | 177 ++ app/layout.tsx | 35 + app/loading.tsx | 3 + app/page.tsx | 91 + app/search/loading.tsx | 3 + app/settings/page.tsx | 180 ++ components.json | 21 + components/app/album-card.tsx | 35 + components/app/empty-state.tsx | 16 + components/app/loading-spinner.tsx | 7 + components/app/mobile-nav.tsx | 39 + components/app/player-bar.tsx | 183 ++ components/app/providers.tsx | 29 + components/app/queue-panel.tsx | 81 + components/app/sidebar.tsx | 45 + components/app/track-list.tsx | 74 + components/theme-provider.tsx | 11 + components/ui/accordion.tsx | 66 + components/ui/alert-dialog.tsx | 157 ++ components/ui/alert.tsx | 66 + components/ui/aspect-ratio.tsx | 11 + components/ui/avatar.tsx | 53 + components/ui/badge.tsx | 46 + components/ui/breadcrumb.tsx | 109 + components/ui/button.tsx | 59 + components/ui/calendar.tsx | 213 ++ components/ui/card.tsx | 92 + components/ui/carousel.tsx | 241 ++ components/ui/chart.tsx | 353 +++ components/ui/checkbox.tsx | 32 + components/ui/collapsible.tsx | 33 + components/ui/command.tsx | 184 ++ components/ui/context-menu.tsx | 252 ++ components/ui/dialog.tsx | 143 ++ components/ui/drawer.tsx | 135 + components/ui/dropdown-menu.tsx | 257 ++ components/ui/form.tsx | 167 ++ components/ui/hover-card.tsx | 44 + components/ui/input-otp.tsx | 77 + components/ui/input.tsx | 21 + components/ui/label.tsx | 24 + components/ui/menubar.tsx | 276 +++ components/ui/navigation-menu.tsx | 166 ++ components/ui/pagination.tsx | 127 + components/ui/popover.tsx | 48 + components/ui/progress.tsx | 31 + components/ui/radio-group.tsx | 45 + components/ui/resizable.tsx | 56 + components/ui/scroll-area.tsx | 58 + components/ui/select.tsx | 185 ++ components/ui/separator.tsx | 28 + components/ui/sheet.tsx | 139 ++ components/ui/sidebar.tsx | 726 ++++++ components/ui/skeleton.tsx | 13 + components/ui/slider.tsx | 63 + components/ui/sonner.tsx | 25 + components/ui/switch.tsx | 31 + components/ui/table.tsx | 116 + components/ui/tabs.tsx | 66 + components/ui/textarea.tsx | 18 + components/ui/toast.tsx | 129 + components/ui/toaster.tsx | 35 + components/ui/toggle-group.tsx | 73 + components/ui/toggle.tsx | 47 + components/ui/tooltip.tsx | 61 + components/ui/use-mobile.tsx | 19 + components/ui/use-toast.ts | 191 ++ hooks/use-album.ts | 19 + hooks/use-artist.ts | 19 + hooks/use-audio-player.ts | 275 +++ hooks/use-mobile.ts | 19 + hooks/use-search.ts | 20 + hooks/use-toast.ts | 191 ++ lib/api.ts | 186 ++ lib/types.ts | 109 + lib/utils.ts | 21 + next.config.mjs | 14 + package-lock.json | 3648 ++++++++++++++++++++++++++++ package.json | 78 + pnpm-lock.yaml | 5 + postcss.config.mjs | 8 + public/placeholder-logo.png | Bin 0 -> 568 bytes public/placeholder-logo.svg | 1 + public/placeholder-user.jpg | Bin 0 -> 1635 bytes public/placeholder.jpg | Bin 0 -> 1064 bytes public/placeholder.svg | 1 + store/player-store.ts | 187 ++ store/settings-store.ts | 70 + styles/globals.css | 125 + tsconfig.json | 27 + 94 files changed, 12209 insertions(+) create mode 100644 .gitignore create mode 100644 app/about/page.tsx create mode 100644 app/album/[id]/page.tsx create mode 100644 app/artist/[id]/page.tsx create mode 100644 app/globals.css create mode 100644 app/layout.tsx create mode 100644 app/loading.tsx create mode 100644 app/page.tsx create mode 100644 app/search/loading.tsx create mode 100644 app/settings/page.tsx create mode 100644 components.json create mode 100644 components/app/album-card.tsx create mode 100644 components/app/empty-state.tsx create mode 100644 components/app/loading-spinner.tsx create mode 100644 components/app/mobile-nav.tsx create mode 100644 components/app/player-bar.tsx create mode 100644 components/app/providers.tsx create mode 100644 components/app/queue-panel.tsx create mode 100644 components/app/sidebar.tsx create mode 100644 components/app/track-list.tsx create mode 100644 components/theme-provider.tsx create mode 100644 components/ui/accordion.tsx create mode 100644 components/ui/alert-dialog.tsx create mode 100644 components/ui/alert.tsx create mode 100644 components/ui/aspect-ratio.tsx create mode 100644 components/ui/avatar.tsx create mode 100644 components/ui/badge.tsx create mode 100644 components/ui/breadcrumb.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/calendar.tsx create mode 100644 components/ui/card.tsx create mode 100644 components/ui/carousel.tsx create mode 100644 components/ui/chart.tsx create mode 100644 components/ui/checkbox.tsx create mode 100644 components/ui/collapsible.tsx create mode 100644 components/ui/command.tsx create mode 100644 components/ui/context-menu.tsx create mode 100644 components/ui/dialog.tsx create mode 100644 components/ui/drawer.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/form.tsx create mode 100644 components/ui/hover-card.tsx create mode 100644 components/ui/input-otp.tsx create mode 100644 components/ui/input.tsx create mode 100644 components/ui/label.tsx create mode 100644 components/ui/menubar.tsx create mode 100644 components/ui/navigation-menu.tsx create mode 100644 components/ui/pagination.tsx create mode 100644 components/ui/popover.tsx create mode 100644 components/ui/progress.tsx create mode 100644 components/ui/radio-group.tsx create mode 100644 components/ui/resizable.tsx create mode 100644 components/ui/scroll-area.tsx create mode 100644 components/ui/select.tsx create mode 100644 components/ui/separator.tsx create mode 100644 components/ui/sheet.tsx create mode 100644 components/ui/sidebar.tsx create mode 100644 components/ui/skeleton.tsx create mode 100644 components/ui/slider.tsx create mode 100644 components/ui/sonner.tsx create mode 100644 components/ui/switch.tsx create mode 100644 components/ui/table.tsx create mode 100644 components/ui/tabs.tsx create mode 100644 components/ui/textarea.tsx create mode 100644 components/ui/toast.tsx create mode 100644 components/ui/toaster.tsx create mode 100644 components/ui/toggle-group.tsx create mode 100644 components/ui/toggle.tsx create mode 100644 components/ui/tooltip.tsx create mode 100644 components/ui/use-mobile.tsx create mode 100644 components/ui/use-toast.ts create mode 100644 hooks/use-album.ts create mode 100644 hooks/use-artist.ts create mode 100644 hooks/use-audio-player.ts create mode 100644 hooks/use-mobile.ts create mode 100644 hooks/use-search.ts create mode 100644 hooks/use-toast.ts create mode 100644 lib/api.ts create mode 100644 lib/types.ts create mode 100644 lib/utils.ts create mode 100644 next.config.mjs create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 postcss.config.mjs create mode 100644 public/placeholder-logo.png create mode 100644 public/placeholder-logo.svg create mode 100644 public/placeholder-user.jpg create mode 100644 public/placeholder.jpg create mode 100644 public/placeholder.svg create mode 100644 store/player-store.ts create mode 100644 store/settings-store.ts create mode 100644 styles/globals.css create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f650315 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules + +# next.js +/.next/ +/out/ + +# production +/build + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# env files +.env* + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts \ No newline at end of file diff --git a/app/about/page.tsx b/app/about/page.tsx new file mode 100644 index 0000000..eb086f2 --- /dev/null +++ b/app/about/page.tsx @@ -0,0 +1,199 @@ +"use client" + +import { Github, Music, Heart, Code } from "lucide-react" +import { Sidebar } from "@/components/app/sidebar" +import { PlayerBar } from "@/components/app/player-bar" +import { MobileNav } from "@/components/app/mobile-nav" +import { Button } from "@/components/ui/button" + +export default function AboutPage() { + return ( +
+
+ + +
+
+
+
+
+ +
+
+

qstream

+

High-quality music streaming

+
+
+
+ +
+
+

About qstream

+
+

+ qstream is a modern music streaming application built with Next.js and React, designed to provide a + seamless and elegant music listening experience. With support for high-quality audio streaming, + qstream delivers crystal-clear sound for your favorite tracks. +

+

+ The application features a clean, intuitive interface that makes discovering and playing music + effortless. Search for your favorite artists and albums, explore their discographies, and enjoy + uninterrupted playback with our advanced audio player. +

+
+
+ +
+

+ + Features +

+
    +
  • + + ✓ + + + High-Quality Audio Streaming - Experience your music + in FLAC quality with seamless playback + +
  • +
  • + + ✓ + + + Advanced Search - Quickly find albums, artists, and + tracks with our powerful search engine + +
  • +
  • + + ✓ + + + Persistent Playback - Audio continues seamlessly as + you navigate between pages + +
  • +
  • + + ✓ + + + Queue Management - Build and manage your playback + queue with repeat and shuffle options + +
  • +
  • + + ✓ + + + Customizable Themes - Choose from multiple color + themes to personalize your experience + +
  • +
  • + + ✓ + + + Responsive Design - Optimized for desktop, tablet, + and mobile devices + +
  • +
+
+ +
+

Technology Stack

+
+
+

Frontend

+
    +
  • • Next.js 15 (App Router)
  • +
  • • React 19
  • +
  • • TypeScript
  • +
  • • Tailwind CSS v4
  • +
+
+
+

Features

+
    +
  • • Zustand (State Management)
  • +
  • • SWR (Data Fetching)
  • +
  • • shadcn/ui Components
  • +
  • • Web Audio API
  • +
+
+
+
+ +
+

+ + Open Source +

+
+

+ qstream is an open-source project built with modern web technologies. We believe in transparency and + community-driven development. Check out the source code, contribute, or report issues on GitHub. +

+ +
+
+ +
+
+
+ +
+
+

Built with passion

+

+ qstream was created to demonstrate modern web development practices and provide a beautiful, + functional music streaming experience. We hope you enjoy using it as much as we enjoyed building + it. +

+
+
+
+ +
+

© 2025 qstream. No rights reserved.

+

+ Music provided by qobuz-dl. This is a demonstration project for educational purposes. +

+
+
+
+
+
+ + + +
+ ) +} diff --git a/app/album/[id]/page.tsx b/app/album/[id]/page.tsx new file mode 100644 index 0000000..f7687cb --- /dev/null +++ b/app/album/[id]/page.tsx @@ -0,0 +1,137 @@ +"use client" + +import { useEffect } from "react" +import { useParams, useRouter } from "next/navigation" +import { ArrowLeft, Play } from "lucide-react" +import { useSettingsStore } from "@/store/settings-store" +import { usePlayerStore } from "@/store/player-store" +import { Sidebar } from "@/components/app/sidebar" +import { PlayerBar } from "@/components/app/player-bar" +import { MobileNav } from "@/components/app/mobile-nav" +import { TrackList } from "@/components/app/track-list" +import { LoadingSpinner } from "@/components/app/loading-spinner" +import { EmptyState } from "@/components/app/empty-state" +import { Button } from "@/components/ui/button" +import { useAlbum } from "@/hooks/use-album" +import { albumToPlayerTracks } from "@/lib/api" +import { formatDate } from "@/lib/utils" + +export default function AlbumPage() { + const params = useParams() + const router = useRouter() + const theme = useSettingsStore((state) => state.theme) + const { loadAndPlayQueue } = usePlayerStore((state) => state.actions) + + const albumId = params.id as string + const { album, isLoading, error } = useAlbum(albumId) + + useEffect(() => { + if (theme !== "custom") { + document.documentElement.setAttribute("data-theme", theme) + } else { + document.documentElement.removeAttribute("data-theme") + } + document.documentElement.classList.add("dark") + }, [theme]) + + const handlePlayAlbum = () => { + if (album) { + const tracks = albumToPlayerTracks(album) + loadAndPlayQueue(tracks, 0) + } + } + + const handleArtistClick = () => { + if (album) { + router.push(`/artist/${album.artist.id}`) + } + } + + if (isLoading) { + return ( +
+
+ +
+ +
+
+ + +
+ ) + } + + if (error || !album) { + return ( +
+
+ +
+ +
+
+ + +
+ ) + } + + const tracks = albumToPlayerTracks(album) + + return ( +
+
+ + +
+
+ + +
+
+ {album.title} +
+ +
+
+

Album

+

{album.title}

+
+ +
+ + + {formatDate(album.release_date_original)} + + {album.tracks.items.length} tracks +
+ + +
+
+ +
+ +
+
+
+
+ + + +
+ ) +} diff --git a/app/artist/[id]/page.tsx b/app/artist/[id]/page.tsx new file mode 100644 index 0000000..71c1b9b --- /dev/null +++ b/app/artist/[id]/page.tsx @@ -0,0 +1,186 @@ +"use client" + +import { useEffect, useState } from "react" +import { useParams, useRouter } from "next/navigation" +import { ArrowLeft, Play, ChevronDown, ChevronUp } from "lucide-react" +import { useSettingsStore } from "@/store/settings-store" +import { usePlayerStore } from "@/store/player-store" +import { Sidebar } from "@/components/app/sidebar" +import { PlayerBar } from "@/components/app/player-bar" +import { MobileNav } from "@/components/app/mobile-nav" +import { TrackList } from "@/components/app/track-list" +import { AlbumCard } from "@/components/app/album-card" +import { LoadingSpinner } from "@/components/app/loading-spinner" +import { EmptyState } from "@/components/app/empty-state" +import { Button } from "@/components/ui/button" +import { useArtist } from "@/hooks/use-artist" +import { topTracksToPlayerTracks } from "@/lib/api" + +export default function ArtistPage() { + const params = useParams() + const router = useRouter() + const theme = useSettingsStore((state) => state.theme) + const { loadAndPlayQueue } = usePlayerStore((state) => state.actions) + const [isBioExpanded, setIsBioExpanded] = useState(false) + + const artistId = Number.parseInt(params.id as string) + const { artist, isLoading, error } = useArtist(artistId) + + useEffect(() => { + if (theme !== "custom") { + document.documentElement.setAttribute("data-theme", theme) + } else { + document.documentElement.removeAttribute("data-theme") + } + document.documentElement.classList.add("dark") + }, [theme]) + + const handlePlayTopTracks = () => { + if (artist && artist.top_tracks.length > 0) { + const tracks = topTracksToPlayerTracks(artist.top_tracks, artist.name.display) + loadAndPlayQueue(tracks, 0) + } + } + + const handleAlbumClick = (albumId: string) => { + router.push(`/album/${albumId}`) + } + + if (isLoading) { + return ( +
+
+ +
+ +
+
+ + +
+ ) + } + + if (error || !artist) { + return ( +
+
+ +
+ +
+
+ + +
+ ) + } + + const topTracks = topTracksToPlayerTracks(artist.top_tracks, artist.name.display) + + const bioText = artist.biography?.content || "" + const bioLines = bioText.split("\n").filter((line) => line.trim()) + const shouldTruncate = bioLines.length > 3 + const displayBio = shouldTruncate && !isBioExpanded ? bioLines.slice(0, 3).join("\n") : bioText + + return ( +
+
+ + +
+
+ + +
+

Artist

+

{artist.name.display}

+ + {bioText && ( +
+
+

+ {displayBio} +

+ {shouldTruncate && !isBioExpanded && ( +
+ )} +
+ {shouldTruncate && ( + + )} +
+ )} +
+ + {topTracks.length > 0 && ( +
+
+

Top Tracks

+ +
+
+ +
+
+ )} + + {artist.releases.map((release) => { + if (release.items.length === 0) return null + + return ( +
+

+ {release.type}s {release.has_more && (Top)} +

+
+ {release.items.map((item) => ( + handleAlbumClick(item.id)} + /> + ))} +
+
+ ) + })} +
+
+
+ + + +
+ ) +} diff --git a/app/globals.css b/app/globals.css new file mode 100644 index 0000000..222593e --- /dev/null +++ b/app/globals.css @@ -0,0 +1,177 @@ +@import "tailwindcss"; +@import "tw-animate-css"; + +@custom-variant dark (&:is(.dark *)); + +:root { + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); + --card: oklch(1 0 0); + --card-foreground: oklch(0.145 0 0); + --popover: oklch(1 0 0); + --popover-foreground: oklch(0.145 0 0); + --primary: oklch(0.205 0 0); + --primary-foreground: oklch(0.985 0 0); + --secondary: oklch(0.97 0 0); + --secondary-foreground: oklch(0.205 0 0); + --muted: oklch(0.97 0 0); + --muted-foreground: oklch(0.556 0 0); + --accent: oklch(0.97 0 0); + --accent-foreground: oklch(0.205 0 0); + --destructive: oklch(0.577 0.245 27.325); + --destructive-foreground: oklch(0.577 0.245 27.325); + --border: oklch(0.922 0 0); + --input: oklch(0.922 0 0); + --ring: oklch(0.708 0 0); + --chart-1: oklch(0.646 0.222 41.116); + --chart-2: oklch(0.6 0.118 184.704); + --chart-3: oklch(0.398 0.07 227.392); + --chart-4: oklch(0.828 0.189 84.429); + --chart-5: oklch(0.769 0.188 70.08); + --radius: 0.625rem; + --sidebar: oklch(0.985 0 0); + --sidebar-foreground: oklch(0.145 0 0); + --sidebar-primary: oklch(0.205 0 0); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.97 0 0); + --sidebar-accent-foreground: oklch(0.205 0 0); + --sidebar-border: oklch(0.922 0 0); + --sidebar-ring: oklch(0.708 0 0); +} + +.dark { + --background: oklch(0.145 0 0); + --foreground: oklch(0.985 0 0); + --card: oklch(0.145 0 0); + --card-foreground: oklch(0.985 0 0); + --popover: oklch(0.145 0 0); + --popover-foreground: oklch(0.985 0 0); + --primary: oklch(0.985 0 0); + --primary-foreground: oklch(0.205 0 0); + --secondary: oklch(0.269 0 0); + --secondary-foreground: oklch(0.985 0 0); + --muted: oklch(0.269 0 0); + --muted-foreground: oklch(0.708 0 0); + --accent: oklch(0.269 0 0); + --accent-foreground: oklch(0.985 0 0); + --destructive: oklch(0.396 0.141 25.723); + --destructive-foreground: oklch(0.637 0.237 25.331); + --border: oklch(0.269 0 0); + --input: oklch(0.269 0 0); + --ring: oklch(0.439 0 0); + --chart-1: oklch(0.488 0.243 264.376); + --chart-2: oklch(0.696 0.17 162.48); + --chart-3: oklch(0.769 0.188 70.08); + --chart-4: oklch(0.627 0.265 303.9); + --chart-5: oklch(0.645 0.246 16.439); + --sidebar: oklch(0.205 0 0); + --sidebar-foreground: oklch(0.985 0 0); + --sidebar-primary: oklch(0.488 0.243 264.376); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.269 0 0); + --sidebar-accent-foreground: oklch(0.985 0 0); + --sidebar-border: oklch(0.269 0 0); + --sidebar-ring: oklch(0.439 0 0); +} + +[data-theme="zinc"] { + --background: 240 10% 3.9%; + --foreground: 0 0% 98%; + --card: 240 10% 5%; + --card-foreground: 0 0% 98%; + --primary: 0 0% 98%; + --primary-foreground: 240 10% 3.9%; + --secondary: 240 3.7% 15.9%; + --secondary-foreground: 0 0% 98%; + --muted: 240 3.7% 15.9%; + --muted-foreground: 240 5% 64.9%; + --accent: 240 3.7% 15.9%; + --accent-foreground: 0 0% 98%; + --border: 240 3.7% 15.9%; + --input: 240 3.7% 15.9%; + --ring: 240 5% 64.9%; +} + +[data-theme="slate"] { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + --card: 222.2 84% 6%; + --card-foreground: 210 40% 98%; + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + --ring: 215 20.2% 65.1%; +} + +[data-theme="rose"] { + --background: 0 0% 3.9%; + --foreground: 0 0% 98%; + --card: 0 0% 5%; + --card-foreground: 0 0% 98%; + --primary: 346.8 77.2% 49.8%; + --primary-foreground: 355.7 100% 97.3%; + --secondary: 240 3.7% 15.9%; + --secondary-foreground: 0 0% 98%; + --muted: 0 0% 15%; + --muted-foreground: 240 5% 64.9%; + --accent: 346.8 77.2% 49.8%; + --accent-foreground: 355.7 100% 97.3%; + --border: 240 3.7% 15.9%; + --input: 240 3.7% 15.9%; + --ring: 346.8 77.2% 49.8%; +} + +@theme inline { + --color-background: var(--background); + --color-foreground: var(--foreground); + --color-card: var(--card); + --color-card-foreground: var(--card-foreground); + --color-popover: var(--popover); + --color-popover-foreground: var(--popover-foreground); + --color-primary: var(--primary); + --color-primary-foreground: var(--primary-foreground); + --color-secondary: var(--secondary); + --color-secondary-foreground: var(--secondary-foreground); + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + --color-accent: var(--accent); + --color-accent-foreground: var(--accent-foreground); + --color-destructive: var(--destructive); + --color-destructive-foreground: var(--destructive-foreground); + --color-border: var(--border); + --color-input: var(--input); + --color-ring: var(--ring); + --color-chart-1: var(--chart-1); + --color-chart-2: var(--chart-2); + --color-chart-3: var(--chart-3); + --color-chart-4: var(--chart-4); + --color-chart-5: var(--chart-5); + --radius-sm: calc(var(--radius) - 4px); + --radius-md: calc(var(--radius) - 2px); + --radius-lg: var(--radius); + --radius-xl: calc(var(--radius) + 4px); + --color-sidebar: var(--sidebar); + --color-sidebar-foreground: var(--sidebar-foreground); + --color-sidebar-primary: var(--sidebar-primary); + --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); + --color-sidebar-accent: var(--sidebar-accent); + --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); + --color-sidebar-border: var(--sidebar-border); + --color-sidebar-ring: var(--sidebar-ring); +} + +@layer base { + * { + @apply border-border outline-ring/50; + } + body { + @apply bg-background text-foreground; + } +} diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..6e0a29d --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,35 @@ +import type React from "react" +import type { Metadata } from "next" +import { Inter, Playfair_Display } from "next/font/google" +import { Providers } from "@/components/app/providers" +import "./globals.css" + +const inter = Inter({ + subsets: ["latin"], + variable: "--font-inter", +}) + +const playfair = Playfair_Display({ + subsets: ["latin"], + variable: "--font-playfair", +}) + +export const metadata: Metadata = { + title: "qstream - Music Player", + description: "A modern, cross-platform music streaming player", + generator: 'v0.app' +} + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + {children} + + + ) +} diff --git a/app/loading.tsx b/app/loading.tsx new file mode 100644 index 0000000..f15322a --- /dev/null +++ b/app/loading.tsx @@ -0,0 +1,3 @@ +export default function Loading() { + return null +} diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 0000000..022b278 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,91 @@ +"use client" + +import { useState, useEffect } from "react" +import { useRouter } from "next/navigation" +import { SearchIcon } from "lucide-react" +import { Sidebar } from "@/components/app/sidebar" +import { PlayerBar } from "@/components/app/player-bar" +import { MobileNav } from "@/components/app/mobile-nav" +import { AlbumCard } from "@/components/app/album-card" +import { LoadingSpinner } from "@/components/app/loading-spinner" +import { EmptyState } from "@/components/app/empty-state" +import { Input } from "@/components/ui/input" +import { useSearch } from "@/hooks/use-search" + +export default function Home() { + const router = useRouter() + const [query, setQuery] = useState("") + const [debouncedQuery, setDebouncedQuery] = useState("") + + const { albums, isLoading, error } = useSearch(debouncedQuery) + + useEffect(() => { + const timer = setTimeout(() => { + setDebouncedQuery(query) + }, 500) + + return () => clearTimeout(timer) + }, [query]) + + const handleAlbumClick = (albumId: string) => { + router.push(`/album/${albumId}`) + } + + return ( +
+
+ + +
+
+
+

Search

+
+ + setQuery(e.target.value)} + className="pl-10" + autoFocus + /> +
+
+ + {isLoading && } + + {error && ( + + )} + + {!isLoading && !error && albums && albums.length === 0 && debouncedQuery && ( + + )} + + {!isLoading && !error && albums && albums.length > 0 && ( +
+

Albums

+
+ {albums.map((album) => ( + handleAlbumClick(album.id)} /> + ))} +
+
+ )} + + {!debouncedQuery && !isLoading && ( + + )} +
+
+
+ + + +
+ ) +} diff --git a/app/search/loading.tsx b/app/search/loading.tsx new file mode 100644 index 0000000..f15322a --- /dev/null +++ b/app/search/loading.tsx @@ -0,0 +1,3 @@ +export default function Loading() { + return null +} diff --git a/app/settings/page.tsx b/app/settings/page.tsx new file mode 100644 index 0000000..384709b --- /dev/null +++ b/app/settings/page.tsx @@ -0,0 +1,180 @@ +"use client" + +import { useState } from "react" +import { useRouter } from "next/navigation" +import { ArrowLeft, Check } from "lucide-react" +import { useSettingsStore } from "@/store/settings-store" +import { Sidebar } from "@/components/app/sidebar" +import { PlayerBar } from "@/components/app/player-bar" +import { MobileNav } from "@/components/app/mobile-nav" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import type { Theme } from "@/lib/types" + +export default function SettingsPage() { + const router = useRouter() + const theme = useSettingsStore((state) => state.theme) + const apiBaseUrl = useSettingsStore((state) => state.apiBaseUrl) + const setTheme = useSettingsStore((state) => state.actions.setTheme) + const setStoredApiBaseUrl = useSettingsStore((state) => state.actions.setApiBaseUrl) + + const [localApiUrl, setLocalApiUrl] = useState(apiBaseUrl) + const [isSaved, setIsSaved] = useState(false) + + const handleThemeChange = (newTheme: Theme) => { + setTheme(newTheme) + } + + const handleSaveApiUrl = () => { + setStoredApiBaseUrl(localApiUrl) + setIsSaved(true) + setTimeout(() => setIsSaved(false), 2000) + } + + const themes: Array<{ value: Theme; label: string; description: string }> = [ + { value: "default", label: "Default", description: "Classic dark theme" }, + { value: "zinc", label: "Zinc", description: "Neutral gray tones" }, + { value: "slate", label: "Slate", description: "Cool blue-gray" }, + { value: "rose", label: "Rose", description: "Warm rose accents" }, + ] + + return ( +
+
+ + +
+
+ + +

Settings

+ +
+
+
+

API Configuration

+

Configure the music API endpoint

+
+ +
+ +
+ setLocalApiUrl(e.target.value)} + placeholder="https://qqdl.site/api" + className="flex-1" + /> + +
+

+ Default: https://qqdl.site/api | EU: https://eu.qqdl.site/api +

+
+
+ +
+
+

Appearance

+

Customize the look and feel of qstream

+
+ +
+ +
+ {themes.map((themeOption) => ( + + ))} +
+
+
+ +
+
+

About

+

Information about qstream

+
+ +
+
+
+ Version + 1.0.0 +
+
+ Platform + Web +
+
+
+
+
+
+
+
+ + + +
+ ) +} diff --git a/components.json b/components.json new file mode 100644 index 0000000..4ee62ee --- /dev/null +++ b/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "", + "css": "app/globals.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} diff --git a/components/app/album-card.tsx b/components/app/album-card.tsx new file mode 100644 index 0000000..dbaf1ef --- /dev/null +++ b/components/app/album-card.tsx @@ -0,0 +1,35 @@ +"use client" + +import Image from "next/image" +import type { Album } from "@/lib/types" +import { formatDate } from "@/lib/utils" + +interface AlbumCardProps { + album: Album + onClick: () => void +} + +export const AlbumCard = ({ album, onClick }: AlbumCardProps) => { + return ( + + ) +} diff --git a/components/app/empty-state.tsx b/components/app/empty-state.tsx new file mode 100644 index 0000000..d162248 --- /dev/null +++ b/components/app/empty-state.tsx @@ -0,0 +1,16 @@ +import { Music } from "lucide-react" + +interface EmptyStateProps { + title: string + description: string +} + +export const EmptyState = ({ title, description }: EmptyStateProps) => { + return ( +
+ +

{title}

+

{description}

+
+ ) +} diff --git a/components/app/loading-spinner.tsx b/components/app/loading-spinner.tsx new file mode 100644 index 0000000..577e488 --- /dev/null +++ b/components/app/loading-spinner.tsx @@ -0,0 +1,7 @@ +export const LoadingSpinner = () => { + return ( +
+
+
+ ) +} diff --git a/components/app/mobile-nav.tsx b/components/app/mobile-nav.tsx new file mode 100644 index 0000000..e36b404 --- /dev/null +++ b/components/app/mobile-nav.tsx @@ -0,0 +1,39 @@ +"use client" + +import { Search, Settings, Info } from "lucide-react" +import { useRouter, usePathname } from "next/navigation" + +export const MobileNav = () => { + const router = useRouter() + const pathname = usePathname() + + const navItems = [ + { icon: Search, label: "Search", path: "/" }, + { icon: Info, label: "About", path: "/about" }, + { icon: Settings, label: "Settings", path: "/settings" }, + ] + + return ( + + ) +} diff --git a/components/app/player-bar.tsx b/components/app/player-bar.tsx new file mode 100644 index 0000000..0ec31ba --- /dev/null +++ b/components/app/player-bar.tsx @@ -0,0 +1,183 @@ +"use client" + +import { useState } from "react" +import { + Play, + Pause, + SkipBack, + SkipForward, + Shuffle, + Repeat, + Repeat1, + Volume2, + VolumeX, + ListMusic, + Download, +} from "lucide-react" +import { usePlayerStore } from "@/store/player-store" +import { formatDuration } from "@/lib/utils" +import { Slider } from "@/components/ui/slider" +import { useAudioPlayer } from "@/hooks/use-audio-player" +import { QueuePanel } from "./queue-panel" + +export const PlayerBar = () => { + useAudioPlayer() + const [isQueueOpen, setIsQueueOpen] = useState(false) + + const isPlaying = usePlayerStore((state) => state.isPlaying) + const currentTrack = usePlayerStore((state) => state.currentTrack) + const playbackPosition = usePlayerStore((state) => state.playbackPosition) + const volume = usePlayerStore((state) => state.volume) + const repeatMode = usePlayerStore((state) => state.repeatMode) + const isShuffled = usePlayerStore((state) => state.isShuffled) + const streamUrl = usePlayerStore((state) => state.streamUrl) + + const { playPause, nextTrack, prevTrack, seekTo, setVolume, toggleShuffle, cycleRepeatMode } = usePlayerStore( + (state) => state.actions, + ) + + const handleSeek = (value: number[]) => { + seekTo(value[0]) + } + + const handleVolumeChange = (value: number[]) => { + setVolume(value[0]) + } + + const handleDownload = () => { + if (streamUrl && currentTrack) { + const link = document.createElement("a") + link.href = streamUrl + link.download = `${currentTrack.artistName} - ${currentTrack.title}.flac` + link.click() + } + } + + const RepeatIcon = repeatMode === "one" ? Repeat1 : Repeat + + return ( + <> +
+
+
+ {currentTrack ? ( + <> +
+ {currentTrack.title} +
+
+
{currentTrack.title}
+
{currentTrack.artistName}
+
+ + ) : ( + <> +
+
+
No track playing
+
qstream
+
+ + )} +
+ +
+
+ + + + + + + + + +
+ +
+ {formatDuration(playbackPosition)} + + + {currentTrack ? formatDuration(currentTrack.duration) : "0:00"} + +
+
+ +
+ + + + +
+ {volume === 0 ? ( + + ) : ( + + )} + +
+
+
+
+ + setIsQueueOpen(false)} /> + + ) +} diff --git a/components/app/providers.tsx b/components/app/providers.tsx new file mode 100644 index 0000000..2afb3e1 --- /dev/null +++ b/components/app/providers.tsx @@ -0,0 +1,29 @@ +"use client" + +import type React from "react" + +import { useEffect } from "react" +import { useSettingsStore } from "@/store/settings-store" +import { setApiBaseUrl } from "@/lib/api" + +export function Providers({ children }: { children: React.ReactNode }) { + const theme = useSettingsStore((state) => state.theme) + const apiBaseUrl = useSettingsStore((state) => state.apiBaseUrl) + + useEffect(() => { + setApiBaseUrl(apiBaseUrl) + console.log("[v0] Initialized API base URL:", apiBaseUrl) + }, [apiBaseUrl]) + + useEffect(() => { + document.documentElement.classList.add("dark") + + if (theme !== "custom") { + document.documentElement.setAttribute("data-theme", theme) + } else { + document.documentElement.removeAttribute("data-theme") + } + }, [theme]) + + return <>{children} +} diff --git a/components/app/queue-panel.tsx b/components/app/queue-panel.tsx new file mode 100644 index 0000000..ffc2354 --- /dev/null +++ b/components/app/queue-panel.tsx @@ -0,0 +1,81 @@ +"use client" + +import { X } from "lucide-react" +import { usePlayerStore } from "@/store/player-store" +import { formatDuration } from "@/lib/utils" + +interface QueuePanelProps { + isOpen: boolean + onClose: () => void +} + +export const QueuePanel = ({ isOpen, onClose }: QueuePanelProps) => { + const queue = usePlayerStore((state) => state.queue) + const currentTrack = usePlayerStore((state) => state.currentTrack) + const currentIndex = usePlayerStore((state) => state.currentIndex) + const { loadAndPlayQueue } = usePlayerStore((state) => state.actions) + + if (!isOpen) return null + + const handleTrackClick = (index: number) => { + loadAndPlayQueue(queue, index) + } + + return ( +
+
+
+

Queue

+ +
+ +
+ {queue.length === 0 ? ( +
+
+

No tracks in queue

+
+
+ ) : ( +
+ {queue.map((track, index) => { + const isCurrentTrack = index === currentIndex + + return ( + + ) + })} +
+ )} +
+
+
+ ) +} diff --git a/components/app/sidebar.tsx b/components/app/sidebar.tsx new file mode 100644 index 0000000..113db11 --- /dev/null +++ b/components/app/sidebar.tsx @@ -0,0 +1,45 @@ +"use client" + +import { Search, Settings, Info } from "lucide-react" +import { useRouter, usePathname } from "next/navigation" + +export const Sidebar = () => { + const router = useRouter() + const pathname = usePathname() + + const navItems = [ + { icon: Search, label: "Search", path: "/" }, + { icon: Info, label: "About", path: "/about" }, + { icon: Settings, label: "Settings", path: "/settings" }, + ] + + return ( + + ) +} diff --git a/components/app/track-list.tsx b/components/app/track-list.tsx new file mode 100644 index 0000000..76efbce --- /dev/null +++ b/components/app/track-list.tsx @@ -0,0 +1,74 @@ +"use client" + +import { Play } from "lucide-react" +import type { PlayerTrack } from "@/lib/types" +import { formatDuration } from "@/lib/utils" +import { usePlayerStore } from "@/store/player-store" + +interface TrackListProps { + tracks: PlayerTrack[] + showArtwork?: boolean +} + +export const TrackList = ({ tracks, showArtwork = false }: TrackListProps) => { + const currentTrack = usePlayerStore((state) => state.currentTrack) + const isPlaying = usePlayerStore((state) => state.isPlaying) + const { loadAndPlayQueue } = usePlayerStore((state) => state.actions) + + const handleTrackClick = (index: number) => { + loadAndPlayQueue(tracks, index) + } + + return ( +
+ {tracks.map((track, index) => { + const isCurrentTrack = currentTrack?.id === track.id + const isActive = isCurrentTrack && isPlaying + + return ( + + ) + })} +
+ ) +} diff --git a/components/theme-provider.tsx b/components/theme-provider.tsx new file mode 100644 index 0000000..55c2f6e --- /dev/null +++ b/components/theme-provider.tsx @@ -0,0 +1,11 @@ +'use client' + +import * as React from 'react' +import { + ThemeProvider as NextThemesProvider, + type ThemeProviderProps, +} from 'next-themes' + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return {children} +} diff --git a/components/ui/accordion.tsx b/components/ui/accordion.tsx new file mode 100644 index 0000000..e538a33 --- /dev/null +++ b/components/ui/accordion.tsx @@ -0,0 +1,66 @@ +'use client' + +import * as React from 'react' +import * as AccordionPrimitive from '@radix-ui/react-accordion' +import { ChevronDownIcon } from 'lucide-react' + +import { cn } from '@/lib/utils' + +function Accordion({ + ...props +}: React.ComponentProps) { + return +} + +function AccordionItem({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AccordionTrigger({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + svg]:rotate-180', + className, + )} + {...props} + > + {children} + + + + ) +} + +function AccordionContent({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + +
{children}
+
+ ) +} + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/components/ui/alert-dialog.tsx b/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..9704452 --- /dev/null +++ b/components/ui/alert-dialog.tsx @@ -0,0 +1,157 @@ +'use client' + +import * as React from 'react' +import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog' + +import { cn } from '@/lib/utils' +import { buttonVariants } from '@/components/ui/button' + +function AlertDialog({ + ...props +}: React.ComponentProps) { + return +} + +function AlertDialogTrigger({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogPortal({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogContent({ + className, + ...props +}: React.ComponentProps) { + return ( + + + + + ) +} + +function AlertDialogHeader({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +function AlertDialogFooter({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogAction({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogCancel({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/components/ui/alert.tsx b/components/ui/alert.tsx new file mode 100644 index 0000000..e6751ab --- /dev/null +++ b/components/ui/alert.tsx @@ -0,0 +1,66 @@ +import * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const alertVariants = cva( + 'relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current', + { + variants: { + variant: { + default: 'bg-card text-card-foreground', + destructive: + 'text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +function Alert({ + className, + variant, + ...props +}: React.ComponentProps<'div'> & VariantProps) { + return ( +
+ ) +} + +function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +function AlertDescription({ + className, + ...props +}: React.ComponentProps<'div'>) { + return ( +
+ ) +} + +export { Alert, AlertTitle, AlertDescription } diff --git a/components/ui/aspect-ratio.tsx b/components/ui/aspect-ratio.tsx new file mode 100644 index 0000000..40bb120 --- /dev/null +++ b/components/ui/aspect-ratio.tsx @@ -0,0 +1,11 @@ +'use client' + +import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio' + +function AspectRatio({ + ...props +}: React.ComponentProps) { + return +} + +export { AspectRatio } diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx new file mode 100644 index 0000000..aa98465 --- /dev/null +++ b/components/ui/avatar.tsx @@ -0,0 +1,53 @@ +'use client' + +import * as React from 'react' +import * as AvatarPrimitive from '@radix-ui/react-avatar' + +import { cn } from '@/lib/utils' + +function Avatar({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AvatarImage({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AvatarFallback({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx new file mode 100644 index 0000000..fc4126b --- /dev/null +++ b/components/ui/badge.tsx @@ -0,0 +1,46 @@ +import * as React from 'react' +import { Slot } from '@radix-ui/react-slot' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const badgeVariants = cva( + 'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden', + { + variants: { + variant: { + default: + 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90', + secondary: + 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90', + destructive: + 'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60', + outline: + 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground', + }, + }, + defaultVariants: { + variant: 'default', + }, + }, +) + +function Badge({ + className, + variant, + asChild = false, + ...props +}: React.ComponentProps<'span'> & + VariantProps & { asChild?: boolean }) { + const Comp = asChild ? Slot : 'span' + + return ( + + ) +} + +export { Badge, badgeVariants } diff --git a/components/ui/breadcrumb.tsx b/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..1750ff2 --- /dev/null +++ b/components/ui/breadcrumb.tsx @@ -0,0 +1,109 @@ +import * as React from 'react' +import { Slot } from '@radix-ui/react-slot' +import { ChevronRight, MoreHorizontal } from 'lucide-react' + +import { cn } from '@/lib/utils' + +function Breadcrumb({ ...props }: React.ComponentProps<'nav'>) { + return