Changeset 615dcee for frontend/src/components
- Timestamp:
- 02/18/26 22:33:00 (5 months ago)
- Branches:
- main
- Children:
- ed8f998
- Parents:
- d1ee039
- Location:
- frontend/src/components
- Files:
-
- 3 edited
-
SongItem.tsx (modified) (5 diffs)
-
userProfile/ArtistView.tsx (modified) (1 diff)
-
userProfile/UserListModal.tsx (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/components/SongItem.tsx
rd1ee039 r615dcee 1 import { use Ref, useState } from "react";1 import { use, useRef, useState } from "react"; 2 2 import { useNavigate } from "react-router-dom"; 3 3 import { baseURL } from "../api/axiosInstance"; … … 5 5 import { toEmbedUrl } from "../utils/utils"; 6 6 import PlaylistDropdown from "./playlist/PlaylistDropdown"; 7 import { useAuth } from "../context/authContext"; 7 8 8 9 export interface SongItemData { … … 50 51 const navigate = useNavigate(); 51 52 const { play, currentSong } = usePlayer(); 53 const { user } = useAuth(); 52 54 const [internalOpen, setInternalOpen] = useState(false); 53 55 const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0 }); … … 165 167 166 168 {/* Like button */} 167 { onLikeToggle && (169 {user && onLikeToggle && ( 168 170 <button 169 171 onClick={(e) => { … … 187 189 188 190 {/* Three-dot menu */} 189 <div className="relative"> 190 <button 191 ref={buttonRef} 192 onClick={(e) => { 193 e.stopPropagation(); 194 if (playlistOpen) { 195 setPlaylistOpen(false); 196 } else { 197 if (buttonRef.current) { 198 const rect = buttonRef.current.getBoundingClientRect(); 199 const spaceBelow = window.innerHeight - rect.bottom; 200 const dropdownHeight = 260; 201 202 if (spaceBelow < dropdownHeight) { 203 setDropdownDirection("above"); 204 setDropdownPosition({ 205 top: rect.top - 8, 206 left: rect.right - 224, 207 }); 208 } else { 209 setDropdownDirection("below"); 210 setDropdownPosition({ 211 top: rect.bottom + 8, 212 left: rect.right - 224, 213 }); 191 {user && ( 192 <div className="relative"> 193 <button 194 ref={buttonRef} 195 onClick={(e) => { 196 e.stopPropagation(); 197 if (playlistOpen) { 198 setPlaylistOpen(false); 199 } else { 200 if (buttonRef.current) { 201 const rect = buttonRef.current.getBoundingClientRect(); 202 const spaceBelow = window.innerHeight - rect.bottom; 203 const dropdownHeight = 260; 204 205 if (spaceBelow < dropdownHeight) { 206 setDropdownDirection("above"); 207 setDropdownPosition({ 208 top: rect.top - 8, 209 left: rect.right - 224, 210 }); 211 } else { 212 setDropdownDirection("below"); 213 setDropdownPosition({ 214 top: rect.bottom + 8, 215 left: rect.right - 224, 216 }); 217 } 214 218 } 219 setPlaylistOpen(true); 215 220 } 216 setPlaylistOpen(true); 217 } 218 }} 219 className="p-2 hover:bg-white/10 rounded-full transition-colors cursor-pointer text-gray-400 hover:text-white" 220 aria-label="More options" 221 > 222 <svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"> 223 <circle cx="12" cy="5" r="1.5" /> 224 <circle cx="12" cy="12" r="1.5" /> 225 <circle cx="12" cy="19" r="1.5" /> 226 </svg> 227 </button> 228 229 <PlaylistDropdown 230 songId={song.id} 231 isOpen={playlistOpen} 232 onClose={() => setPlaylistOpen(false)} 233 position={dropdownPosition} 234 usePortal={true} 235 direction={dropdownDirection} 236 /> 237 </div> 221 }} 222 className="p-2 hover:bg-white/10 rounded-full transition-colors cursor-pointer text-gray-400 hover:text-white" 223 aria-label="More options" 224 > 225 <svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"> 226 <circle cx="12" cy="5" r="1.5" /> 227 <circle cx="12" cy="12" r="1.5" /> 228 <circle cx="12" cy="19" r="1.5" /> 229 </svg> 230 </button> 231 232 <PlaylistDropdown 233 songId={song.id} 234 isOpen={playlistOpen} 235 onClose={() => setPlaylistOpen(false)} 236 position={dropdownPosition} 237 usePortal={true} 238 direction={dropdownDirection} 239 /> 240 </div> 241 )} 242 243 {/* Three-dot menu */} 238 244 </div> 239 245 ); -
frontend/src/components/userProfile/ArtistView.tsx
rd1ee039 r615dcee 6 6 import type { ArtistContribution } from "../../utils/types"; 7 7 import SongItem from "../SongItem"; 8 import { useAuth } from "../../context/authContext"; 8 9 9 10 interface ArtistViewProps { -
frontend/src/components/userProfile/UserListModal.tsx
rd1ee039 r615dcee 3 3 import type { BaseNonAdminUser } from "../../utils/types"; 4 4 import { useEffect } from "react"; 5 import { useAuth } from "../../context/authContext"; 5 6 6 7 interface ModalProps { … … 18 19 }: ModalProps) => { 19 20 const navigate = useNavigate(); 21 const { user } = useAuth(); 20 22 useEffect(() => { 21 23 document.body.style.overflow = "hidden"; … … 72 74 </div> 73 75 </div> 74 75 <button 76 onClick={() => onFollowToggle(u.username)} 77 className={`px-4 py-1.5 text-sm font-medium rounded-full transition-colors cursor-pointer ${ 78 u.isFollowedByCurrentUser 79 ? "bg-white/10 text-white hover:bg-white/20" 80 : "bg-[#1db954] text-black hover:bg-[#1ed760]" 81 }`} 82 > 83 {u.isFollowedByCurrentUser ? "Following" : "Follow"} 84 </button> 76 {user && ( 77 <button 78 onClick={() => onFollowToggle(u.username)} 79 className={`px-4 py-1.5 text-sm font-medium rounded-full transition-colors cursor-pointer ${ 80 u.isFollowedByCurrentUser 81 ? "bg-white/10 text-white hover:bg-white/20" 82 : "bg-[#1db954] text-black hover:bg-[#1ed760]" 83 }`} 84 > 85 {u.isFollowedByCurrentUser ? "Following" : "Follow"} 86 </button> 87 )} 85 88 </div> 86 89 ))
Note:
See TracChangeset
for help on using the changeset viewer.
