source: frontend/src/components/userProfile/ArtistView.tsx@ d47e225

main
Last change on this file since d47e225 was a3ae097, checked in by Dimitar Arsov <dimitararsov04@…>, 6 months ago

add Global exception handler

  • Property mode set to 100644
File size: 4.5 KB
RevLine 
[fd81a18]1import { useNavigate } from "react-router-dom";
[a3ae097]2import { Music, Disc3, Mic2 } from "lucide-react";
[fd81a18]3
4interface ArtistContributionDTO {
5 musicalEntityId: number;
6 title: string;
7 role: string;
8 entityType: string;
9}
10
11interface ArtistViewProps {
12 contributions: ArtistContributionDTO[];
13}
14
15const ArtistView = ({ contributions }: ArtistViewProps) => {
16 const navigate = useNavigate();
17
[a3ae097]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
[fd81a18]31 return (
[a3ae097]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>
[fd81a18]64 </div>
[a3ae097]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("_", " ")}
[fd81a18]100 </span>
101 </div>
[a3ae097]102 ))}
[fd81a18]103 </div>
[a3ae097]104 </div>
105 )}
106
[fd81a18]107 {contributions.length === 0 && (
[a3ae097]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>
[fd81a18]113 )}
114 </div>
115 );
116};
117
118export default ArtistView;
Note: See TracBrowser for help on using the repository browser.