Renamed many components + started implementing lazy loading
This commit is contained in:
1 parent
c8578ccf77
commit
60b517500f
80 files changed
+274
-242
No files matched your search
+19
@@ -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;
|
||||
}
|
||||
+11
@@ -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>
|
||||
+21
@@ -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();
|
||||
});
|
||||
});
|
||||
+49
@@ -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);
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
+40
@@ -0,0 +1,40 @@
|
||||
<!--breadcrumb-->
|
||||
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
|
||||
<div class="breadcrumb-title pe-3">Library</div>
|
||||
<div class="ps-3">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-0 p-0">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="javascript:;">
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">Lists</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<!--end breadcrumb-->
|
||||
|
||||
<div>
|
||||
<div class="col d-flex ">
|
||||
<div class="card w-100">
|
||||
<div class="card-header border-0 p-3 border-bottom">
|
||||
<div class="position-relative">
|
||||
<input [formControl]="searchControl" matInput class="form-control rounded-5 px-5" type="text"
|
||||
placeholder="Search">
|
||||
<span class="material-icons-outlined position-absolute ms-3 translate-middle-y start-0 top-50">search</span>
|
||||
<!-- <span class="material-icons-outlined position-absolute me-3 translate-middle-y end-0 top-50">Library</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="p-3 ps ps--active-y">
|
||||
<div class="d-flex flex-column gap-3">
|
||||
<!-- item start -->
|
||||
<app-userCollections-list-item *ngFor="let list of listsToShow" [list]="list"></app-userCollections-list-item>
|
||||
<!-- item end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserCollectionsPageComponent } from './userCollections-page.component';
|
||||
|
||||
describe('UserCollectionsPageComponent', () => {
|
||||
let component: UserCollectionsPageComponent;
|
||||
let fixture: ComponentFixture<UserCollectionsPageComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [UserCollectionsPageComponent],
|
||||
});
|
||||
fixture = TestBed.createComponent(UserCollectionsPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||
import { ListService } from '../../../../core/services/list.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-userCollections-page',
|
||||
templateUrl: './userCollections-page.component.html',
|
||||
styleUrls: ['./userCollections-page.component.css'],
|
||||
})
|
||||
export class UserCollectionsPageComponent implements OnInit {
|
||||
searchControl = new FormControl('');
|
||||
showAddButton: boolean = false;
|
||||
listsCount: number = 0;
|
||||
|
||||
lists: UserCollection[] = [];
|
||||
listsToShow: UserCollection[] = [];
|
||||
|
||||
constructor(private listService: ListService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.getLists();
|
||||
this.searchControl.valueChanges.subscribe(() => {
|
||||
this.applyFilter();
|
||||
});
|
||||
}
|
||||
|
||||
getLists() {
|
||||
this.listService.getLists().subscribe({
|
||||
next: (l) => {
|
||||
console.log(`Loaded ${l.length} lists.`);
|
||||
this.lists = l;
|
||||
this.listsToShow = this.lists;
|
||||
this.applyFilter();
|
||||
},
|
||||
error: (error) => {
|
||||
console.log("Counldn't get lists from backend.");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
applyFilter() {
|
||||
let filterValue = this.searchControl.value;
|
||||
if (filterValue == null) {
|
||||
this.listsToShow = [...this.lists];
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedFilter = filterValue.toLowerCase().trim();
|
||||
|
||||
this.listsToShow = this.lists.filter((collection) =>
|
||||
collection.name.toLowerCase().trim().includes(normalizedFilter)
|
||||
);
|
||||
this.listsCount = this.listsToShow.length;
|
||||
}
|
||||
|
||||
createList() {
|
||||
// const listName = this.searchControl.value; // string
|
||||
// let myNewList = { name: listName } as List;
|
||||
// this.listService.createList(myNewList).subscribe(async (list) => {
|
||||
// await this.getLists();
|
||||
// });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user