Renamed many components + started implementing lazy loading
This commit is contained in:
1 parent
c8578ccf77
commit
60b517500f
80 files changed
+262
-230
No files matched your search
@@ -1,12 +1,10 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
import { HomeComponent } from './features/pages/home/home.component';
|
import { HomeComponent } from './features/home/home.component';
|
||||||
import { SearchComponent } from './features/pages/search/search.component';
|
import { SearchComponent } from './features/discover/search/search.component';
|
||||||
import { TrendingComponent } from './features/pages/trending/trending.component';
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
import { PopularComponent } from './features/pages/popular/popular.component';
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
import { LibraryComponent } from './features/pages/library/library.component';
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
import { ListsComponent } from './features/pages/lists/lists.component';
|
|
||||||
import { ListInfoComponent } from './features/list-info/list-info.component';
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||||
@@ -16,8 +14,10 @@ const routes: Routes = [
|
|||||||
{ path: 'trending', component: TrendingComponent },
|
{ path: 'trending', component: TrendingComponent },
|
||||||
|
|
||||||
{ path: 'library', component: LibraryComponent },
|
{ path: 'library', component: LibraryComponent },
|
||||||
{ path: 'lists', component: ListsComponent },
|
{
|
||||||
{ path: 'lists/:id', component: ListInfoComponent },
|
path: 'user-collections',
|
||||||
|
loadChildren: () => import('./features/collections/user-collections.module').then(m => m.UserCollectionsModule)
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -5,18 +5,9 @@ import { AppRoutingModule } from './app-routing.module';
|
|||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { EntryListComponent } from './features/lists/entry-list/entry-list.component';
|
|
||||||
import { HomeComponent } from './features/pages/home/home.component';
|
|
||||||
import { SidebarComponent } from './core/components/sidebar/sidebar.component';
|
|
||||||
import { NavbarComponent } from './core/components/navbar/navbar.component';
|
|
||||||
import { PopularComponent } from './features/pages/popular/popular.component';
|
|
||||||
import { TrendingComponent } from './features/pages/trending/trending.component';
|
|
||||||
import { SearchComponent } from './features/pages/search/search.component';
|
|
||||||
import { MainCardComponent } from './features/cards/main-card/main-card.component';
|
|
||||||
import { DynamicEntryListComponent } from './features/lists/dynamic-entry-list/dynamic-entry-list.component';
|
|
||||||
import { LibraryComponent } from './features/pages/library/library.component';
|
|
||||||
import { CoreModule } from './core/core.module';
|
import { CoreModule } from './core/core.module';
|
||||||
import { ListSelectionModalComponent } from './features/modals/list-selection-modal/list-selection-modal.component';
|
import { SharedModule } from './shared/shared.module';
|
||||||
|
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
@@ -25,42 +16,36 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
|||||||
import { MatListModule } from '@angular/material/list';
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { ListsComponent } from './features/pages/lists/lists.component';
|
|
||||||
import { UserListItemComponent } from './features/cards/user-list-item/user-list-item.component';
|
|
||||||
import { UserListItemCardComponent } from './features/cards/user-list-item-card/user-list-item-card.component';
|
|
||||||
import { DateFormatPipe } from './core/pipes/date-format/date-format.pipe';
|
|
||||||
import { SharedModule } from './shared/shared.module';
|
|
||||||
import { ListInfoComponent } from './features/list-info/list-info.component';
|
|
||||||
import { ListEntryCardComponent } from './features/cards/list-entry-card/list-entry-card.component';
|
|
||||||
import { UserCollectionEntryGridComponent } from './features/lists/collection-entry-list/user-collection-entry-grid.component';
|
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
|
import { HomeComponent } from './features/home/home.component';
|
||||||
|
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||||
|
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||||
|
import { SearchComponent } from './features/discover/search/search.component';
|
||||||
|
import { LibraryComponent } from './features/library/library.component';
|
||||||
|
import { DynamicEntryListComponent } from './shared/components/lists/dynamic-entry-list/dynamic-entry-list.component';
|
||||||
|
import { NotificationPopupComponent } from './shared/components/notification-popup/notification-popup.component';
|
||||||
|
import { MainCardComponent } from './shared/components/cards/main-card/main-card.component';
|
||||||
|
import { ListSelectionModalComponent } from './shared/components/modals/list-selection-modal/list-selection-modal.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
EntryListComponent,
|
|
||||||
HomeComponent,
|
HomeComponent,
|
||||||
SidebarComponent,
|
|
||||||
NavbarComponent,
|
|
||||||
PopularComponent,
|
PopularComponent,
|
||||||
TrendingComponent,
|
TrendingComponent,
|
||||||
SearchComponent,
|
SearchComponent,
|
||||||
|
LibraryComponent,
|
||||||
|
|
||||||
|
// ? components
|
||||||
|
NotificationPopupComponent,
|
||||||
MainCardComponent,
|
MainCardComponent,
|
||||||
DynamicEntryListComponent,
|
DynamicEntryListComponent,
|
||||||
LibraryComponent,
|
NotificationPopupComponent,
|
||||||
ListSelectionModalComponent,
|
ListSelectionModalComponent,
|
||||||
ListsComponent,
|
|
||||||
UserListItemComponent,
|
|
||||||
UserListItemCardComponent,
|
|
||||||
DateFormatPipe,
|
|
||||||
ListInfoComponent,
|
|
||||||
ListEntryCardComponent,
|
|
||||||
UserCollectionEntryGridComponent,
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule,
|
CoreModule,
|
||||||
SharedModule,
|
|
||||||
|
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
@@ -68,11 +53,11 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
|
||||||
MatDialogModule,
|
// MatDialogModule,
|
||||||
MatInputModule,
|
// MatInputModule,
|
||||||
MatButtonModule,
|
// MatButtonModule,
|
||||||
MatCheckboxModule,
|
// MatCheckboxModule,
|
||||||
MatListModule,
|
// MatListModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
|
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import { LibraryService } from './services/library.service';
|
|||||||
import { EntryService } from './services/entry.service';
|
import { EntryService } from './services/entry.service';
|
||||||
import { ListService } from './services/list.service';
|
import { ListService } from './services/list.service';
|
||||||
import { ToggleService } from './services/toggle.service';
|
import { ToggleService } from './services/toggle.service';
|
||||||
|
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||||
|
import { NavbarComponent } from './components/navbar/navbar.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [],
|
declarations: [SidebarComponent, NavbarComponent],
|
||||||
imports: [CommonModule],
|
imports: [CommonModule],
|
||||||
providers: [
|
providers: [
|
||||||
TmdbService,
|
TmdbService,
|
||||||
@@ -17,6 +19,7 @@ import { ToggleService } from './services/toggle.service';
|
|||||||
ListService,
|
ListService,
|
||||||
ToggleService,
|
ToggleService,
|
||||||
],
|
],
|
||||||
|
exports: [SidebarComponent, NavbarComponent],
|
||||||
})
|
})
|
||||||
export class CoreModule {
|
export class CoreModule {
|
||||||
constructor(@Optional() @SkipSelf() parentModule?: CoreModule) {
|
constructor(@Optional() @SkipSelf() parentModule?: CoreModule) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { List } from '../../shared/models/list.model';
|
import { UserCollection } from '../../shared/models/userCollection.model';
|
||||||
import { ListEntry } from '../../shared/models/listEntry.model';
|
import { ListEntry } from '../../shared/models/listEntry.model';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
|
|
||||||
@@ -13,18 +13,18 @@ export class ListService {
|
|||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
// get all lists
|
// get all lists
|
||||||
getLists(): Observable<List[]> {
|
getLists(): Observable<UserCollection[]> {
|
||||||
return this.http.get<List[]>(`${this.backend_apiUrl}/lists`);
|
return this.http.get<UserCollection[]>(`${this.backend_apiUrl}/lists`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a list by id
|
// get a list by id
|
||||||
getList(id: string) {
|
getList(id: string) {
|
||||||
return this.http.get<List[]>(`${this.backend_apiUrl}/lists/${id}`);
|
return this.http.get<UserCollection[]>(`${this.backend_apiUrl}/lists/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new list
|
// Create a new list
|
||||||
createList(list: List): Observable<List> {
|
createList(list: UserCollection): Observable<UserCollection> {
|
||||||
return this.http.post<List>(`${this.backend_apiUrl}/lists`, list);
|
return this.http.post<UserCollection>(`${this.backend_apiUrl}/lists`, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a list by ID
|
// Delete a list by ID
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ListEntryCardComponent } from './list-entry-card.component';
|
|
||||||
|
|
||||||
describe('ListEntryCardComponent', () => {
|
|
||||||
let component: ListEntryCardComponent;
|
|
||||||
let fixture: ComponentFixture<ListEntryCardComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ListEntryCardComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(ListEntryCardComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
<p>user-list-item-card works!</p>
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { UserListItemCardComponent } from './user-list-item-card.component';
|
|
||||||
|
|
||||||
describe('UserListItemCardComponent', () => {
|
|
||||||
let component: UserListItemCardComponent;
|
|
||||||
let fixture: ComponentFixture<UserListItemCardComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [UserListItemCardComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(UserListItemCardComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-user-list-item-card',
|
|
||||||
templateUrl: './user-list-item-card.component.html',
|
|
||||||
styleUrls: ['./user-list-item-card.component.css']
|
|
||||||
})
|
|
||||||
export class UserListItemCardComponent {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { UserListItemComponent } from './user-list-item.component';
|
|
||||||
|
|
||||||
describe('UserListItemComponent', () => {
|
|
||||||
let component: UserListItemComponent;
|
|
||||||
let fixture: ComponentFixture<UserListItemComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [UserListItemComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(UserListItemComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: UserCollectionsPageComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
component: UserCollectionInfoPageComponent
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class CollectionsRoutingModule { }
|
||||||
File renamed without changes.
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
<div class="movies-container" cdkDropList [cdkDropListData]="entries" (cdkDropListDropped)="drop($any($event))">
|
<div class="movies-container" cdkDropList [cdkDropListData]="entries" (cdkDropListDropped)="drop($any($event))">
|
||||||
<app-list-entry-card cdkDrag *ngFor="let entry of entries" [entry]="entry" [listId]="listId"
|
<app-userCollection-grid-card cdkDrag *ngFor="let entry of entries" [entry]="entry" [listId]="listId"
|
||||||
(refrechEvent)="refrechEventReceiver()">
|
(refrechEvent)="refrechEventReceiver()">
|
||||||
</app-list-entry-card>
|
</app-userCollection-grid-card>
|
||||||
</div>
|
</div>
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { UserCollectionEntryGridComponent } from './user-collection-entry-grid.component';
|
import { UserCollectionEntryGridComponent } from './userCollection-entry-grid.component';
|
||||||
|
|
||||||
describe('UserCollectionEntryGridComponent', () => {
|
describe('UserCollectionEntryGridComponent', () => {
|
||||||
let component: UserCollectionEntryGridComponent;
|
let component: UserCollectionEntryGridComponent;
|
||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
import { Entry } from '../../../../shared/models/entry.model';
|
||||||
import {
|
import {
|
||||||
CdkDragDrop,
|
CdkDragDrop,
|
||||||
CdkDragEnd,
|
CdkDragEnd,
|
||||||
@@ -8,9 +8,9 @@ import {
|
|||||||
} from '@angular/cdk/drag-drop';
|
} from '@angular/cdk/drag-drop';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-collection-entry-grid',
|
selector: 'app-userCollection-entry-grid',
|
||||||
templateUrl: './user-collection-entry-grid.component.html',
|
templateUrl: './userCollection-entry-grid.component.html',
|
||||||
styleUrls: ['./user-collection-entry-grid.component.css'],
|
styleUrls: ['./userCollection-entry-grid.component.css'],
|
||||||
})
|
})
|
||||||
export class UserCollectionEntryGridComponent {
|
export class UserCollectionEntryGridComponent {
|
||||||
@Input() entries: Entry[] = [];
|
@Input() entries: Entry[] = [];
|
||||||
File renamed without changes.
File renamed without changes.
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UserCollectionGridCardComponent } from './userCollection-grid-card.component';
|
||||||
|
|
||||||
|
describe('UserCollectionGridCardComponent', () => {
|
||||||
|
let component: UserCollectionGridCardComponent;
|
||||||
|
let fixture: ComponentFixture<UserCollectionGridCardComponent>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [UserCollectionGridCardComponent]
|
||||||
|
});
|
||||||
|
fixture = TestBed.createComponent(UserCollectionGridCardComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+7
-7
@@ -1,14 +1,14 @@
|
|||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { LibraryService } from '../../../core/services/library.service';
|
import { LibraryService } from '../../../../core/services/library.service';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
import { Entry } from '../../../../shared/models/entry.model';
|
||||||
import { trigger, transition, style, animate } from '@angular/animations';
|
import { trigger, transition, style, animate } from '@angular/animations';
|
||||||
import { ListService } from '../../../core/services/list.service';
|
import { ListService } from '../../../../core/services/list.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-entry-card',
|
selector: 'app-userCollection-grid-card',
|
||||||
templateUrl: './list-entry-card.component.html',
|
templateUrl: './userCollection-grid-card.component.html',
|
||||||
styleUrls: ['./list-entry-card.component.css'],
|
styleUrls: ['./userCollection-grid-card.component.css'],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('fadeInOut', [
|
trigger('fadeInOut', [
|
||||||
transition(':enter', [
|
transition(':enter', [
|
||||||
@@ -19,7 +19,7 @@ import { ListService } from '../../../core/services/list.service';
|
|||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ListEntryCardComponent {
|
export class UserCollectionGridCardComponent {
|
||||||
@Input() entry!: Entry;
|
@Input() entry!: Entry;
|
||||||
@Input() listId: string = '';
|
@Input() listId: string = '';
|
||||||
@Output() refrechEvent = new EventEmitter();
|
@Output() refrechEvent = new EventEmitter();
|
||||||
File renamed without changes.
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
<div *ngIf="list.description != ''">{{list.description}}</div>
|
<div *ngIf="list.description != ''">{{list.description}}</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
<app-user-collection-entry-grid [entries]="list.entries" [listId]="getListId()"></app-user-collection-entry-grid>
|
<app-userCollection-entry-grid [entries]="list.entries" [listId]="getListId()"></app-userCollection-entry-grid>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UserCollectionInfoPageComponent } from './userCollection-info-page.component';
|
||||||
|
|
||||||
|
describe('UserCollectionInfoPageComponent', () => {
|
||||||
|
let component: UserCollectionInfoPageComponent;
|
||||||
|
let fixture: ComponentFixture<UserCollectionInfoPageComponent>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [UserCollectionInfoPageComponent],
|
||||||
|
});
|
||||||
|
fixture = TestBed.createComponent(UserCollectionInfoPageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+9
-9
@@ -1,18 +1,18 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ListService } from '../../core/services/list.service';
|
import { ListService } from '../../../../core/services/list.service';
|
||||||
import { List } from '../../shared/models/list.model';
|
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||||
import { Entry } from '../../shared/models/entry.model';
|
import { Entry } from '../../../../shared/models/entry.model';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-info',
|
selector: 'app-userCollection-info-page',
|
||||||
templateUrl: './list-info.component.html',
|
templateUrl: './userCollection-info-page.component.html',
|
||||||
styleUrls: ['./list-info.component.css'],
|
styleUrls: ['./userCollection-info-page.component.css'],
|
||||||
providers: [DatePipe],
|
providers: [DatePipe],
|
||||||
})
|
})
|
||||||
export class ListInfoComponent {
|
export class UserCollectionInfoPageComponent {
|
||||||
list: List = {} as List;
|
list: UserCollection = {} as UserCollection;
|
||||||
createdAt: string = '';
|
createdAt: string = '';
|
||||||
updatedAt: string = '';
|
updatedAt: string = '';
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ export class ListInfoComponent {
|
|||||||
this.listService.getList(id.toString()).subscribe(
|
this.listService.getList(id.toString()).subscribe(
|
||||||
(data) => {
|
(data) => {
|
||||||
// Handle the successful reception of data.
|
// Handle the successful reception of data.
|
||||||
this.list = data as unknown as List;
|
this.list = data as unknown as UserCollection;
|
||||||
this.list.entries = this.list.entries as Entry[];
|
this.list.entries = this.list.entries as Entry[];
|
||||||
|
|
||||||
this.createdAt = this.getCreatedDate()?.toString() || '';
|
this.createdAt = this.getCreatedDate()?.toString() || '';
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { AppRoutingModule } from '../../app-routing.module';
|
||||||
|
import { CollectionsRoutingModule } from './collections-routing.module';
|
||||||
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
|
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 { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
UserCollectionEntryGridComponent,
|
||||||
|
UserCollectionGridCardComponent,
|
||||||
|
UserCollectionInfoPageComponent,
|
||||||
|
|
||||||
|
UserCollectionsPageComponent,
|
||||||
|
UserCollectionsListItemComponent,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
SharedModule,
|
||||||
|
CollectionsRoutingModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
DragDropModule,
|
||||||
|
],
|
||||||
|
exports: [],
|
||||||
|
})
|
||||||
|
export class UserCollectionsModule {}
|
||||||
File renamed without changes.
File renamed without changes.
+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();
|
||||||
|
});
|
||||||
|
});
|
||||||
+7
-7
@@ -1,13 +1,13 @@
|
|||||||
import { Component, Input} from '@angular/core';
|
import { Component, Input} from '@angular/core';
|
||||||
import { List } from '../../../shared/models/list.model';
|
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||||
import { ListService } from '../../../core/services/list.service';
|
import { ListService } from '../../../../core/services/list.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { trigger, transition, style, animate } from '@angular/animations';
|
import { trigger, transition, style, animate } from '@angular/animations';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-list-item',
|
selector: 'app-userCollections-list-item',
|
||||||
templateUrl: './user-list-item.component.html',
|
templateUrl: './userCollections-list-item.component.html',
|
||||||
styleUrls: ['./user-list-item.component.css'],
|
styleUrls: ['./userCollections-list-item.component.css'],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('fadeInOut', [
|
trigger('fadeInOut', [
|
||||||
transition(':enter', [
|
transition(':enter', [
|
||||||
@@ -22,8 +22,8 @@ import { trigger, transition, style, animate } from '@angular/animations';
|
|||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class UserListItemComponent {
|
export class UserCollectionsListItemComponent {
|
||||||
@Input() list!: List;
|
@Input() list!: UserCollection;
|
||||||
|
|
||||||
constructor(private listService: ListService, private router: Router) {}
|
constructor(private listService: ListService, private router: Router) {}
|
||||||
|
|
||||||
File renamed without changes.
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
<div class="p-3 ps ps--active-y">
|
<div class="p-3 ps ps--active-y">
|
||||||
<div class="d-flex flex-column gap-3">
|
<div class="d-flex flex-column gap-3">
|
||||||
<!-- item start -->
|
<!-- item start -->
|
||||||
<app-user-list-item *ngFor="let list of listsToShow" [list]="list"></app-user-list-item>
|
<app-userCollections-list-item *ngFor="let list of listsToShow" [list]="list"></app-userCollections-list-item>
|
||||||
<!-- item end -->
|
<!-- item end -->
|
||||||
</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();
|
||||||
|
});
|
||||||
|
});
|
||||||
+8
-8
@@ -1,20 +1,20 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { List } from '../../../shared/models/list.model';
|
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||||
import { ListService } from '../../../core/services/list.service';
|
import { ListService } from '../../../../core/services/list.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-lists',
|
selector: 'app-userCollections-page',
|
||||||
templateUrl: './lists.component.html',
|
templateUrl: './userCollections-page.component.html',
|
||||||
styleUrls: ['./lists.component.css'],
|
styleUrls: ['./userCollections-page.component.css'],
|
||||||
})
|
})
|
||||||
export class ListsComponent implements OnInit {
|
export class UserCollectionsPageComponent implements OnInit {
|
||||||
searchControl = new FormControl('');
|
searchControl = new FormControl('');
|
||||||
showAddButton: boolean = false;
|
showAddButton: boolean = false;
|
||||||
listsCount: number = 0;
|
listsCount: number = 0;
|
||||||
|
|
||||||
lists: List[] = [];
|
lists: UserCollection[] = [];
|
||||||
listsToShow: List[] = [];
|
listsToShow: UserCollection[] = [];
|
||||||
|
|
||||||
constructor(private listService: ListService) {}
|
constructor(private listService: ListService) {}
|
||||||
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
|
||||||
import { TmdbService } from '../../../core/services/tmdb.service';
|
import { TmdbService } from '../../../core/services/tmdb.service';
|
||||||
|
import { Entry } from '../../../shared/models/entry.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-popular',
|
selector: 'app-popular',
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { TmdbService } from '../../../core/services/tmdb.service';
|
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
import { Entry } from '../../../shared/models/entry.model';
|
||||||
|
import { TmdbService } from '../../../core/services/tmdb.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-search',
|
selector: 'app-search',
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
import { Entry } from '../../shared/models/entry.model';
|
||||||
import { LibraryService } from '../../../core/services/library.service';
|
import { LibraryService } from '../../core/services/library.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-library',
|
selector: 'app-library',
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ListInfoComponent } from './list-info.component';
|
|
||||||
|
|
||||||
describe('ListInfoComponent', () => {
|
|
||||||
let component: ListInfoComponent;
|
|
||||||
let fixture: ComponentFixture<ListInfoComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ListInfoComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(ListInfoComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Whitespace-only changes.
@@ -1,21 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { ListsComponent } from './lists.component';
|
|
||||||
|
|
||||||
describe('ListsComponent', () => {
|
|
||||||
let component: ListsComponent;
|
|
||||||
let fixture: ComponentFixture<ListsComponent>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ListsComponent]
|
|
||||||
});
|
|
||||||
fixture = TestBed.createComponent(ListsComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
|
||||||
import { LibraryService } from '../../../core/services/library.service';
|
|
||||||
import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component';
|
import { ListSelectionModalComponent } from '../../modals/list-selection-modal/list-selection-modal.component';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { trigger, transition, style, animate } from '@angular/animations';
|
import { trigger, transition, style, animate } from '@angular/animations';
|
||||||
|
import { Entry } from '../../../models/entry.model';
|
||||||
|
import { LibraryService } from '../../../../core/services/library.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-main-card',
|
selector: 'app-main-card',
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { Entry } from '../../../shared/models/entry.model';
|
import { Entry } from '../../../../shared/models/entry.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dynamic-entry-list',
|
selector: 'app-dynamic-entry-list',
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+12
-9
@@ -1,10 +1,11 @@
|
|||||||
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { ListService } from '../../../core/services/list.service';
|
import { ListService } from '../../../../core/services/list.service';
|
||||||
import { List } from '../../../shared/models/list.model';
|
import { NotificationPopupComponent } from '../../notification-popup/notification-popup.component';
|
||||||
import { NotificationPopupComponent } from '../../../shared/notification-popup/notification-popup.component';
|
import { NotificationService } from '../../../services/notification.service';
|
||||||
import { NotificationService } from '../../../shared/services/notification.service';
|
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
trigger,
|
trigger,
|
||||||
state,
|
state,
|
||||||
@@ -42,8 +43,8 @@ export class ListSelectionModalComponent implements OnInit {
|
|||||||
searchControl = new FormControl('');
|
searchControl = new FormControl('');
|
||||||
showAddButton: boolean = false;
|
showAddButton: boolean = false;
|
||||||
|
|
||||||
lists: List[] = [];
|
lists: UserCollection[] = [];
|
||||||
listsToShow: List[] = [];
|
listsToShow: UserCollection[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public dialogRef: MatDialogRef<ListSelectionModalComponent>,
|
public dialogRef: MatDialogRef<ListSelectionModalComponent>,
|
||||||
@@ -101,7 +102,7 @@ export class ListSelectionModalComponent implements OnInit {
|
|||||||
createList() {
|
createList() {
|
||||||
const listName = this.searchControl.value; // string
|
const listName = this.searchControl.value; // string
|
||||||
|
|
||||||
let myNewList = { name: listName } as List;
|
let myNewList = { name: listName } as UserCollection;
|
||||||
|
|
||||||
this.listService.createList(myNewList).subscribe(async (list) => {
|
this.listService.createList(myNewList).subscribe(async (list) => {
|
||||||
await this.getLists();
|
await this.getLists();
|
||||||
@@ -112,7 +113,7 @@ export class ListSelectionModalComponent implements OnInit {
|
|||||||
return this.showAddButton;
|
return this.showAddButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectionChange(list: List, event: Event): void {
|
onSelectionChange(list: UserCollection, event: Event): void {
|
||||||
const inputElement = event.target as HTMLInputElement;
|
const inputElement = event.target as HTMLInputElement;
|
||||||
const isChecked = inputElement.checked;
|
const isChecked = inputElement.checked;
|
||||||
|
|
||||||
@@ -137,7 +138,9 @@ export class ListSelectionModalComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(`Removing Entry ${this.entryId} from list: ${list.name}`);
|
console.log(`Removing Entry ${this.entryId} from list: ${list.name}`);
|
||||||
this.listService.removeEntryFromList(list.id.toString(), this.entryId).subscribe({
|
this.listService
|
||||||
|
.removeEntryFromList(list.id.toString(), this.entryId)
|
||||||
|
.subscribe({
|
||||||
next: (_) => {
|
next: (_) => {
|
||||||
this.showNotification(
|
this.showNotification(
|
||||||
'Entry Removed',
|
'Entry Removed',
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { Entry } from './entry.model';
|
import { Entry } from './entry.model';
|
||||||
import { ListEntry } from './listEntry.model';
|
import { ListEntry } from './listEntry.model';
|
||||||
|
|
||||||
export interface List {
|
export interface UserCollection {
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
name: string;
|
name: string;
|
||||||
File renamed without changes.
File renamed without changes.
@@ -6,7 +6,7 @@ import {
|
|||||||
EmbeddedViewRef,
|
EmbeddedViewRef,
|
||||||
ComponentRef,
|
ComponentRef,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { NotificationPopupComponent } from '../notification-popup/notification-popup.component';
|
import { NotificationPopupComponent } from '../components/notification-popup/notification-popup.component';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
|
|||||||
@@ -1,10 +1,29 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NotificationPopupComponent } from './notification-popup/notification-popup.component';
|
import { NotificationPopupComponent } from './components/notification-popup/notification-popup.component';
|
||||||
|
import { DateFormatPipe } from './pipes/date-format/date-format.pipe';
|
||||||
|
import { MainCardComponent } from './components/cards/main-card/main-card.component';
|
||||||
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { ListSelectionModalComponent } from './components/modals/list-selection-modal/list-selection-modal.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [NotificationPopupComponent],
|
declarations: [
|
||||||
imports: [CommonModule],
|
// ? pipes
|
||||||
exports: [NotificationPopupComponent],
|
DateFormatPipe,
|
||||||
|
|
||||||
|
// ? components
|
||||||
|
// NotificationPopupComponent,
|
||||||
|
// MainCardComponent,
|
||||||
|
// DynamicEntryListComponent,
|
||||||
|
// NotificationPopupComponent,
|
||||||
|
// ListSelectionModalComponent,
|
||||||
|
|
||||||
|
// ? modules
|
||||||
|
],
|
||||||
|
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
||||||
|
exports: [
|
||||||
|
//NotificationPopupComponent,
|
||||||
|
DateFormatPipe,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class SharedModule {}
|
export class SharedModule {}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Reference in new issue
Block a user