Skip to content

Commit

Permalink
minor fixes ✌️
Browse files Browse the repository at this point in the history
  • Loading branch information
hiaaryan committed Dec 26, 2024
1 parent de127ee commit a8b17c6
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 264 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 0 additions & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,5 @@ fileAssociations:
name: WEBA Audio File
- ext: webm
name: WEBM Audio File
- ext: dolby
name: Dolby Audio File
- ext: flac
name: FLAC Audio File
4 changes: 1 addition & 3 deletions main/helpers/db/connectDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ export const updatePlaylist = async (data: any) => {
coverArt = "/coverArt.png";
}

console.log(data);

const playlist = await db
.update(playlists)
.set({
Expand Down Expand Up @@ -424,7 +422,7 @@ export const initializeData = async (musicFolder: string) => {
// @hiaaryan: Update Album if Artist or CoverArt is different
if (
album.artist !==
(metadata.common.albumartist || metadata.common.artist) ||
(metadata.common.albumartist || metadata.common.artist) ||
album.year !== metadata.common.year ||
album.coverArt !== art
) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"build": "nextron build",
"build:mac": "nextron build --mac --universal",
"build:linux": "nextron build --linux",
"build:win64": "nextron build --win --x64",
"postinstall": "electron-builder install-app-deps"
"build:win64": "nextron build --win --x64"
},
"dependencies": {
"@hookform/resolvers": "^3.9.1",
Expand Down
2 changes: 1 addition & 1 deletion renderer/components/main/lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Lyrics: React.FC<LyricsProps> = React.memo(
}, [currentLyric]);

return (
<div className="wora-border relative mt-2 h-full w-full rounded-2xl bg-white/70 backdrop-blur-xl dark:bg-black/70">
<div className="wora-border relative h-full w-full rounded-2xl bg-white/70 backdrop-blur-xl dark:bg-black/70">
<div className="absolute bottom-5 right-6 z-50 flex items-center gap-2">
<Badge>{isSyncedLyrics ? "Synced" : "Unsynced"}</Badge>
</div>
Expand Down
16 changes: 11 additions & 5 deletions renderer/components/main/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,20 @@ const Navbar = () => {
</TooltipContent>
</Tooltip>
</div>
<Tooltip delayDuration={0}>
<TooltipTrigger>
<Button variant="ghost" onClick={handleThemeToggle} asChild>
{renderIcon()}
</Button>
</TooltipTrigger>
<TooltipContent side="right" sideOffset={25}>
<p className="capitalize">Theme: {theme}</p>
</TooltipContent>
</Tooltip>

</TooltipProvider>
<Button variant="ghost" onClick={handleThemeToggle} asChild>
{renderIcon()}
</Button>
</div>



<CommandDialog open={open} onOpenChange={setOpen}>
<Command>
<CommandInput
Expand Down
47 changes: 6 additions & 41 deletions renderer/components/main/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
IconVinyl,
IconVolume,
IconVolumeOff,
IconWaveSine,
IconX,
} from "@tabler/icons-react";
import { useCallback, useEffect, useRef, useState } from "react";
Expand All @@ -43,8 +42,6 @@ import {
} from "@/components/ui/tooltip";
import { convertTime, isSyncedLyrics, parseLyrics } from "@/lib/helpers";
import { useAudioMetadata } from "@/lib/helpers";
import { Badge } from "@/components/ui/badge";
import { updateDiscordState, resetDiscordState } from "@/lib/helpers";
import { usePlayer } from "@/context/playerContext";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import Link from "next/link";
Expand All @@ -58,7 +55,6 @@ import {
ContextMenuSubTrigger,
ContextMenuTrigger,
} from "@/components/ui/context-menu";
import Spectrogram from "../ui/spectrogram";

export const Player = () => {
const [isPlaying, setIsPlaying] = useState(false);
Expand All @@ -69,7 +65,6 @@ export const Player = () => {
const [currentLyric, setCurrentLyric] = useState(null);
const [showLyrics, setShowLyrics] = useState(false);
const [showQueue, setShowQueue] = useState(false);
const [showSpectrogram, setShowSpectrogram] = useState(false);
const [isFavourite, setIsFavourite] = useState(false);
const [playlists, setPlaylists] = useState([]);
const {
Expand Down Expand Up @@ -112,12 +107,10 @@ export const Player = () => {
setIsPlaying(true);
},
onloaderror: (error) => {
resetDiscordState();
setIsPlaying(false);
console.error("Error loading audio:", error);
},
onend: () => {
resetDiscordState();
setIsPlaying(false);
if (!repeat) {
nextSong();
Expand Down Expand Up @@ -158,19 +151,13 @@ export const Player = () => {
navigator.mediaSession.setActionHandler("previoustrack", previousSong);

soundRef.current.on("play", () => {
updateDiscordState(song);
setIsPlaying(true);
});

soundRef.current.on("pause", () => {
resetDiscordState();
setIsPlaying(false);
});

if (soundRef.current.state() === "loaded") {
updateDiscordState(song);
}

return () => {
clearInterval(interval);
};
Expand Down Expand Up @@ -246,10 +233,6 @@ export const Player = () => {
setShowLyrics((prev) => !prev);
}, []);

const toggleSpectrogram = useCallback(() => {
setShowSpectrogram((prev) => !prev);
}, []);

const toggleQueue = useCallback(() => {
setShowQueue((prev) => !prev);
}, []);
Expand Down Expand Up @@ -303,7 +286,7 @@ export const Player = () => {
</div>
<div className="!absolute right-0 top-0 w-96">
{showQueue && (
<div className="wora-border relative mt-2 h-full w-full rounded-2xl bg-white/70 backdrop-blur-xl dark:bg-black/70">
<div className="wora-border relative h-full w-full rounded-2xl bg-white/70 backdrop-blur-xl dark:bg-black/70">
<div className="h-utility w-full max-w-3xl px-6 pt-6">
<Tabs
defaultValue="queue"
Expand All @@ -327,7 +310,7 @@ export const Player = () => {
key={song.id}
className="flex w-full items-center gap-4 overflow-hidden gradient-mask-r-70"
>
<div className="relative h-14 w-14 overflow-hidden rounded-lg shadow-lg">
<div className="relative min-h-14 min-w-14 overflow-hidden rounded-lg shadow-lg">
<Image
alt="Album Cover"
src={song.album.coverArt}
Expand Down Expand Up @@ -384,15 +367,6 @@ export const Player = () => {
</div>
)}
</div>
<div className="!absolute right-0 top-0 w-full">
<div
className={`wora-border ${soundRef.current && soundRef.current.playing() && showSpectrogram ? "block" : "hidden"} relative mt-2 h-full w-full rounded-2xl bg-black`}
>
<div className="h-utility w-full p-6">
{soundRef.current && <Spectrogram howl={soundRef.current} />}
</div>
</div>
</div>
<div className="w-full h-28 rounded-2xl wora-border overflow-hidden p-6">
<div className="relative flex h-full w-full items-center">
<TooltipProvider>
Expand All @@ -401,7 +375,7 @@ export const Player = () => {
<ContextMenu>
<ContextMenuTrigger>
<Link href={`/albums/${song.album.id}`}>
<div className="relative h-[4.25rem] w-[4.25rem] overflow-hidden rounded-lg shadow-lg transition duration-500">
<div className="relative min-h-[4.25rem] min-w-[4.25rem] overflow-hidden rounded-lg shadow-lg transition duration-500">
<Image
alt="Album Cover"
src={song.album.coverArt}
Expand All @@ -419,15 +393,6 @@ export const Player = () => {
Go to Album
</ContextMenuItem>
</Link>
{soundRef.current && soundRef.current.playing() && (
<ContextMenuItem
onClick={toggleSpectrogram}
className="flex items-center gap-2"
>
<IconWaveSine stroke={2} size={14} />
Spectrogram
</ContextMenuItem>
)}
<ContextMenuSub>
<ContextMenuSubTrigger className="flex items-center gap-2">
<IconPlus stroke={2} size={14} />
Expand All @@ -452,7 +417,7 @@ export const Player = () => {
</ContextMenuContent>
</ContextMenu>
) : (
<div className="relative h-16 w-16 overflow-hidden rounded-lg transition duration-500">
<div className="relative min-h-[4.25rem] min-w-[4.25rem] overflow-hidden rounded-lg shadow-lg transition duration-500">
<Image
alt="Album Cover"
src={"/coverArt.png"}
Expand Down Expand Up @@ -545,7 +510,7 @@ export const Player = () => {
)}
</Button>
{metadata && metadata.format.lossless && (
<div className="absolute left-32">
<div className="absolute left-36">
<Tooltip delayDuration={0}>
<TooltipTrigger>
<IconRipple stroke={2} className="w-3.5" />
Expand All @@ -559,7 +524,7 @@ export const Player = () => {
</Tooltip>
</div>
)}
<div className="absolute right-32">
<div className="absolute right-36">
<Tooltip delayDuration={0}>
<TooltipTrigger>
<Button
Expand Down
Loading

0 comments on commit a8b17c6

Please sign in to comment.