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
@@ -1,12 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { HomeComponent } from './features/pages/home/home.component';
|
||||
import { SearchComponent } from './features/pages/search/search.component';
|
||||
import { TrendingComponent } from './features/pages/trending/trending.component';
|
||||
import { PopularComponent } from './features/pages/popular/popular.component';
|
||||
import { LibraryComponent } from './features/pages/library/library.component';
|
||||
import { ListsComponent } from './features/pages/lists/lists.component';
|
||||
import { ListInfoComponent } from './features/list-info/list-info.component';
|
||||
import { HomeComponent } from './features/home/home.component';
|
||||
import { SearchComponent } from './features/discover/search/search.component';
|
||||
import { TrendingComponent } from './features/discover/trending/trending.component';
|
||||
import { PopularComponent } from './features/discover/popular/popular.component';
|
||||
import { LibraryComponent } from './features/library/library.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
@@ -16,8 +14,10 @@ const routes: Routes = [
|
||||
{ path: 'trending', component: TrendingComponent },
|
||||
|
||||
{ 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({
|
||||
|
||||
@@ -5,18 +5,9 @@ import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
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 { ListSelectionModalComponent } from './features/modals/list-selection-modal/list-selection-modal.component';
|
||||
import { SharedModule } from './shared/shared.module';
|
||||
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
@@ -25,42 +16,36 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
|
||||
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 { 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({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
EntryListComponent,
|
||||
HomeComponent,
|
||||
SidebarComponent,
|
||||
NavbarComponent,
|
||||
PopularComponent,
|
||||
TrendingComponent,
|
||||
SearchComponent,
|
||||
LibraryComponent,
|
||||
|
||||
// ? components
|
||||
NotificationPopupComponent,
|
||||
MainCardComponent,
|
||||
DynamicEntryListComponent,
|
||||
LibraryComponent,
|
||||
NotificationPopupComponent,
|
||||
ListSelectionModalComponent,
|
||||
ListsComponent,
|
||||
UserListItemComponent,
|
||||
UserListItemCardComponent,
|
||||
DateFormatPipe,
|
||||
ListInfoComponent,
|
||||
ListEntryCardComponent,
|
||||
UserCollectionEntryGridComponent,
|
||||
],
|
||||
imports: [
|
||||
CoreModule,
|
||||
SharedModule,
|
||||
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
@@ -68,11 +53,11 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
|
||||
MatDialogModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
MatCheckboxModule,
|
||||
MatListModule,
|
||||
// MatDialogModule,
|
||||
// MatInputModule,
|
||||
// MatButtonModule,
|
||||
// MatCheckboxModule,
|
||||
// MatListModule,
|
||||
BrowserAnimationsModule,
|
||||
|
||||
DragDropModule,
|
||||
|
||||
@@ -6,9 +6,11 @@ import { LibraryService } from './services/library.service';
|
||||
import { EntryService } from './services/entry.service';
|
||||
import { ListService } from './services/list.service';
|
||||
import { ToggleService } from './services/toggle.service';
|
||||
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||
import { NavbarComponent } from './components/navbar/navbar.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
declarations: [SidebarComponent, NavbarComponent],
|
||||
imports: [CommonModule],
|
||||
providers: [
|
||||
TmdbService,
|
||||
@@ -17,6 +19,7 @@ import { ToggleService } from './services/toggle.service';
|
||||
ListService,
|
||||
ToggleService,
|
||||
],
|
||||
exports: [SidebarComponent, NavbarComponent],
|
||||
})
|
||||
export class CoreModule {
|
||||
constructor(@Optional() @SkipSelf() parentModule?: CoreModule) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
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 { Entry } from '../../shared/models/entry.model';
|
||||
|
||||
@@ -13,18 +13,18 @@ export class ListService {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
// get all lists
|
||||
getLists(): Observable<List[]> {
|
||||
return this.http.get<List[]>(`${this.backend_apiUrl}/lists`);
|
||||
getLists(): Observable<UserCollection[]> {
|
||||
return this.http.get<UserCollection[]>(`${this.backend_apiUrl}/lists`);
|
||||
}
|
||||
|
||||
// get a list by id
|
||||
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
|
||||
createList(list: List): Observable<List> {
|
||||
return this.http.post<List>(`${this.backend_apiUrl}/lists`, list);
|
||||
createList(list: UserCollection): Observable<UserCollection> {
|
||||
return this.http.post<UserCollection>(`${this.backend_apiUrl}/lists`, list);
|
||||
}
|
||||
|
||||
// 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))">
|
||||
<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()">
|
||||
</app-list-entry-card>
|
||||
</app-userCollection-grid-card>
|
||||
</div>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserCollectionEntryGridComponent } from './user-collection-entry-grid.component';
|
||||
import { UserCollectionEntryGridComponent } from './userCollection-entry-grid.component';
|
||||
|
||||
describe('UserCollectionEntryGridComponent', () => {
|
||||
let component: UserCollectionEntryGridComponent;
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Entry } from '../../../shared/models/entry.model';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
import {
|
||||
CdkDragDrop,
|
||||
CdkDragEnd,
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
} from '@angular/cdk/drag-drop';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-collection-entry-grid',
|
||||
templateUrl: './user-collection-entry-grid.component.html',
|
||||
styleUrls: ['./user-collection-entry-grid.component.css'],
|
||||
selector: 'app-userCollection-entry-grid',
|
||||
templateUrl: './userCollection-entry-grid.component.html',
|
||||
styleUrls: ['./userCollection-entry-grid.component.css'],
|
||||
})
|
||||
export class UserCollectionEntryGridComponent {
|
||||
@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 { MatDialog } from '@angular/material/dialog';
|
||||
import { LibraryService } from '../../../core/services/library.service';
|
||||
import { Entry } from '../../../shared/models/entry.model';
|
||||
import { LibraryService } from '../../../../core/services/library.service';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
import { ListService } from '../../../core/services/list.service';
|
||||
import { ListService } from '../../../../core/services/list.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-entry-card',
|
||||
templateUrl: './list-entry-card.component.html',
|
||||
styleUrls: ['./list-entry-card.component.css'],
|
||||
selector: 'app-userCollection-grid-card',
|
||||
templateUrl: './userCollection-grid-card.component.html',
|
||||
styleUrls: ['./userCollection-grid-card.component.css'],
|
||||
animations: [
|
||||
trigger('fadeInOut', [
|
||||
transition(':enter', [
|
||||
@@ -19,7 +19,7 @@ import { ListService } from '../../../core/services/list.service';
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class ListEntryCardComponent {
|
||||
export class UserCollectionGridCardComponent {
|
||||
@Input() entry!: Entry;
|
||||
@Input() listId: string = '';
|
||||
@Output() refrechEvent = new EventEmitter();
|
||||
File renamed without changes.
+1
-1
@@ -28,7 +28,7 @@
|
||||
<div *ngIf="list.description != ''">{{list.description}}</div>
|
||||
<hr>
|
||||
<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>
|
||||
+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 { ActivatedRoute } from '@angular/router';
|
||||
import { ListService } from '../../core/services/list.service';
|
||||
import { List } from '../../shared/models/list.model';
|
||||
import { Entry } from '../../shared/models/entry.model';
|
||||
import { ListService } from '../../../../core/services/list.service';
|
||||
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-info',
|
||||
templateUrl: './list-info.component.html',
|
||||
styleUrls: ['./list-info.component.css'],
|
||||
selector: 'app-userCollection-info-page',
|
||||
templateUrl: './userCollection-info-page.component.html',
|
||||
styleUrls: ['./userCollection-info-page.component.css'],
|
||||
providers: [DatePipe],
|
||||
})
|
||||
export class ListInfoComponent {
|
||||
list: List = {} as List;
|
||||
export class UserCollectionInfoPageComponent {
|
||||
list: UserCollection = {} as UserCollection;
|
||||
createdAt: string = '';
|
||||
updatedAt: string = '';
|
||||
|
||||
@@ -29,7 +29,7 @@ export class ListInfoComponent {
|
||||
this.listService.getList(id.toString()).subscribe(
|
||||
(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.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 { List } from '../../../shared/models/list.model';
|
||||
import { ListService } from '../../../core/services/list.service';
|
||||
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-user-list-item',
|
||||
templateUrl: './user-list-item.component.html',
|
||||
styleUrls: ['./user-list-item.component.css'],
|
||||
selector: 'app-userCollections-list-item',
|
||||
templateUrl: './userCollections-list-item.component.html',
|
||||
styleUrls: ['./userCollections-list-item.component.css'],
|
||||
animations: [
|
||||
trigger('fadeInOut', [
|
||||
transition(':enter', [
|
||||
@@ -22,8 +22,8 @@ import { trigger, transition, style, animate } from '@angular/animations';
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class UserListItemComponent {
|
||||
@Input() list!: List;
|
||||
export class UserCollectionsListItemComponent {
|
||||
@Input() list!: UserCollection;
|
||||
|
||||
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="d-flex flex-column gap-3">
|
||||
<!-- 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 -->
|
||||
</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 { FormControl } from '@angular/forms';
|
||||
import { List } from '../../../shared/models/list.model';
|
||||
import { ListService } from '../../../core/services/list.service';
|
||||
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||
import { ListService } from '../../../../core/services/list.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-lists',
|
||||
templateUrl: './lists.component.html',
|
||||
styleUrls: ['./lists.component.css'],
|
||||
selector: 'app-userCollections-page',
|
||||
templateUrl: './userCollections-page.component.html',
|
||||
styleUrls: ['./userCollections-page.component.css'],
|
||||
})
|
||||
export class ListsComponent implements OnInit {
|
||||
export class UserCollectionsPageComponent implements OnInit {
|
||||
searchControl = new FormControl('');
|
||||
showAddButton: boolean = false;
|
||||
listsCount: number = 0;
|
||||
|
||||
lists: List[] = [];
|
||||
listsToShow: List[] = [];
|
||||
lists: UserCollection[] = [];
|
||||
listsToShow: UserCollection[] = [];
|
||||
|
||||
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 { Entry } from '../../../shared/models/entry.model';
|
||||
import { TmdbService } from '../../../core/services/tmdb.service';
|
||||
import { Entry } from '../../../shared/models/entry.model';
|
||||
|
||||
@Component({
|
||||
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 { TmdbService } from '../../../core/services/tmdb.service';
|
||||
import { Entry } from '../../../shared/models/entry.model';
|
||||
import { TmdbService } from '../../../core/services/tmdb.service';
|
||||
|
||||
@Component({
|
||||
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 { Entry } from '../../../shared/models/entry.model';
|
||||
import { LibraryService } from '../../../core/services/library.service';
|
||||
import { Entry } from '../../shared/models/entry.model';
|
||||
import { LibraryService } from '../../core/services/library.service';
|
||||
|
||||
@Component({
|
||||
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 { 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 { MatDialog } from '@angular/material/dialog';
|
||||
import { trigger, transition, style, animate } from '@angular/animations';
|
||||
import { Entry } from '../../../models/entry.model';
|
||||
import { LibraryService } from '../../../../core/services/library.service';
|
||||
|
||||
@Component({
|
||||
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 { Entry } from '../../../shared/models/entry.model';
|
||||
import { Entry } from '../../../../shared/models/entry.model';
|
||||
|
||||
@Component({
|
||||
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.
+24
-21
@@ -1,10 +1,11 @@
|
||||
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { ListService } from '../../../core/services/list.service';
|
||||
import { List } from '../../../shared/models/list.model';
|
||||
import { NotificationPopupComponent } from '../../../shared/notification-popup/notification-popup.component';
|
||||
import { NotificationService } from '../../../shared/services/notification.service';
|
||||
import { ListService } from '../../../../core/services/list.service';
|
||||
import { NotificationPopupComponent } from '../../notification-popup/notification-popup.component';
|
||||
import { NotificationService } from '../../../services/notification.service';
|
||||
import { UserCollection } from '../../../../shared/models/userCollection.model';
|
||||
|
||||
import {
|
||||
trigger,
|
||||
state,
|
||||
@@ -42,8 +43,8 @@ export class ListSelectionModalComponent implements OnInit {
|
||||
searchControl = new FormControl('');
|
||||
showAddButton: boolean = false;
|
||||
|
||||
lists: List[] = [];
|
||||
listsToShow: List[] = [];
|
||||
lists: UserCollection[] = [];
|
||||
listsToShow: UserCollection[] = [];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ListSelectionModalComponent>,
|
||||
@@ -101,7 +102,7 @@ export class ListSelectionModalComponent implements OnInit {
|
||||
createList() {
|
||||
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) => {
|
||||
await this.getLists();
|
||||
@@ -112,7 +113,7 @@ export class ListSelectionModalComponent implements OnInit {
|
||||
return this.showAddButton;
|
||||
}
|
||||
|
||||
onSelectionChange(list: List, event: Event): void {
|
||||
onSelectionChange(list: UserCollection, event: Event): void {
|
||||
const inputElement = event.target as HTMLInputElement;
|
||||
const isChecked = inputElement.checked;
|
||||
|
||||
@@ -137,19 +138,21 @@ export class ListSelectionModalComponent implements OnInit {
|
||||
});
|
||||
} else {
|
||||
console.log(`Removing Entry ${this.entryId} from list: ${list.name}`);
|
||||
this.listService.removeEntryFromList(list.id.toString(), this.entryId).subscribe({
|
||||
next: (_) => {
|
||||
this.showNotification(
|
||||
'Entry Removed',
|
||||
'Entry removed successfully',
|
||||
'success'
|
||||
);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error removing entry:', error);
|
||||
this.showNotification('Error', 'Failed to remove entry', 'error');
|
||||
},
|
||||
});
|
||||
this.listService
|
||||
.removeEntryFromList(list.id.toString(), this.entryId)
|
||||
.subscribe({
|
||||
next: (_) => {
|
||||
this.showNotification(
|
||||
'Entry Removed',
|
||||
'Entry removed successfully',
|
||||
'success'
|
||||
);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error removing entry:', error);
|
||||
this.showNotification('Error', 'Failed to remove entry', 'error');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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 { ListEntry } from './listEntry.model';
|
||||
|
||||
export interface List {
|
||||
export interface UserCollection {
|
||||
id: number;
|
||||
|
||||
name: string;
|
||||
File renamed without changes.
File renamed without changes.
@@ -6,7 +6,7 @@ import {
|
||||
EmbeddedViewRef,
|
||||
ComponentRef,
|
||||
} from '@angular/core';
|
||||
import { NotificationPopupComponent } from '../notification-popup/notification-popup.component';
|
||||
import { NotificationPopupComponent } from '../components/notification-popup/notification-popup.component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
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({
|
||||
declarations: [NotificationPopupComponent],
|
||||
imports: [CommonModule],
|
||||
exports: [NotificationPopupComponent],
|
||||
declarations: [
|
||||
// ? pipes
|
||||
DateFormatPipe,
|
||||
|
||||
// ? components
|
||||
// NotificationPopupComponent,
|
||||
// MainCardComponent,
|
||||
// DynamicEntryListComponent,
|
||||
// NotificationPopupComponent,
|
||||
// ListSelectionModalComponent,
|
||||
|
||||
// ? modules
|
||||
],
|
||||
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
||||
exports: [
|
||||
//NotificationPopupComponent,
|
||||
DateFormatPipe,
|
||||
],
|
||||
})
|
||||
export class SharedModule {}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Reference in new issue
Block a user