started working on discover page

This commit is contained in:
X4Lo committed 2024-08-29 19:03:03 +01:00
1 parent 58edac7259
commit 92aedb65d0
13 files changed
+233 -3

No files matched your search

@@ -0,0 +1,8 @@
.title{
color: white;
font-weight: 900;
}
.tagline{
}
@@ -0,0 +1,24 @@
<!-- <app-two-lines-grid [entries]="popularEntries"></app-two-lines-grid> -->
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div *ngFor="let entry of trendingEntries; let i = index;" class="carousel-item" [ngClass]="{active: i == 0}"
data-bs-interval="10000">
<img [src]="'https://image.tmdb.org/t/p/w780' + entry.banner_path" class="d-block w-100">
<div class="carousel-caption d-none d-md-block text-white">
<h5 class="title">{{entry.title}}</h5>
<p class="tagline">{{entry.tagline}}</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-bs-slide="prev"> <span
class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-bs-slide="next"> <span
class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</a>
</div>
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DiscoverPageComponent } from './discover-page.component';
describe('DiscoverPageComponent', () => {
let component: DiscoverPageComponent;
let fixture: ComponentFixture<DiscoverPageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [DiscoverPageComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DiscoverPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,51 @@
import { Component, OnInit } from '@angular/core';
import { TmdbService } from '../../../core/services/tmdb.service';
import { Entry } from '../../../shared/models/entry.model';
import { forkJoin } from 'rxjs';
@Component({
selector: 'app-discover-page',
templateUrl: './discover-page.component.html',
styleUrl: './discover-page.component.css',
})
export class DiscoverPageComponent implements OnInit {
popularType: boolean = true;
trendingType: boolean = true;
popularEntries: Entry[] = [] as Entry[];
trendingEntries: Entry[] = [] as Entry[];
popularCurrentPage: number = 1;
trendingCurrentPage: number = 1;
trendingPeriod: string = 'day';
constructor(private tmdbService: TmdbService) {}
ngOnInit(): void {
let popularObs = this.tmdbService.getPopular(
this.popularCurrentPage,
this.popularType
);
let trendingObs = this.tmdbService.getTrending(
this.popularCurrentPage,
this.popularType,
this.trendingPeriod
);
const forkObs = forkJoin([popularObs, trendingObs]).subscribe({
next: ([popular, trending]) => {
this.popularEntries = popular;
this.trendingEntries = trending;
},
error: (error) => {
console.log(error);
},
complete: () => {
forkObs.unsubscribe();
},
});
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DiscoverPageComponent } from './discover-page/discover-page.component';
// ! /discover
const routes: Routes = [
{
path: '',
component: DiscoverPageComponent,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class DiscoverRoutingModule {}
@@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../shared/shared.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DiscoverRoutingModule } from './discover-routing.module';
import { DiscoverPageComponent } from './discover-page/discover-page.component';
@NgModule({
imports: [
CommonModule,
SharedModule,
FormsModule,
ReactiveFormsModule,
DiscoverRoutingModule,
],
declarations: [
DiscoverPageComponent
],
exports: [],
})
export class DiscoverModule {}
@@ -81,7 +81,7 @@
</select>
</div>
</div>
</div>
</div>
<!-- filter end -->