fix(web): allow opening the sidebar on mobile (#60)

This commit was merged in pull request #60.
This commit is contained in:
joshuafhiggins committed 2026-11-01 19:43:22 -05:00
1 parent 1163bf49cd
commit 1ff7b49a9d
9 files changed
+68 -16

No files matched your search

+5 -1
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import { Plus } from "lucide-react"
import { useAddToPlaylist } from "@/components/add-to-playlist-provider"
@@ -17,7 +18,10 @@ export default function Page() {
return (
<div className="flex h-svh flex-col">
<header className="flex items-center justify-between gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Playlists</h1>
<div className="flex min-w-0 items-center gap-2">
<MobileSidebarTrigger />
<h1 className="text-lg font-semibold">Playlists</h1>
</div>
<Button
variant="secondary"
size="sm"
+3 -1
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import { Suspense, useCallback, useEffect, useRef, useState } from "react"
import { SearchIcon } from "lucide-react"
import { usePathname, useSearchParams } from "next/navigation"
@@ -212,7 +213,8 @@ function SearchPageContent() {
return (
<div className="flex h-svh flex-col">
<header className="flex items-center justify-center border-b px-4 py-3">
<header className="flex items-center justify-center gap-2 border-b px-4 py-3">
<MobileSidebarTrigger />
<div className="relative w-full max-w-xl">
<SearchIcon className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
<input
+7 -3
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import * as React from "react"
import Image from "next/image"
import Link from "next/link"
@@ -391,9 +392,12 @@ export function AlbumView({
<p className="text-xs font-medium tracking-wide text-muted-foreground uppercase">
Album
</p>
<h1 className="text-3xl font-bold tracking-tight sm:text-4xl">
{album.title}
</h1>
<div className="flex min-w-0 items-center justify-center gap-2 sm:justify-start md:contents">
<MobileSidebarTrigger />
<h1 className="text-3xl font-bold tracking-tight sm:text-4xl">
{album.title}
</h1>
</div>
<Link
href={"/artist/" + album.artist.id}
className="inline-block text-lg font-semibold text-primary hover:underline"
+5 -3
View File
@@ -35,6 +35,7 @@ import {
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar"
import { ThemeToggle } from "@/components/theme-toggle"
import Image from "next/image"
@@ -63,6 +64,7 @@ const library = [
]
export function AppSidebar() {
const { setOpenMobile } = useSidebar()
const pathname = usePathname()
const router = useRouter()
const { signOut } = useAuthActions()
@@ -120,7 +122,7 @@ export function AppSidebar() {
{browse.map((item) => (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton isActive={pathname === item.path} asChild>
<Link href={item.path}>
<Link href={item.path} onClick={() => setOpenMobile(false)}>
<item.icon />
<span>{item.title}</span>
</Link>
@@ -144,7 +146,7 @@ export function AppSidebar() {
}
asChild
>
<Link href={item.path}>
<Link href={item.path} onClick={() => setOpenMobile(false)}>
<item.icon />
<span>{item.title}</span>
</Link>
@@ -162,7 +164,7 @@ export function AppSidebar() {
{playlistNav.map((item) => (
<SidebarMenuItem key={item.path}>
<SidebarMenuButton isActive={pathname === item.path} asChild>
<Link href={item.path}>
<Link href={item.path} onClick={() => setOpenMobile(false)}>
<item.icon />
<span>{item.title}</span>
</Link>
+7 -3
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import * as React from "react"
import Image from "next/image"
import { Play, Shuffle } from "lucide-react"
@@ -79,9 +80,12 @@ export function ArtistView({
</div>
<div className="flex min-w-0 flex-1 flex-col gap-4">
<h1 className="min-w-0 truncate text-3xl font-bold tracking-tight sm:text-4xl lg:text-5xl">
{artist.name}
</h1>
<div className="flex min-w-0 items-center gap-2 md:contents">
<MobileSidebarTrigger />
<h1 className="min-w-0 truncate text-3xl font-bold tracking-tight sm:text-4xl lg:text-5xl">
{artist.name}
</h1>
</div>
<div className="flex flex-wrap items-center gap-2">
<Button
@@ -1,3 +1,4 @@
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import { Skeleton } from "@/components/ui/skeleton"
import { albumGridClassName } from "@/lib/album-grid-classes"
import { TRACK_LIST_CONTAINER } from "@/lib/selection-range-styles"
@@ -21,6 +22,7 @@ function LoadingRegion({
export function PageHeader({ title }: { title: string }) {
return (
<header className="flex items-center gap-2 border-b px-4 py-3">
<MobileSidebarTrigger />
<h1 className="text-lg font-semibold">{title}</h1>
</header>
)
@@ -0,0 +1,23 @@
"use client"
import { Menu } from "lucide-react"
import { Button } from "@/components/ui/button"
import { useSidebar } from "@/components/ui/sidebar"
export function MobileSidebarTrigger() {
const { openMobile, setOpenMobile } = useSidebar()
return (
<Button
variant="ghost"
size="icon"
className="size-11 shrink-0 md:hidden"
aria-label="Open sidebar"
aria-expanded={openMobile}
onClick={() => setOpenMobile(true)}
>
<Menu />
</Button>
)
}
+7 -3
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import { stationArtistId } from "@/lib/station-artist"
import * as React from "react"
import Image from "next/image"
@@ -544,9 +545,12 @@ export function PlaylistView({ playlist }: { playlist: BrowsePlaylistDetail }) {
<p className="text-xs font-medium tracking-wide text-muted-foreground uppercase">
Playlist
</p>
<h1 className="text-3xl font-bold tracking-tight sm:text-4xl">
{playlist.title}
</h1>
<div className="flex min-w-0 items-center justify-center gap-2 sm:justify-start md:contents">
<MobileSidebarTrigger />
<h1 className="text-3xl font-bold tracking-tight sm:text-4xl">
{playlist.title}
</h1>
</div>
<p className="text-lg font-semibold text-primary">
{playlist.owner.name}
</p>
+9 -2
View File
@@ -1,5 +1,6 @@
"use client"
import { MobileSidebarTrigger } from "@/components/mobile-sidebar-trigger"
import { stationArtistId } from "@/lib/station-artist"
import { useEffect, useMemo, useState, useRef, MouseEvent } from "react"
import Image from "next/image"
@@ -362,7 +363,10 @@ export function SongsView() {
return (
<div className="flex h-svh flex-col">
<header className="flex items-center justify-between gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Songs</h1>
<div className="flex min-w-0 items-center gap-2">
<MobileSidebarTrigger />
<h1 className="text-lg font-semibold">Songs</h1>
</div>
</header>
<SongListSkeleton />
</div>
@@ -372,7 +376,10 @@ export function SongsView() {
return (
<div className="flex h-svh flex-col">
<header className="flex items-center justify-between gap-2 border-b px-4 py-3">
<h1 className="text-lg font-semibold">Songs</h1>
<div className="flex min-w-0 items-center gap-2">
<MobileSidebarTrigger />
<h1 className="text-lg font-semibold">Songs</h1>
</div>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon-sm" aria-label="Sort songs">