From 1d349a5d485e8dc4daea86db7f3d399938bf844d Mon Sep 17 00:00:00 2001 From: X4Lo Date: Wed, 3 Apr 2024 21:40:36 +0000 Subject: [PATCH] add imdb link --- .../cards/main-card/main-card.component.css | 37 +++++++++---------- .../cards/main-card/main-card.component.html | 5 ++- .../cards/main-card/main-card.component.ts | 25 +++++++------ 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/frontend/src/app/features/cards/main-card/main-card.component.css b/frontend/src/app/features/cards/main-card/main-card.component.css index 8f18a85..6136304 100644 --- a/frontend/src/app/features/cards/main-card/main-card.component.css +++ b/frontend/src/app/features/cards/main-card/main-card.component.css @@ -1,42 +1,39 @@ - .movie-card { cursor: pointer; - display: flex; /* Makes sure the card stretches in flex container */ + display: flex; flex-direction: column; } .movie-card .card-head { position: relative; border-radius: 10px; - height: auto; /* If you set a fixed height, ensure it allows for the aspect ratio */ + height: auto; overflow: hidden; margin-bottom: 15px; } .movie-card .card-img { - width: 100%; /* Ensure the image covers the width */ - height: auto; /* Height should adjust automatically */ - aspect-ratio: 2 / 3; /* Set the aspect ratio to 2:3 */ - object-fit: cover; /* Cover the container without losing aspect ratio */ + width: 100%; + height: auto; + aspect-ratio: 2 / 3; + object-fit: cover; transition: transform 0.3s ease; } -/* Update styles for card-body, card-title, and card-info based on the new layout */ .movie-card .card-body { position: absolute; bottom: 0; left: 0; width: 100%; - background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */ + background: rgba(0, 0, 0, 0.5); color: #fff; padding: 10px; box-sizing: border-box; - transition: max-height 0.3s ease, padding 0.3s ease; /* Smooth transition for height and padding */ - overflow: hidden; /* Hide overflow by default */ - max-height: 60px; /* Adjust based on your default card body height */ + transition: max-height 0.3s ease, padding 0.3s ease; + overflow: hidden; + max-height: 60px; } - /* * HOVER */ .movie-card:hover .card-img { transform: scale(1.1); @@ -54,8 +51,8 @@ } .movie-card:hover .card-body { - max-height: 100px; /* Adjust based on the needed height to show the full title */ - padding: 12px; /* Increase padding if desired */ + max-height: 100px; + padding: 12px; } .movie-card:hover .card-title { white-space: normal; @@ -102,9 +99,9 @@ } .bookmark, .info { - display: flex; /* Use Flexbox */ - justify-content: center; /* Center horizontally */ - align-items: center; /* Center vertically */ + display: flex; + justify-content: center; + align-items: center; } /* ? rating */ @@ -144,11 +141,13 @@ .movie-card:hover .card-title, .movie-card:hover .card-info { - /* color: var(--light-azure); */ text-overflow: clip; color: var(--white); } +.movie-card:hover .card-title { + color: var(--yellow); +} .movie-card .card-info { display: flex; font-family: -apple-system, "Segoe UI", BlinkMacSystemFont, sans-serif; diff --git a/frontend/src/app/features/cards/main-card/main-card.component.html b/frontend/src/app/features/cards/main-card/main-card.component.html index ce2f10f..7079ca2 100644 --- a/frontend/src/app/features/cards/main-card/main-card.component.html +++ b/frontend/src/app/features/cards/main-card/main-card.component.html @@ -23,8 +23,9 @@
- -

{{ entry.title }}

+ +

{{ entry.title }}

+
{{releaseYear}} diff --git a/frontend/src/app/features/cards/main-card/main-card.component.ts b/frontend/src/app/features/cards/main-card/main-card.component.ts index ab0373a..c7c382e 100644 --- a/frontend/src/app/features/cards/main-card/main-card.component.ts +++ b/frontend/src/app/features/cards/main-card/main-card.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { Entry } from '../../../shared/models/entry.model'; import { LibraryService } from '../../../core/services/library.service'; -import { ListSelectionModalComponent } from '../../../list-selection-modal/list-selection-modal.component'; +import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component'; import { MatDialog } from '@angular/material/dialog'; @Component({ @@ -70,25 +70,28 @@ export class MainCardComponent implements OnInit { }); } - logEntry() { - console.log(this.entry); - } - showAddToListModal() { if (this.entry) { - console.log("entry exist"); const dialogRef = this.dialog.open(ListSelectionModalComponent, { - width: '500px', - height: '300px', + width: '400px', + height: '55%', data: { - /* données que vous pourriez vouloir passer */ + entryId: this.entry.id, }, }); dialogRef.afterClosed().subscribe((result) => { - console.log('Le dialogue a été fermé', result); - // Traitez le résultat ici (par exemple, ajoutez la sélection à une liste) + console.log('Modal Closed: ', result); }); } } + + logEntry() { + console.log(this.entry); + } + + getTmdbLink() { + let type = this.entry.is_tvseries ? 'tv' : 'movie'; + return `https://www.themoviedb.org/${type}/${this.entry.entryId.tmdb_id}`; + } }