Skip to content

Commit bb9ffef

Browse files
committed
feat: enhance UI responsiveness and volume control
- Updated layout margins for 2xl screens - Commented out section title in homepage - Improved volume slider and mute functionality in player - Adjusted sidebar width for 2xl screens Signed-off-by: rajput-hemant <[email protected]>
1 parent 53826a3 commit bb9ffef

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

src/app/(root)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function Layout({ children }: React.PropsWithChildren) {
2121
<React.Fragment>
2222
<Navbar />
2323
<Sidebar user={user} userPlaylists={userPlaylists} />
24-
<main className="p-2 pb-24 sm:p-4 sm:pb-24 lg:ml-[20%] lg:pb-10 xl:ml-[15%]">
24+
<main className="p-2 pb-24 sm:p-4 sm:pb-24 lg:ml-[20%] lg:pb-10 xl:ml-[15%] 2xl:ml-[12.5%]">
2525
<SecondaryNavbar />
2626
{children}
2727
<SiteFooter />

src/app/(root)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export default async function HomePage() {
3333
<div key={key} className="mb-4 space-y-4">
3434
<header className="border-b pb-2">
3535
<h1 className="sr-only">{siteConfig.name} Homepage</h1>
36-
36+
{/*
3737
<h2 className="pl-2 font-heading text-2xl drop-shadow-md dark:bg-gradient-to-br dark:from-neutral-200 dark:to-neutral-600 dark:bg-clip-text dark:text-transparent sm:text-3xl md:text-4xl lg:pl-0">
3838
{section.title}
39-
</h2>
39+
</h2> */}
4040

4141
{section.subtitle && (
4242
<p className="pl-2 font-medium text-muted-foreground lg:pl-0">

src/components/player.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,20 @@ export function Player({ user, playlists }: PlayerProps) {
403403
<div className="hidden items-center gap-4 xl:flex">
404404
<button
405405
aria-label={muted ? "Unmute" : "Mute"}
406-
disabled={!isReady || muted}
407-
onClick={() => mute(!muted)}
408-
className="disabled:text-muted-foreground"
406+
onClick={() => {
407+
if (!isReady) return;
408+
const newMuted = !muted;
409+
mute(newMuted);
410+
if (!newMuted && volume === 0) {
411+
setVolume(0.75); // Reset to 75% if unmuting from 0
412+
}
413+
}}
414+
className={cn(
415+
"transition-opacity hover:opacity-100",
416+
(!isReady || muted) && "text-muted-foreground opacity-50"
417+
)}
409418
>
410-
{muted ?
419+
{muted || volume === 0 ?
411420
<VolumeX />
412421
: volume < 0.33 ?
413422
<Volume />
@@ -418,13 +427,26 @@ export function Player({ user, playlists }: PlayerProps) {
418427

419428
<Slider
420429
aria-label="Volume"
421-
disabled={!isReady || muted}
422-
value={[volume * 100]}
430+
value={[muted ? 0 : volume * 100]}
423431
defaultValue={[75]}
424-
onValueChange={([volume]) => {
425-
setVolume(volume / 100);
432+
min={0}
433+
max={100}
434+
step={1}
435+
onValueChange={([value]) => {
436+
if (!isReady) return;
437+
const newVolume = value / 100;
438+
setVolume(newVolume);
439+
if (newVolume > 0 && muted) {
440+
mute(false);
441+
}
442+
if (newVolume === 0 && !muted) {
443+
mute(true);
444+
}
426445
}}
427-
className="w-44"
446+
className={cn(
447+
"w-44 transition-opacity hover:opacity-100",
448+
!isReady && "opacity-50"
449+
)}
428450
>
429451
<SliderTrack className="h-1 cursor-pointer">
430452
<SliderRange
@@ -442,7 +464,7 @@ export function Player({ user, playlists }: PlayerProps) {
442464
</Slider>
443465

444466
<span className="w-8 text-sm font-medium">
445-
{(volume * 100).toFixed()}%
467+
{muted ? "0" : Math.round(volume * 100)}%
446468
</span>
447469
</div>
448470

src/components/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function Sidebar({ user, userPlaylists }: SidebarProps) {
2424
const [segment] = useSelectedLayoutSegments();
2525

2626
return (
27-
<aside className="fixed left-0 top-14 hidden h-full w-1/5 space-y-2 border-r p-4 animate-in slide-in-from-left-full [animation-duration:500ms] lg:block xl:w-[15%]">
27+
<aside className="fixed left-0 top-14 hidden h-full w-1/5 space-y-2 border-r p-4 animate-in slide-in-from-left-full [animation-duration:500ms] lg:block xl:w-[15%] 2xl:w-[12.5%]">
2828
<h3 className="pl-3 font-heading text-xl drop-shadow-md dark:bg-gradient-to-br dark:from-neutral-200 dark:to-neutral-600 dark:bg-clip-text dark:text-transparent sm:text-2xl md:text-3xl">
2929
Discover
3030
</h3>

0 commit comments

Comments
 (0)