Renamed many components + started implementing lazy loading

This commit is contained in:
X4Lo committed 2024-04-05 22:12:05 +00:00
1 parent c8578ccf77
commit 60b517500f
80 files changed
+274 -242

No files matched your search

@@ -0,0 +1,19 @@
.list-item-1 {
padding-top: 1px;
}
.list-title{
font-size: 20px;
}
.list-title:hover {
color: var(--aruze-blue)
}
.list-line{
border-radius: 1px;
padding: 2px;
}
.list-line:hover {
background-color: aliceblue;
}
@@ -0,0 +1,11 @@
<div class="d-flex align-items-start gap-2 list-line" @fadeInOut>
<img [src]="getPostPath()" width="70" height="105" class="" alt="List poster" (click)="redirectTo()">
<div class="flex-grow-1 list-item-1">
<h6 class="mb-0 list-title" (click)="redirectTo()">{{list.name}}</h6>
<p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p>
<p class="mb-0">Contains: {{list.listEntries.length}} title(s)</p>
</div>
<!-- <div class="form-check form-check-inline me-0">
<input class="form-check-input ms-0" type="checkbox">
</div> -->
</div>
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionsListItemComponent } from './userCollections-list-item.component';
describe('UserCollectionsListItemComponent', () => {
let component: UserCollectionsListItemComponent;
let fixture: ComponentFixture<UserCollectionsListItemComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionsListItemComponent]
});
fixture = TestBed.createComponent(UserCollectionsListItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,49 @@
import { Component, Input} from '@angular/core';
import { UserCollection } from '../../../../shared/models/userCollection.model';
import { ListService } from '../../../../core/services/list.service';
import { Router } from '@angular/router';
import { trigger, transition, style, animate } from '@angular/animations';
@Component({
selector: 'app-userCollections-list-item',
templateUrl: './userCollections-list-item.component.html',
styleUrls: ['./userCollections-list-item.component.css'],
animations: [
trigger('fadeInOut', [
transition(':enter', [
// :enter is alias for 'void => *'
style({ opacity: 0 }),
animate('0.5s ease-out', style({ opacity: 1 })),
]),
transition(':leave', [
// :leave is alias for '* => void'
animate('0.5s ease-in', style({ opacity: 0 })),
]),
]),
],
})
export class UserCollectionsListItemComponent {
@Input() list!: UserCollection;
constructor(private listService: ListService, private router: Router) {}
getPostPath() {
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
return `https://image.tmdb.org/t/p/w500` + this.list.poster_path;
}
getCreatedDate(): string {
if (this.list.createdAt == null) return '';
return this.list.createdAt.toString();
}
redirectTo(): void {
this.router.navigate([`/lists/${this.list.id}`]);
}
deleteList() {
this.listService.deleteList(this.list.id);
}
}