+
+ → {metadata && metadata.common.title} [
+ {metadata && metadata.format.codec}]
Artist:{" "}
diff --git a/renderer/pages/_app.tsx b/renderer/pages/_app.tsx
index f741c61..e817fa2 100644
--- a/renderer/pages/_app.tsx
+++ b/renderer/pages/_app.tsx
@@ -5,6 +5,7 @@ import Player from "@/components/ui/player";
import Head from "next/head";
import { PlayerProvider } from "@/context/playerContext";
import { useRouter } from "next/router";
+import { Toaster } from "@/components/ui/sonner";
export default function App({ Component, pageProps }) {
const router = useRouter();
@@ -18,7 +19,7 @@ export default function App({ Component, pageProps }) {
}
return (
-
+
Wora
@@ -26,6 +27,7 @@ export default function App({ Component, pageProps }) {
+
diff --git a/renderer/pages/albums/[slug].tsx b/renderer/pages/albums/[slug].tsx
index ce825e6..f9917ce 100644
--- a/renderer/pages/albums/[slug].tsx
+++ b/renderer/pages/albums/[slug].tsx
@@ -24,7 +24,6 @@ import {
ContextMenuSubTrigger,
ContextMenuTrigger,
} from "@/components/ui/context-menu";
-import { Toaster } from "@/components/ui/sonner";
import { toast } from "sonner";
type Song = {
@@ -109,7 +108,6 @@ export default function Album() {
return (
-
-
{playlist && playlist.id === 1 ? (
diff --git a/renderer/pages/settings.tsx b/renderer/pages/settings.tsx
index 9f69f6e..7c1b6bf 100644
--- a/renderer/pages/settings.tsx
+++ b/renderer/pages/settings.tsx
@@ -1,20 +1,260 @@
-import React from "react";
+import React, { useEffect, useState, useRef } from "react";
import { ScrollArea } from "@/components/ui/scroll-area";
+import Image from "next/image";
+import {
+ IconArrowRight,
+ IconCheck,
+ IconHeart,
+ IconX,
+} from "@tabler/icons-react";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useForm } from "react-hook-form";
+import { z } from "zod";
+import { Input } from "@/components/ui/input";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormMessage,
+} from "@/components/ui/form";
+import { Button } from "@/components/ui/button";
+import Spinner from "@/components/ui/spinner";
+import { Avatar, AvatarImage } from "@/components/ui/avatar";
+import { toast } from "sonner";
+
+const formSchema = z.object({
+ name: z.string().min(2, {
+ message: "Username must be at least 2 characters long.",
+ }),
+ profilePicture: z.any().optional(),
+});
+
+type Settings = {
+ name: string;
+ profilePicture: string;
+};
export default function Settings() {
+ const [settings, setSettings] = useState
(null);
+ const [loading, setLoading] = useState(false);
+ const [musicLoading, setMusicLoading] = useState(false);
+
+ useEffect(() => {
+ window.ipc.invoke("getSettings").then((response) => {
+ setSettings(response);
+ });
+ }, []);
+
+ const updateSettings = async (data: z.infer) => {
+ setLoading(true);
+
+ let profilePicturePath = settings?.profilePicture;
+
+ if (
+ data.profilePicture &&
+ data.profilePicture instanceof FileList &&
+ data.profilePicture.length > 0
+ ) {
+ const file = data.profilePicture[0];
+ const fileData = await file.arrayBuffer();
+ try {
+ profilePicturePath = await window.ipc.invoke("uploadProfilePicture", {
+ name: file.name,
+ data: Array.from(new Uint8Array(fileData)),
+ });
+ } catch (error) {
+ console.error("Error uploading profile picture:", error);
+ toast(
+
+
+ Failed to upload profile picture. Using existing picture.
+
,
+ );
+ // Fallback to the original profile picture
+ profilePicturePath = settings?.profilePicture;
+ }
+ } else {
+ // No new file selected, use the existing profile picture
+ profilePicturePath = settings?.profilePicture;
+ }
+
+ const updatedData = {
+ name: data.name,
+ profilePicture: profilePicturePath,
+ };
+
+ await window.ipc.invoke("updateSettings", updatedData).then((response) => {
+ if (response) {
+ setLoading(false);
+ setSettings((prevSettings) => ({ ...prevSettings, ...updatedData }));
+ toast(
+
+
+ Your settings are updated.
+
,
+ );
+ }
+ });
+ };
+
+ const form = useForm>({
+ resolver: zodResolver(formSchema),
+ });
+
+ useEffect(() => {
+ console.log("settings", settings);
+ if (settings) {
+ form.reset({
+ name: settings.name,
+ profilePicture: settings.profilePicture,
+ });
+ }
+ }, [settings]);
+
+ const updateMusicFolder = () => {
+ setMusicLoading(true);
+ window.ipc
+ .invoke("setMusicFolder", true)
+ .then((response) => {
+ setMusicLoading(false);
+ if (response) return;
+ toast(
+
+
+ Your music folder updated.
+
,
+ );
+ })
+ .catch(() => setMusicLoading(false));
+ };
+
return (
Settings
-
- Hey Aaryan! Ready for a Jam Session?
-
+
You're on your own here.
-
-
-
+
+
+
+
+
+
+
+
+
+ Made with
+
+ by hiaaryan.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Made with
+
+ by hiaaryan.
+
+
+
+
diff --git a/renderer/public/.DS_Store b/renderer/public/.DS_Store
index 53fda93..abfafa2 100644
Binary files a/renderer/public/.DS_Store and b/renderer/public/.DS_Store differ
diff --git a/renderer/public/ak.jpeg b/renderer/public/ak.jpeg
deleted file mode 100644
index df5bbb7..0000000
Binary files a/renderer/public/ak.jpeg and /dev/null differ
diff --git a/renderer/public/userPicture.png b/renderer/public/userPicture.png
new file mode 100644
index 0000000..a909cf2
Binary files /dev/null and b/renderer/public/userPicture.png differ