Changeset 5938bc9
- Timestamp:
- 02/07/26 14:59:57 (5 months ago)
- Branches:
- main
- Children:
- ebdd3d4
- Parents:
- 591919d
- Files:
-
- 4 edited
-
finkwave/src/main/java/com/ukim/finki/develop/finkwave/controller/SongController.java (modified) (1 diff)
-
finkwave/src/main/java/com/ukim/finki/develop/finkwave/service/SongService.java (modified) (1 diff)
-
frontend/src/App.tsx (modified) (3 diffs)
-
frontend/src/components/Sidebar.tsx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
finkwave/src/main/java/com/ukim/finki/develop/finkwave/controller/SongController.java
r591919d r5938bc9 20 20 @AllArgsConstructor 21 21 public class SongController { 22 private final AuthService authService;23 22 private final SongService songService; 24 23 25 24 @GetMapping("/top") 26 25 public HttpEntity<List<MusicalEntityDto>> getSongs(){ 27 Long userId = authService.getCurrentUserID(); 28 return ResponseEntity.ok(songService.getTopSongs(userId)); 26 return ResponseEntity.ok(songService.getTopSongs()); 29 27 } 30 28 -
finkwave/src/main/java/com/ukim/finki/develop/finkwave/service/SongService.java
r591919d r5938bc9 15 15 private final AuthService authService; 16 16 17 public List<MusicalEntityDto> getTopSongs(Long userId){ 17 public List<MusicalEntityDto> getTopSongs(){ 18 Long userId = null; 19 try { 20 userId = authService.getCurrentUserID(); 21 } catch (Exception ignored) {} 18 22 return songRepository.findTopByListens(userId); 19 23 } -
frontend/src/App.tsx
r591919d r5938bc9 4 4 import "react-toastify/dist/ReactToastify.css"; 5 5 import Sidebar from "./components/Sidebar"; 6 import { useAuth } from "./context/authContext"; 6 7 import AllUsers from "./pages/AllUsers"; 7 8 import LandingPage from "./pages/LandingPage"; … … 12 13 import UserDetail from "./pages/UserDetail"; 13 14 14 const Layout = () => { 15 const [isSidebarOpen, setIsSidebarOpen] = useState(true); 15 const MainLayout = () => { 16 const { user } = useAuth(); 17 const [isSidebarOpen, setIsSidebarOpen] = useState(!!user); 16 18 17 19 return ( … … 43 45 </div> 44 46 ); 47 }; 48 49 const Layout = () => { 50 const { isAuthLoading } = useAuth(); 51 52 if (isAuthLoading) { 53 return ( 54 <div className="flex h-screen items-center justify-center bg-[#121212]"> 55 <div className="w-12 h-12 border-4 border-white/10 border-t-[#1db954] rounded-full animate-spin"></div> 56 </div> 57 ); 58 } 59 60 return <MainLayout />; 45 61 }; 46 62 -
frontend/src/components/Sidebar.tsx
r591919d r5938bc9 1 1 import { useEffect, useState } from "react"; 2 2 import axiosInstance from "../api/axiosInstance"; 3 import { useAuth } from "../context/authContext"; 3 4 import type { BasicPlaylist, BasicSong, SidebarProps } from "../utils/types"; 4 5 5 6 const Sidebar = ({ isOpen, onClose }: SidebarProps) => { 7 const { user } = useAuth(); 6 8 const [recentlyListened, setRecentlyListened] = useState<BasicSong[]>([]); 7 9 const [playlists, setPlaylists] = useState<BasicPlaylist[]>([]); … … 25 27 } 26 28 }; 27 fetchData(); 28 }, []); 29 if (user) { 30 fetchData(); 31 } else { 32 setRecentlyListened([]); 33 setPlaylists([]); 34 } 35 }, [user]); 29 36 return ( 30 37 <div
Note:
See TracChangeset
for help on using the changeset viewer.
