Changeset a3ae097 for frontend/src/components/userProfile/ArtistView.tsx
- Timestamp:
- 01/26/26 20:19:20 (6 months ago)
- Branches:
- main
- Children:
- d47e225
- Parents:
- fd81a18
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
frontend/src/components/userProfile/ArtistView.tsx
rfd81a18 ra3ae097 1 1 import { useNavigate } from "react-router-dom"; 2 import { Music, Disc3, Mic2 } from "lucide-react"; 2 3 3 4 interface ArtistContributionDTO { … … 15 16 const navigate = useNavigate(); 16 17 18 const albums = contributions.filter((c) => c.entityType === "Album"); 19 const songs = contributions.filter((c) => c.entityType === "Song"); 20 21 const getRoleColor = (role: string) => { 22 const colors: { [key: string]: string } = { 23 COMPOSER: "bg-purple-500", 24 PERFORMER: "bg-blue-500", 25 PRODUCER: "bg-green-500", 26 MAIN_VOCAL: "bg-pink-500", 27 }; 28 return colors[role] || "bg-gray-500"; 29 }; 30 17 31 return ( 18 <div className="mt-8 border-t pt-6"> 19 <h2 className="text-2xl font-bold mb-4">Contributions</h2> 20 <div className="grid gap-3"> 21 {contributions.map((contribution, index) => ( 22 <div 23 key={index} 24 className="p-4 border rounded hover:shadow-md transition-shadow cursor-pointer" 25 onClick={() => 26 navigate(`/musical-entity/${contribution.musicalEntityId}`) 27 } 28 > 29 <div className="flex justify-between items-center"> 30 <div className="flex-1"> 31 <p className="font-semibold text-lg">{contribution.title}</p> 32 <p className="text-sm text-gray-500 mt-1"> 33 ID: {contribution.musicalEntityId} 34 </p> 32 <div className="mt-8"> 33 {/* Albums Section */} 34 {albums.length > 0 && ( 35 <div className="mb-12"> 36 <div className="flex items-center gap-3 mb-6"> 37 <Disc3 className="w-8 h-8 text-purple-600" /> 38 <h2 className="text-3xl font-bold">Albums</h2> 39 </div> 40 <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"> 41 {albums.map((album, index) => ( 42 <div 43 key={index} 44 className="group cursor-pointer" 45 onClick={() => 46 navigate(`/musical-entity/${album.musicalEntityId}`) 47 } 48 > 49 <div className="relative aspect-square bg-linear-to-br from-purple-400 via-pink-400 to-blue-400 rounded-lg mb-3 overflow-hidden shadow-lg group-hover:shadow-2xl transition-all duration-300 group-hover:scale-105"> 50 <div className="absolute inset-0 flex items-center justify-center"> 51 <Disc3 className="w-20 h-20 text-white opacity-40" /> 52 </div> 53 <div className="absolute bottom-0 left-0 right-0 bg-linear-to-t from-black/60 to-transparent p-4"> 54 <span 55 className={`text-xs px-2 py-1 rounded-full text-white ${getRoleColor(album.role)}`} 56 > 57 {album.role.replace("_", " ")} 58 </span> 59 </div> 60 </div> 61 <h3 className="font-semibold text-base line-clamp-2 group-hover:text-blue-600 transition-colors"> 62 {album.title} 63 </h3> 35 64 </div> 36 <div className="flex gap-2"> 37 <span className="bg-purple-100 text-purple-800 px-3 py-1 rounded-full text-sm font-medium"> 38 {contribution.role} 39 </span> 40 <span className="bg-gray-100 text-gray-800 px-3 py-1 rounded-full text-sm font-medium"> 41 {contribution.entityType} 65 ))} 66 </div> 67 </div> 68 )} 69 70 {songs.length > 0 && ( 71 <div className="mb-12"> 72 <div className="flex items-center gap-3 mb-6"> 73 <Music className="w-8 h-8 text-blue-600" /> 74 <h2 className="text-3xl font-bold">Songs</h2> 75 </div> 76 <div className="space-y-2"> 77 {songs.map((song, index) => ( 78 <div 79 key={index} 80 className="group flex items-center gap-4 p-4 rounded-lg hover:bg-gray-50 transition-all cursor-pointer border border-transparent hover:border-gray-200" 81 onClick={() => 82 navigate(`/musical-entity/${song.musicalEntityId}`) 83 } 84 > 85 <div className="shrink-0 w-14 h-14 bg-linear-to-br from-blue-400 to-cyan-400 rounded flex items-center justify-center group-hover:scale-110 transition-transform shadow-md"> 86 <Music className="w-7 h-7 text-white" /> 87 </div> 88 <div className="flex-1 min-w-0"> 89 <h3 className="font-semibold text-lg group-hover:text-blue-600 transition-colors truncate"> 90 {song.title} 91 </h3> 92 <div className="flex items-center gap-2 mt-1"> 93 <Mic2 className="w-4 h-4 text-gray-400" /> 94 </div> 95 </div> 96 <span 97 className={`px-4 py-2 rounded-full text-white text-sm font-medium ${getRoleColor(song.role)} shadow-md`} 98 > 99 {song.role.replace("_", " ")} 42 100 </span> 43 101 </div> 44 </div>102 ))} 45 103 </div> 46 ))} 47 </div> 104 </div> 105 )} 106 48 107 {contributions.length === 0 && ( 49 <p className="text-gray-500 text-center py-4">No contributions yet</p> 108 <div className="flex flex-col items-center justify-center py-16 text-gray-400"> 109 <Music className="w-24 h-24 mb-4 opacity-20" /> 110 <p className="text-xl font-medium">No contributions yet</p> 111 <p className="text-sm mt-2">Start creating music to see it here</p> 112 </div> 50 113 )} 51 114 </div>
Note:
See TracChangeset
for help on using the changeset viewer.
