Spaces:
Sleeping
Sleeping
Commit
·
a34fbc5
1
Parent(s):
85166db
fix build error
Browse files
frontend/src/app/playlists/page.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
'use client';
|
| 2 |
import SavedPlaylists from "@/components/SavedPlaylists";
|
| 3 |
|
| 4 |
export default function PlaylistsPage() {
|
|
|
|
|
|
|
| 1 |
import SavedPlaylists from "@/components/SavedPlaylists";
|
| 2 |
|
| 3 |
export default function PlaylistsPage() {
|
frontend/src/components/SavedPlaylists.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"use client";
|
| 2 |
-
import React, { useState } from "react";
|
| 3 |
import { useMusicPlayer } from "@/context/MusicPlayerContext";
|
| 4 |
import { formatTitle } from "@/lib/utils";
|
| 5 |
import { FaTrash, FaEdit } from "react-icons/fa";
|
|
@@ -7,7 +7,12 @@ import "./SavedPlaylists.css";
|
|
| 7 |
|
| 8 |
const SavedPlaylists = () => {
|
| 9 |
const { initializePlayer, addToPlayqueue } = useMusicPlayer();
|
| 10 |
-
const [playlists, setPlaylists] = useState(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
const handlePlayPlaylist = (tracks) => {
|
| 13 |
if (tracks.length > 0) {
|
|
|
|
| 1 |
"use client";
|
| 2 |
+
import React, { useState, useEffect } from "react";
|
| 3 |
import { useMusicPlayer } from "@/context/MusicPlayerContext";
|
| 4 |
import { formatTitle } from "@/lib/utils";
|
| 5 |
import { FaTrash, FaEdit } from "react-icons/fa";
|
|
|
|
| 7 |
|
| 8 |
const SavedPlaylists = () => {
|
| 9 |
const { initializePlayer, addToPlayqueue } = useMusicPlayer();
|
| 10 |
+
const [playlists, setPlaylists] = useState({});
|
| 11 |
+
|
| 12 |
+
useEffect(() => {
|
| 13 |
+
const storedPlaylists = JSON.parse(localStorage.getItem("playlists")) || {};
|
| 14 |
+
setPlaylists(storedPlaylists);
|
| 15 |
+
}, []);
|
| 16 |
|
| 17 |
const handlePlayPlaylist = (tracks) => {
|
| 18 |
if (tracks.length > 0) {
|