-
New Releases
+
Added in the last 7 days
- @for (movie of movies; track movie) {
+ @for (movie of recentMovies(); track movie) {

@@ -12,19 +14,23 @@
}
+
+ @for (filmGenre of filmGenres; track filmGenre) {
+
+ @if (allMovies(filmGenre).length > 0) {
-
-
-
Science Fiction & Fantasy
-
-
-
-
All Other Categories
+
{{ filmGenre }}
+
+ @for (movie of allMovies(filmGenre); track movie) {
+
+

+
+ }
+
+ } }
diff --git a/frontend/src/app/components/home/browse/categories/categories.component.scss b/frontend/src/app/components/home/browse/categories/categories.component.scss
index 82a1f0c..0e11e20 100644
--- a/frontend/src/app/components/home/browse/categories/categories.component.scss
+++ b/frontend/src/app/components/home/browse/categories/categories.component.scss
@@ -3,6 +3,7 @@
section {
height: 60%;
padding: 0 48px;
+ margin-top: 12px;
}
.category {
@@ -34,6 +35,10 @@ section {
}
}
+.selected {
+ border: 2px solid $blue !important;
+}
+
// Hide scrollbar
.hide-scrollbar {
diff --git a/frontend/src/app/components/home/browse/categories/categories.component.ts b/frontend/src/app/components/home/browse/categories/categories.component.ts
index cd2c08c..235119f 100644
--- a/frontend/src/app/components/home/browse/categories/categories.component.ts
+++ b/frontend/src/app/components/home/browse/categories/categories.component.ts
@@ -1,21 +1,54 @@
+import { CommonModule } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'app-categories',
standalone: true,
- imports: [],
+ imports: [CommonModule],
templateUrl: './categories.component.html',
styleUrl: './categories.component.scss',
})
export class CategoriesComponent {
@Input() movies: any[] = [];
+ @Input() currentMovie: number = 0;
@Output() currentMovieId = new EventEmitter
();
+ filmGenres = [
+ 'Action',
+ 'Adventure',
+ 'Comedy',
+ 'Drama',
+ 'Horror',
+ 'Science Fiction',
+ 'Fantasy',
+ 'Romance',
+ 'Thriller',
+ 'Mystery',
+ 'Crime',
+ 'Animation',
+ 'Documentary',
+ 'Musical',
+ 'War',
+ 'Western',
+ ];
+
openCurrentMovie(movieId: number) {
+ this.currentMovie = movieId;
this.currentMovieId.emit(movieId);
}
- get documentaryMovies() {
- return this.movies.filter((movie) => movie.category === 'documentary');
+ allMovies(filmGenre: string) {
+ return this.movies.filter((movie) => movie.category === filmGenre);
+ }
+
+ recentMovies() {
+ const today = new Date();
+ const sevenDaysAgo = new Date(today);
+ sevenDaysAgo.setDate(today.getDate() - 7);
+
+ return this.movies.filter((movie) => {
+ const movieDate = new Date(movie.create);
+ return movieDate >= sevenDaysAgo;
+ });
}
}