ChandimaPrabath commited on
Commit
418a632
1 Parent(s): a67c433
frontend/next.config.mjs CHANGED
@@ -1,7 +1,7 @@
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  images: {
4
- domains: ['artworks.thetvdb.com','via.placeholder.com'],
5
  },
6
  };
7
 
 
1
  /** @type {import('next').NextConfig} */
2
  const nextConfig = {
3
  images: {
4
+ domains: ['artworks.thetvdb.com','via.placeholder.com','eu.ui-avatars.com'],
5
  },
6
  };
7
 
frontend/src/app/movie/[title]/page.js CHANGED
@@ -11,6 +11,7 @@ import {
11
  import { faBookmark as faBookmarkRegular } from "@fortawesome/free-regular-svg-icons";
12
  import apiClient from "@/api/apiClient";
13
  import { Spinner } from "@/components/Spinner";
 
14
 
15
  export default function MovieDetailsPage({ params }) {
16
  const [metadata, setMetadata] = useState(null);
@@ -65,7 +66,7 @@ export default function MovieDetailsPage({ params }) {
65
  )?.image;
66
 
67
  const genres = metadata?.data?.genres || [];
68
-
69
  return (
70
  <div className="movie-details-page">
71
  <div
@@ -150,6 +151,7 @@ export default function MovieDetailsPage({ params }) {
150
  {metadata?.data?.contentRatings?.[0]?.fullname || "Not Rated"}
151
  </p>
152
  </div>
 
153
  </div>
154
  </div>
155
  </div>
 
11
  import { faBookmark as faBookmarkRegular } from "@fortawesome/free-regular-svg-icons";
12
  import apiClient from "@/api/apiClient";
13
  import { Spinner } from "@/components/Spinner";
14
+ import CastSection from "@/components/CastSection";
15
 
16
  export default function MovieDetailsPage({ params }) {
17
  const [metadata, setMetadata] = useState(null);
 
66
  )?.image;
67
 
68
  const genres = metadata?.data?.genres || [];
69
+ const cast = metadata?.data?.characters || [];
70
  return (
71
  <div className="movie-details-page">
72
  <div
 
151
  {metadata?.data?.contentRatings?.[0]?.fullname || "Not Rated"}
152
  </p>
153
  </div>
154
+ <div className="movie-details-metadata"><CastSection cast={cast} /></div>
155
  </div>
156
  </div>
157
  </div>
frontend/src/components/CastSection.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .cast-section {
2
+ /* Your styles here */
3
+ }
4
+
5
+ .cast-list {
6
+ list-style: none;
7
+ padding: 0;
8
+ display: flex;
9
+ flex-wrap: wrap;
10
+ gap: 20px; /* Add space between items */
11
+ }
12
+
13
+ .cast-item {
14
+ margin: 0;
15
+ text-align: center;
16
+ width: 100px;
17
+ }
18
+
19
+ .image-container {
20
+ position: relative;
21
+ width: 100px;
22
+ height: 100px;
23
+ border-radius: 50%; /* Circular container */
24
+ overflow: hidden;
25
+ }
26
+
27
+ .cast-image {
28
+ border-radius: 50%; /* Circular images */
29
+ object-position: top;
30
+ }
31
+
32
+ .cast-name {
33
+ display: block;
34
+ margin-top: 8px;
35
+ font-weight: bold; /* Highlight the actor's name */
36
+ text-overflow: clip;
37
+ }
38
+
frontend/src/components/CastSection.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Image from "next/image";
2
+ import './CastSection.css';
3
+
4
+ const CastSection = ({ cast }) => {
5
+ return (
6
+ <div className="cast-section">
7
+ <strong>Cast:</strong>
8
+ {cast.length > 0 ? (
9
+ <ul className="cast-list">
10
+ {cast.map((profile) => (
11
+ <li key={profile.id} className="cast-item">
12
+ <div className="image-container">
13
+ <Image
14
+ src={profile.image || `https://eu.ui-avatars.com/api/?name=${profile.personName}&size=250`}
15
+ layout="fill"
16
+ objectFit="cover"
17
+ alt={`Profile picture of ${profile.personName}`}
18
+ className="cast-image"
19
+ />
20
+ </div>
21
+ <span className="cast-name">
22
+ {profile.personName} {profile.name ? `as ${profile.name}` : ""}
23
+ </span>
24
+ </li>
25
+ ))}
26
+ </ul>
27
+ ) : (
28
+ <p>Cast not available</p>
29
+ )}
30
+ </div>
31
+ );
32
+ };
33
+
34
+ export default CastSection;