Front: renamed most collection related files

This commit is contained in:
X4Lo committed 2024-09-13 22:23:41 +01:00
1 parent 75de013f82
commit 8724a96b81
55 files changed
+294 -394

No files matched your search

@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionGridCardComponent } from './userCollection-grid-card.component';
import { CollectionEntryCardComponent } from './collection-entry-card.component';
describe('UserCollectionGridCardComponent', () => {
let component: UserCollectionGridCardComponent;
let fixture: ComponentFixture<UserCollectionGridCardComponent>;
let component: CollectionEntryCardComponent;
let fixture: ComponentFixture<CollectionEntryCardComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionGridCardComponent]
declarations: [CollectionEntryCardComponent]
});
fixture = TestBed.createComponent(UserCollectionGridCardComponent);
fixture = TestBed.createComponent(CollectionEntryCardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -2,15 +2,15 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Entry } from '../../../../shared/models/entry.model';
import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
@Component({
selector: 'app-userCollection-grid-card',
templateUrl: './userCollection-grid-card.component.html',
styleUrls: ['./userCollection-grid-card.component.css'],
selector: 'app-collection-entry-card',
templateUrl: './collection-entry-card.component.html',
styleUrls: ['./collection-entry-card.component.css'],
animations: [
trigger('fadeInOut', [
transition(':enter', [
@@ -21,13 +21,13 @@ import { environment } from '../../../../../environments/environment.prod';
]),
],
})
export class UserCollectionGridCardComponent implements OnInit {
export class CollectionEntryCardComponent implements OnInit {
@Input() entry!: Entry;
@Input() collectionId: string = '';
@Input() collectionId!: number;
@Output() refrechEvent = new EventEmitter();
constructor(
private userCollectionService: CollectionService,
private collectionService: CollectionService,
public dialog: MatDialog,
private router: Router
) {}
@@ -90,7 +90,7 @@ export class UserCollectionGridCardComponent implements OnInit {
if (result) {
if (result.confirmed != true) return;
this.userCollectionService
this.collectionService
.removeEntryFromCollection(this.collectionId, this.entry.id)
.subscribe({
next: (response) => {
@@ -0,0 +1,7 @@
<div class="movies-container">
<ng-container *ngFor="let entry of entries">
<app-collection-entry-card [entry]="entry" [collectionId]="collectionId" (refrechEvent)="refrechEventReceiver()"
@animateDestroy>
</app-collection-entry-card>
</ng-container>
</div>
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionEntryGridComponent } from './userCollection-entry-grid.component';
import { CollectionEntryGridComponent } from './collection-entry-grid.component';
describe('UserCollectionEntryGridComponent', () => {
let component: UserCollectionEntryGridComponent;
let fixture: ComponentFixture<UserCollectionEntryGridComponent>;
let component: CollectionEntryGridComponent;
let fixture: ComponentFixture<CollectionEntryGridComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionEntryGridComponent]
declarations: [CollectionEntryGridComponent]
});
fixture = TestBed.createComponent(UserCollectionEntryGridComponent);
fixture = TestBed.createComponent(CollectionEntryGridComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -10,9 +10,9 @@ import {
} from '@angular/animations';
@Component({
selector: 'app-userCollection-entry-grid',
templateUrl: './userCollection-entry-grid.component.html',
styleUrls: ['./userCollection-entry-grid.component.css'],
selector: 'app-collection-entry-grid',
templateUrl: './collection-entry-grid.component.html',
styleUrls: ['./collection-entry-grid.component.css'],
animations: [
trigger('animateDestroy', [
state('void', style({ opacity: '0' })),
@@ -20,9 +20,9 @@ import {
]),
],
})
export class UserCollectionEntryGridComponent {
export class CollectionEntryGridComponent {
@Input() entries: Entry[] = [];
@Input() collectionId: string = '';
@Input() collectionId!: number;
refrechEventReceiver() {
console.log('event recieved');
@@ -1,18 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CollectionTableLineComponent } from './collection-table-line.component';
import { CollectionEntryLineComponent } from './collection-entry-line.component';
describe('CollectionTableLineComponent', () => {
let component: CollectionTableLineComponent;
let fixture: ComponentFixture<CollectionTableLineComponent>;
let component: CollectionEntryLineComponent;
let fixture: ComponentFixture<CollectionEntryLineComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CollectionTableLineComponent]
imports: [CollectionEntryLineComponent]
})
.compileComponents();
fixture = TestBed.createComponent(CollectionTableLineComponent);
fixture = TestBed.createComponent(CollectionEntryLineComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -7,18 +7,17 @@ import {
ViewEncapsulation,
} from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { LibraryService } from '../../../../core/services/library.service';
import { Entry } from '../../../../shared/models/entry.model';
import { trigger, transition, style, animate } from '@angular/animations';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { environment } from '../../../../../environments/environment.prod';
@Component({
selector: 'tr [app-collection-table-line]',
templateUrl: './collection-table-line.component.html',
styleUrl: './collection-table-line.component.css',
selector: 'tr [app-collection-entry-line]',
templateUrl: './collection-entry-line.component.html',
styleUrl: './collection-entry-line.component.css',
encapsulation: ViewEncapsulation.None,
animations: [
trigger('fadeInOut', [
@@ -30,21 +29,18 @@ import { environment } from '../../../../../environments/environment.prod';
]),
],
})
export class CollectionTableLineComponent implements OnInit {
export class CollectionEntryLineComponent implements OnInit {
@Input() entry!: Entry;
@Input() listId: string = '';
@Input() collectionId!: number;
@Output() refrechEvent = new EventEmitter();
constructor(
private libraryService: LibraryService,
private userCollectionService: CollectionService,
private collectionService: CollectionService,
public dialog: MatDialog,
private router: Router
) {}
ngOnInit(): void {
}
ngOnInit(): void {}
get releaseYear(): number {
return new Date(this.entry.release_date).getFullYear();
@@ -72,14 +68,13 @@ export class CollectionTableLineComponent implements OnInit {
(m) => m.type == 'logo' && m.isSelected
);
if (
selectedLogos.length &&
selectedLogos[0] &&
selectedLogos[0].path
) {
if (selectedLogos.length && selectedLogos[0] && selectedLogos[0].path) {
const name = selectedLogos[0].path.split('.')[0];
const extention = selectedLogos[0].path.split('.')[1];
return environment.API_URL + `/media/entries/logos/original/${name}.${extention}`;
return (
environment.API_URL +
`/media/entries/logos/original/${name}.${extention}`
);
}
}
@@ -101,19 +96,18 @@ export class CollectionTableLineComponent implements OnInit {
if (result) {
if (result.confirmed != true) return;
this.userCollectionService
.removeEntryFromCollection(this.listId, this.entry.id)
this.collectionService
.removeEntryFromCollection(this.collectionId, this.entry.id)
.subscribe({
next: (response) => {
// TODO confirm notification
console.log('Entry successfully removed from list.', response);
// TODO TOAST: entry removed from collection
// console.log('Entry successfully removed from collection.', response);
this.entry.id = 0;
this.entry.isInLibrary = false;
},
error: (error) => {
// TODO error notification
console.error('Error removing entry from list:', error);
console.error('Error removing entry from collection:', error);
},
});
}
@@ -1,11 +1,3 @@
<!-- <div class="movies-container" cdkDropList [cdkDropListData]="entries" (cdkDropListDropped)="drop($any($event))">
<ng-container>
<app-userCollection-grid-card cdkDrag [entry]="entry" [listId]="listId" (refrechEvent)="refrechEventReceiver()"
@animateDestroy>
</app-userCollection-grid-card>
</ng-container>
</div> -->
<div class="card mt-4">
<div class="card-body">
<div class="product-table">
@@ -30,8 +22,7 @@
<tbody cdkDropList [cdkDropListData]="entries" (cdkDropListDropped)="drop($any($event))">
<!-- * table body start -->
<ng-container *ngFor="let entry of entries">
<tr app-collection-table-line cdkDrag [entry]="entry"></tr>
<!-- <app-collection-table-line cdkDrag [entry]="entry"></app-collection-table-line> -->
<tr app-collection-entry-line cdkDrag [entry]="entry" [collectionId]="collectionId"></tr>
</ng-container>
<!-- + table body end -->
</tbody>
@@ -1,6 +1,6 @@
import { Component, Input } from '@angular/core';
import { Entry } from '../../../../shared/models/entry.model';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { CollectionService } from '../../../../core/services/collection.service';
import {
CdkDragDrop,
CdkDragEnd,
@@ -28,9 +28,9 @@ import {
})
export class CollectionEntryTableComponent {
@Input() entries: Entry[] = [];
@Input() collectionId: string = '';
@Input() collectionId!: number;
constructor(private userCollectionService: CollectionService) {}
constructor(private collectionService: CollectionService) {}
refrechEventReceiver() {
console.log('event recieved');
@@ -40,7 +40,7 @@ export class CollectionEntryTableComponent {
moveItemInArray(this.entries, event.previousIndex, event.currentIndex);
if (event.previousIndex != event.currentIndex) {
this.userCollectionService
this.collectionService
.updateEntryOrder(
this.collectionId,
this.entries[event.currentIndex].id,
@@ -58,14 +58,14 @@
<!-- ! grid -->
<div id="gridDiv" *ngIf="viewMode == 'grid'">
<h1 *ngIf="screenMode">{{collection.name}}</h1>
<app-userCollection-entry-grid [entries]="collection.entries"
[collectionId]="getListId()"></app-userCollection-entry-grid>
<app-collection-entry-grid [entries]="collection.entries"
[collectionId]="this.collection.id"></app-collection-entry-grid>
</div>
<!-- ! table -->
<div *ngIf="viewMode == 'table'">
<app-collection-entry-table [entries]="collection.entries"
[collectionId]="getListId()"></app-collection-entry-table>
[collectionId]="this.collection.id"></app-collection-entry-table>
</div>
</div>
</div>
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionInfoPageComponent } from './userCollection-info-page.component';
import { CollectionInfoPageComponent } from './collection-info-page.component';
describe('UserCollectionInfoPageComponent', () => {
let component: UserCollectionInfoPageComponent;
let fixture: ComponentFixture<UserCollectionInfoPageComponent>;
let component: CollectionInfoPageComponent;
let fixture: ComponentFixture<CollectionInfoPageComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionInfoPageComponent],
declarations: [CollectionInfoPageComponent],
});
fixture = TestBed.createComponent(UserCollectionInfoPageComponent);
fixture = TestBed.createComponent(CollectionInfoPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -1,22 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { UserCollection } from '../../../../shared/models/userCollection.model';
import { CollectionService } from '../../../../core/services/collection.service';
import { Collection } from '../../../../shared/models/collection.model';
import { DatePipe } from '@angular/common';
import { CollectionEntry } from '../../../../shared/models/dtos/collection-entry.dto';
import { CollectionEditModalComponent } from '../collection-edit-modal/collection-edit-modal.component';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmModalComponent } from '../../../../shared/components/modals/confirm-modal/confirm-modal.component';
import { ScreenshotService } from '../../../../core/services/screenshot.service';
import { CollectionEntryDTO } from '../../../../shared/models/dtos/collection-entry-dto.model';
@Component({
selector: 'app-userCollection-info-page',
templateUrl: './userCollection-info-page.component.html',
styleUrls: ['./userCollection-info-page.component.css'],
selector: 'app-collection-info-page',
templateUrl: './collection-info-page.component.html',
styleUrls: ['./collection-info-page.component.css'],
providers: [DatePipe],
})
export class UserCollectionInfoPageComponent implements OnInit {
collection: UserCollection = {} as UserCollection;
export class CollectionInfoPageComponent implements OnInit {
collection: Collection = {} as Collection;
createdAt: string = '';
updatedAt: string = '';
@@ -25,7 +25,7 @@ export class UserCollectionInfoPageComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private userCollectionService: CollectionService,
private collectionService: CollectionService,
private screenshotService: ScreenshotService,
private datePipe: DatePipe,
public dialog: MatDialog,
@@ -36,10 +36,10 @@ export class UserCollectionInfoPageComponent implements OnInit {
const id = this.route.snapshot.paramMap.get('id');
if (id == null) return; // todo redirect if no id is provided
this.userCollectionService.getCollection(id.toString()).subscribe({
this.collectionService.getCollection(id.toString()).subscribe({
next: (data) => {
this.collection = data as unknown as UserCollection;
this.collection.entries = this.collection.entries as CollectionEntry[];
this.collection = data as unknown as Collection;
this.collection.entries = this.collection.entries as CollectionEntryDTO[];
this.createdAt = this.getCreatedDate()?.toString() || '';
this.updatedAt = this.getUpdatedAt()?.toString() || '';
@@ -119,18 +119,17 @@ export class UserCollectionInfoPageComponent implements OnInit {
if (result) {
if (result.formData == null) return;
this.userCollectionService
this.collectionService
.updateCollection(this.collection.id, result.formData)
.subscribe({
next: (userCollection) => {
if (userCollection) {
// TODO confirm notification
// console.log(`User Collection updated: `, userCollection);
this.collection = userCollection;
next: (result) => {
if (result) {
// TODO TOAST collection update
this.collection = result;
}
},
error: (error) => {
console.error('Error updating userCollection:', error);
console.error('Error updating collection:', error);
// TODO error notification
},
});
@@ -159,7 +158,7 @@ export class UserCollectionInfoPageComponent implements OnInit {
if (result) {
if (result.confirmed != true) return;
this.userCollectionService
this.collectionService
.deleteCollection(this.collection.id)
.subscribe({
next: () => {
@@ -167,7 +166,7 @@ export class UserCollectionInfoPageComponent implements OnInit {
this.router.navigate(['/collections']);
},
error: (error) => {
console.error('Error updating userCollection:', error);
console.error('Error updating collection:', error);
// TODO error notification
},
});
@@ -210,10 +209,10 @@ export class UserCollectionInfoPageComponent implements OnInit {
}
refreshCollection() {
this.userCollectionService.refreshCollection(this.collection.id).subscribe({
this.collectionService.refreshCollection(this.collection.id).subscribe({
next: (data) => {
this.collection = data as unknown as UserCollection;
this.collection.entries = this.collection.entries as CollectionEntry[];
this.collection = data as unknown as Collection;
this.collection.entries = this.collection.entries as CollectionEntryDTO[];
this.createdAt = this.getCreatedDate()?.toString() || '';
this.updatedAt = this.getUpdatedAt()?.toString() || '';
@@ -229,13 +228,13 @@ export class UserCollectionInfoPageComponent implements OnInit {
}
getCollectionParts() {
this.userCollectionService
this.collectionService
.getCollectionParts(this.collection.id)
.subscribe({
next: (data) => {
this.collection = data as unknown as UserCollection;
this.collection = data as unknown as Collection;
this.collection.entries = this.collection
.entries as CollectionEntry[];
.entries as CollectionEntryDTO[];
this.createdAt = this.getCreatedDate()?.toString() || '';
this.updatedAt = this.getUpdatedAt()?.toString() || '';
@@ -1,17 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { UserCollectionsPageComponent } from './user-collections/userCollections-page/userCollections-page.component';
import { UserCollectionInfoPageComponent } from './user-collection-info/userCollection-info-page/userCollection-info-page.component';
import { CollectionsPageComponent } from './collections/collections-page/collections-page.component';
import { CollectionInfoPageComponent } from './collection-info/collection-info-page/collection-info-page.component';
// ! /user-collections
// ! /collections
const routes: Routes = [
{
path: '',
component: UserCollectionsPageComponent
component: CollectionsPageComponent
},
{
path: ':id',
component: UserCollectionInfoPageComponent
component: CollectionInfoPageComponent
}
];
@@ -0,0 +1,50 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../shared/shared.module';
import { CollectionsRoutingModule } from './collections-routing.module';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { CollectionsPageComponent } from './collections/collections-page/collections-page.component';
import { CollectionCardComponent } from './collections/collection-card/collection-card.component';
import { CollectionEntryGridComponent } from './collection-info/collection-entry-grid/collection-entry-grid.component';
import { CollectionEntryCardComponent } from './collection-info/collection-entry-card/collection-entry-card.component';
import { CollectionInfoPageComponent } from './collection-info/collection-info-page/collection-info-page.component';
import { UserCollectionsModalComponent } from '../../shared/components/modals/list-selection-modal/user-collections-modal.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CollectionEntryTableComponent } from './collection-info/collection-entry-table/collection-entry-table.component';
import { CollectionEntryLineComponent } from './collection-info/collection-entry-line/collection-entry-line.component';
import { CollectionEditModalComponent } from './collection-info/collection-edit-modal/collection-edit-modal.component';
@NgModule({
imports: [
CommonModule,
SharedModule,
FormsModule,
ReactiveFormsModule,
CollectionsRoutingModule,
DragDropModule,
],
declarations: [
// collections list page
CollectionsPageComponent,
CollectionCardComponent,
// collection info page
CollectionInfoPageComponent,
CollectionEntryGridComponent,
CollectionEntryCardComponent,
CollectionEntryTableComponent,
CollectionEntryLineComponent,
CollectionEditModalComponent,
UserCollectionsModalComponent,
],
exports: [],
})
export class CollectionsModule {}
@@ -5,7 +5,7 @@
<div class="list-item-1 mt-2 text-center">
<h6 class="mb-0 list-title" (click)="redirectTo()">{{collection.name}}</h6>
<!-- <p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p> -->
<!-- <p class="mb-0">Contains: {{list.userCollectionEntries.length}} title(s)</p> -->
<!-- <p class="mb-0">Contains: {{list.collectionEntries.length}} title(s)</p> -->
</div>
</div>
</div>
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionsListItemComponent } from './userCollections-list-item.component';
import { CollectionCardComponent } from './collection-card.component';
describe('UserCollectionsListItemComponent', () => {
let component: UserCollectionsListItemComponent;
let fixture: ComponentFixture<UserCollectionsListItemComponent>;
let component: CollectionCardComponent;
let fixture: ComponentFixture<CollectionCardComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionsListItemComponent]
declarations: [CollectionCardComponent]
});
fixture = TestBed.createComponent(UserCollectionsListItemComponent);
fixture = TestBed.createComponent(CollectionCardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -0,0 +1,45 @@
import { Component, Input } from '@angular/core';
import { Collection } from '../../../../shared/models/collection.model';
import { CollectionService } from '../../../../core/services/collection.service';
import { Router } from '@angular/router';
import { trigger, transition, style, animate } from '@angular/animations';
import { environment } from '../../../../../environments/environment.prod';
import { Entry } from '../../../../shared/models/entry.model';
@Component({
selector: 'app-collection-card',
templateUrl: './collection-card.component.html',
styleUrls: ['./collection-card.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 CollectionCardComponent {
@Input() collection!: Collection;
constructor(private listService: CollectionService, private router: Router) {}
getCreatedDate(): string {
if (this.collection.createdAt == null) return '';
return this.collection.createdAt.toString();
}
redirectTo(): void {
this.router.navigate([`/collections/${this.collection.id}`]);
}
deleteList() {
this.listService.deleteCollection(this.collection.id);
}
}
@@ -46,8 +46,8 @@
<div class="card-body p-0">
<div class="collections-container">
<app-userCollections-list-item *ngFor="let collection of collectionsToShow" [collection]="collection"
@animateDestroy></app-userCollections-list-item>
<app-collection-card *ngFor="let collection of collectionsToShow" [collection]="collection"
@animateDestroy></app-collection-card>
</div>
</div>
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserCollectionsPageComponent } from './userCollections-page.component';
import { CollectionsPageComponent } from './collections-page.component';
describe('UserCollectionsPageComponent', () => {
let component: UserCollectionsPageComponent;
let fixture: ComponentFixture<UserCollectionsPageComponent>;
let component: CollectionsPageComponent;
let fixture: ComponentFixture<CollectionsPageComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserCollectionsPageComponent],
declarations: [CollectionsPageComponent],
});
fixture = TestBed.createComponent(UserCollectionsPageComponent);
fixture = TestBed.createComponent(CollectionsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { UserCollection } from '../../../../shared/models/userCollection.model';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { Collection } from '../../../../shared/models/collection.model';
import { CollectionService } from '../../../../core/services/collection.service';
import {
animate,
state,
@@ -13,9 +13,9 @@ import { Entry } from '../../../../shared/models/entry.model';
import { environment } from '../../../../../environments/environment.prod';
@Component({
selector: 'app-userCollections-page',
templateUrl: './userCollections-page.component.html',
styleUrls: ['./userCollections-page.component.css'],
selector: 'app-collections-page',
templateUrl: './collections-page.component.html',
styleUrls: ['./collections-page.component.css'],
animations: [
trigger('animateDestroy', [
state('void', style({ opacity: '0' })),
@@ -23,13 +23,13 @@ import { environment } from '../../../../../environments/environment.prod';
]),
],
})
export class UserCollectionsPageComponent implements OnInit {
export class CollectionsPageComponent implements OnInit {
searchControl = new FormControl('');
showAddButton: boolean = false;
collectionsCount: number = 0;
collections: UserCollection[] = [];
collectionsToShow: UserCollection[] = [];
collections: Collection[] = [];
collectionsToShow: Collection[] = [];
collectionType: string = 'All';
lockActions: boolean = false;
@@ -96,7 +96,7 @@ export class UserCollectionsPageComponent implements OnInit {
this.lockActions = true;
// TODO add create collection from the collections list page
const listName = this.searchControl.value;
let myNewList = { name: listName } as UserCollection;
let myNewList = { name: listName } as Collection;
this.collectionsService.createCollection(myNewList).subscribe({
next: (collection) => {
this.collections.push(collection);
@@ -123,7 +123,7 @@ export class UserCollectionsPageComponent implements OnInit {
);
}
getCollectionPosterPath(collection: UserCollection) {
getCollectionPosterPath(collection: Collection) {
if (collection.medias && collection.medias.length != 0) {
const selectedPosters = collection.medias.filter(
(m) => m.type == 'poster' && m.isSelected
@@ -154,7 +154,7 @@ export class UserCollectionsPageComponent implements OnInit {
}
}
getCollectionBakcgroundPath(collection: UserCollection) {
getCollectionBakcgroundPath(collection: Collection) {
return `https://www.themoviedb.org/w1280/${collection.backdropPath}`;
}
@@ -1,7 +0,0 @@
<div class="movies-container">
<ng-container *ngFor="let entry of entries">
<app-userCollection-grid-card [entry]="entry" [collectionId]="collectionId" (refrechEvent)="refrechEventReceiver()"
@animateDestroy>
</app-userCollection-grid-card>
</ng-container>
</div>
@@ -1,49 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../shared/shared.module';
import { CollectionsRoutingModule } from './collections-routing.module';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { UserCollectionsPageComponent } from './user-collections/userCollections-page/userCollections-page.component';
import { UserCollectionsListItemComponent } from './user-collections/userCollection-list-item/userCollections-list-item.component';
import { UserCollectionEntryGridComponent } from './user-collection-info/userCollection-entry-grid/userCollection-entry-grid.component';
import { UserCollectionGridCardComponent } from './user-collection-info/userCollection-grid-card/userCollection-grid-card.component';
import { UserCollectionInfoPageComponent } from './user-collection-info/userCollection-info-page/userCollection-info-page.component';
import { UserCollectionsModalComponent } from '../../shared/components/modals/list-selection-modal/user-collections-modal.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CollectionEntryTableComponent } from './user-collection-info/collection-entry-table/collection-entry-table.component';
import { CollectionTableLineComponent } from './user-collection-info/collection-table-line/collection-table-line.component';
@NgModule({
imports: [
CommonModule,
SharedModule,
FormsModule,
ReactiveFormsModule,
CollectionsRoutingModule,
DragDropModule,
],
declarations: [
// collections list page
UserCollectionsPageComponent,
UserCollectionsListItemComponent,
// collection info page
UserCollectionInfoPageComponent,
UserCollectionEntryGridComponent,
UserCollectionGridCardComponent,
CollectionEntryTableComponent,
CollectionTableLineComponent,
UserCollectionsModalComponent,
],
exports: [],
})
export class UserCollectionsModule {}
@@ -1,127 +0,0 @@
import { Component, Input } from '@angular/core';
import { UserCollection } from '../../../../shared/models/userCollection.model';
import { CollectionService } from '../../../../core/services/userCollection.service';
import { Router } from '@angular/router';
import { trigger, transition, style, animate } from '@angular/animations';
import { environment } from '../../../../../environments/environment.prod';
import { Entry } from '../../../../shared/models/entry.model';
@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() collection!: UserCollection;
constructor(private listService: CollectionService, private router: Router) {}
// getCollectionPosterPath() {
// console.log(this.collection.medias);
// if (this.collection.medias.length != 0) {
// const selectedPosters = this.collection.medias.filter(
// (m) => m.type == 'poster' && m.isSelected
// );
// let selectedPoster;
// if (selectedPosters.length != 0) {
// selectedPoster = selectedPosters[0].path;
// } else {
// selectedPoster = this.collection.medias[0].path;
// }
// return (
// environment.API_URL +
// `/media/collections/posters/preview/${selectedPoster}`
// );
// } else if (this.collection.entries.length != 0) {
// // * use the poster of the first entry in the collection
// // * if the collection is empty
// return this.getEntryPosterPath(this.collection.entries[0]);
// } else if (this.collection.posterPath) {
// // * use first remote tmdb poster
// // * if collection has none and has no entry
// return `https://www.themoviedb.org/w1280/${this.collection.posterPath}`;
// } else {
// // * use default poster
// // * if collection has totaly no poster
// return 'assets/images/default/default-poster.png';
// }
// }
// getCollectionBakcgroundPath() {
// return `https://www.themoviedb.org/w1280/${this.collection.backdropPath}`;
// // if (this.list.isLocal) {
// // if (this.list.backdropPath == null)
// // return 'assets/images/default/default-poster.png';
// // // * use the collection custom poster
// // return (
// // environment.API_URL +
// // `/media/collections/posters/preview/` +
// // this.list.posterPath
// // );
// // } else {
// // // * use the poster of the first entry in the collection if its no empty
// // if (this.list.entries.length != 0) {
// // return this.getEntryPosterPath(this.list.entries[0]);
// // }
// // return `https://www.themoviedb.org/w1280/${this.list.backdropPath}`;
// // // * if the collection is empty
// // return 'assets/images/default/default-poster.png';
// // }
// }
// getEntryPosterPath(entry: Entry) {
// // * Is in library: use a local poster
// if (entry.medias) {
// const selectedPosters = entry.medias.filter(
// (m) => m.type == 'poster' && m.isSelected
// );
// if (
// selectedPosters.length &&
// selectedPosters[0] &&
// selectedPosters[0].path
// ) {
// const name = selectedPosters[0].path;
// return environment.API_URL + `/media/entries/posters/preview/${name}`;
// }
// }
// // * No local poster available, Use TMDB poster
// if (entry.poster_path)
// return `https://image.tmdb.org/t/p/w300` + entry.poster_path;
// // * No poster found, use default poster image as a last stand
// return 'assets/images/default/default-poster.png';
// }
getCreatedDate(): string {
if (this.collection.createdAt == null) return '';
return this.collection.createdAt.toString();
}
redirectTo(): void {
this.router.navigate([`/collections/${this.collection.id}`]);
}
deleteList() {
this.listService.deleteCollection(this.collection.id);
}
}
@@ -18,11 +18,11 @@ import { EpisodeSeenService } from '../../../core/services/episode-seen.service'
import { SeasonService } from '../../../core/services/season.service';
import { LibraryService } from '../../../core/services/library.service';
import { ToastrService } from 'ngx-toastr';
import { EntrySeen } from '../../../shared/models/entrySeen.model';
import { EntrySeen } from '../../../shared/models/entry-seen.model';
import { EpisodeSeenModalComponent } from '../../../shared/components/modals/episode-seen-modal/episode-seen-modal.component';
import { MediaModalComponent } from '../media-modal/media-modal.component';
import { environment } from '../../../../environments/environment.prod';
import { UserCollection } from '../../../shared/models/userCollection.model';
import { Collection } from '../../../shared/models/collection.model';
@Component({
selector: 'app-entry-page',
@@ -325,7 +325,7 @@ export class EntryPageComponent implements OnInit {
}
}
getCollectionBackdropPath(collection: UserCollection) {
getCollectionBackdropPath(collection: Collection) {
console.log(`collection media:`, collection.medias);
if (collection.medias && collection.medias.length != 0) {
const backdrops = collection.medias.filter((m) => m.type == 'backdrop');
@@ -10,7 +10,7 @@ import { LibraryService } from '../../../core/services/library.service';
import { ToastrService } from 'ngx-toastr';
import { SettingsService } from '../../../core/services/settings.service';
import { Settings } from '../../../shared/models/settings.model';
import { LibraryQueryParams } from '../../../shared/models/LibraryQueryParams';
import { LibraryQueryParams } from '../../../shared/models/library-query-params';
import { ActivatedRoute, Router } from '@angular/router';
declare var $: any;
@@ -2,7 +2,7 @@ import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core';
import { Entry } from '../../../shared/models/entry.model';
import { LibraryService } from '../../../core/services/library.service';
import { ActivatedRoute, Event, NavigationEnd, Router } from '@angular/router';
import { LibraryQueryParams } from '../../../shared/models/LibraryQueryParams';
import { LibraryQueryParams } from '../../../shared/models/library-query-params';
import { SettingsService } from '../../../core/services/settings.service';
import { Settings } from '../../../shared/models/settings.model';
import { ValueSetter } from 'date-fns/parse/_lib/Setter';
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { MaintenanceService } from '../../../core/services/maintenance.service';
import { MaintenanceResult } from '../../../shared/models/maintenanceResult.model';
import { MaintenanceResult } from '../../../shared/models/maintenance-result.model';
@Component({
selector: 'app-settings-maintenance',