diff --git a/frontend/src/app/core/services/toggle.service.ts b/frontend/src/app/core/services/toggle.service.ts index 5ee95f3..9fd6dca 100644 --- a/frontend/src/app/core/services/toggle.service.ts +++ b/frontend/src/app/core/services/toggle.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root', @@ -18,7 +17,6 @@ export class ToggleService { document.body.classList.add('toggled'); this.isToggeled = true; } - // document.body.classList.toggle('toggled'); } hoverSidebar(isHovering: boolean) { diff --git a/frontend/src/app/core/services/userCollection.service.ts b/frontend/src/app/core/services/userCollection.service.ts index 07c9d77..70a522e 100644 --- a/frontend/src/app/core/services/userCollection.service.ts +++ b/frontend/src/app/core/services/userCollection.service.ts @@ -15,21 +15,21 @@ export class UserCollectionService { constructor(private http: HttpClient) {} // get all lists - getLists(): Observable { + getCollections(): Observable { return this.http.get( `${this.backend_apiUrl}/${this.apiAction}` ); } // get a list by id - getList(userCollectionId: string) { - return this.http.get( + getCollection(userCollectionId: string) { + return this.http.get( `${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}` ); } // Create a new list - createList(userCollection: UserCollection): Observable { + createCollection(userCollection: UserCollection): Observable { return this.http.post( `${this.backend_apiUrl}/${this.apiAction}`, userCollection @@ -37,14 +37,14 @@ export class UserCollectionService { } // Delete a list by ID - deleteList(userCollectionId: number): Observable { + deleteCollection(userCollectionId: number): Observable { return this.http.delete( `${this.backend_apiUrl}/${this.apiAction}/${userCollectionId}` ); } // Add an entry to a list - addEntryToList( + addEntryToCollection( userCollectionId: number, entryId: number, order: number @@ -68,7 +68,7 @@ export class UserCollectionService { } // Remove an entry from a list - removeEntryFromList( + removeEntryFromCollection( userCollectionId: string, entryId: number ): Observable { diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts index c3ef4cf..be2af72 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts +++ b/frontend/src/app/features/collections/user-collection-info/userCollection-grid-card/userCollection-grid-card.component.ts @@ -78,8 +78,8 @@ export class UserCollectionGridCardComponent { } removeEntryFromList() { - // todo: add confirm modal - this.listService.removeEntryFromList(this.listId, this.entry.id).subscribe({ + // TODO: add confirm modal + this.listService.removeEntryFromCollection(this.listId, this.entry.id).subscribe({ next: (response) => { console.log('Entry successfully removed from list.', response); this.entry.id = 0; diff --git a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts b/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts index 0815964..aef997a 100644 --- a/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts +++ b/frontend/src/app/features/collections/user-collection-info/userCollection-info-page/userCollection-info-page.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { UserCollectionService } from '../../../../core/services/userCollection.service'; import { UserCollection } from '../../../../shared/models/userCollection.model'; @@ -11,7 +11,7 @@ import { DatePipe } from '@angular/common'; styleUrls: ['./userCollection-info-page.component.css'], providers: [DatePipe], }) -export class UserCollectionInfoPageComponent { +export class UserCollectionInfoPageComponent implements OnInit{ list: UserCollection = {} as UserCollection; createdAt: string = ''; updatedAt: string = ''; @@ -26,7 +26,7 @@ export class UserCollectionInfoPageComponent { const id = this.route.snapshot.paramMap.get('id'); if (id == null) return; - this.listService.getList(id.toString()).subscribe( + this.listService.getCollection(id.toString()).subscribe( (data) => { // Handle the successful reception of data. this.list = data as unknown as UserCollection; @@ -55,7 +55,6 @@ export class UserCollectionInfoPageComponent { } getUpdatedAt() { - console.log(1); const updatedAt = this.list.updatedAt; // First, check if updatedAt is a valid date string or timestamp const modifiedDate = new Date(updatedAt); @@ -71,20 +70,24 @@ export class UserCollectionInfoPageComponent { const diffInMs = now.getTime() - modifiedDate.getTime(); const diffInDays = diffInMs / (1000 * 60 * 60 * 24); + let isPlural = ''; if (diffInDays < 7) { // Less than a week, show relative time if (diffInDays < 1) { const diffInHours = diffInMs / (1000 * 60 * 60); if (diffInHours < 1) { const diffInMinutes = diffInMs / (1000 * 60); - return `${Math.floor(diffInMinutes)} minutes ago`; + if(diffInMinutes >= 2) isPlural = 's' + return `${Math.floor(diffInMinutes)} minute${isPlural} ago`; } - return `${Math.floor(diffInHours)} hours ago`; + if(diffInHours >= 2) isPlural = 's' + return `${Math.floor(diffInHours)} hour${isPlural} ago`; } - return `${Math.floor(diffInDays)} days ago`; + + if(diffInDays >= 2) isPlural = 's' + return `${Math.floor(diffInDays)} day${isPlural} ago`; } else { // More than a week, show formatted date - // Ensure datePipe is properly injected and available in the component return this.datePipe.transform(modifiedDate, 'dd MMMM, yyyy'); } } diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css b/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css index f5e8126..bf9ed8f 100644 --- a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css +++ b/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.css @@ -2,18 +2,19 @@ padding-top: 1px; } -.list-title{ +.list-title { font-size: 20px; } -.list-title:hover { - color: var(--aruze-blue) -} -.list-line{ +.list-line { border-radius: 1px; padding: 2px; } .list-line:hover { - background-color: aliceblue; + background-color: var(--shz-light-bgh); +} + +:host-context([data-bs-theme="dark"]) .list-line:hover { + background-color: var(--shz-dark-bgh); } \ No newline at end of file diff --git a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts b/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts index 8620d36..79d7ec5 100644 --- a/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts +++ b/frontend/src/app/features/collections/user-collections/userCollection-list-item/userCollections-list-item.component.ts @@ -1,4 +1,4 @@ -import { Component, Input} from '@angular/core'; +import { Component, Input } from '@angular/core'; import { UserCollection } from '../../../../shared/models/userCollection.model'; import { UserCollectionService } from '../../../../core/services/userCollection.service'; import { Router } from '@angular/router'; @@ -25,7 +25,10 @@ import { trigger, transition, style, animate } from '@angular/animations'; export class UserCollectionsListItemComponent { @Input() list!: UserCollection; - constructor(private listService: UserCollectionService, private router: Router) {} + constructor( + private listService: UserCollectionService, + private router: Router + ) {} getPostPath() { if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256'; @@ -44,6 +47,6 @@ export class UserCollectionsListItemComponent { } deleteList() { - this.listService.deleteList(this.list.id); + this.listService.deleteCollection(this.list.id); } } diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html b/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html index 4cce251..f6293da 100644 --- a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html +++ b/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.html @@ -8,7 +8,7 @@ - + @@ -30,7 +30,8 @@
- +
diff --git a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts b/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts index 2b0c282..cd20008 100644 --- a/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts +++ b/frontend/src/app/features/collections/user-collections/userCollections-page/userCollections-page.component.ts @@ -26,7 +26,7 @@ export class UserCollectionsPageComponent implements OnInit { } getLists() { - this.listService.getLists().subscribe({ + this.listService.getCollections().subscribe({ next: (l) => { console.log(`Loaded ${l.length} lists.`); this.lists = l; diff --git a/frontend/src/app/features/library/library.component.css b/frontend/src/app/features/library/library.component.css index e69de29..00945fa 100644 --- a/frontend/src/app/features/library/library.component.css +++ b/frontend/src/app/features/library/library.component.css @@ -0,0 +1,38 @@ +/* Custom CSS to visually connect the elements */ +.custom-group .form-select { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.custom-group .form-select, +.custom-group .input-group-text { + border: 1px black solid; +} + +.custom-group .btn-group .btn { + border-radius: 0; +} + +.custom-group .btn-group .left-btn { + /* border-top-left-radius: 0.25rem; */ + /* border-bottom-left-radius: 0.25rem; */ + border-left: 0; + border-right: 0; +} + +.custom-group .btn-group .right-btn { + border-top-right-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; + border-left: 0; + +} + +.custom-group .form-select, +.custom-group .btn-outline-dark { + margin-right: -1px; +} + +/* Adjust the select width as needed */ +#single-select-field { + max-width: 120px; +} \ No newline at end of file diff --git a/frontend/src/app/features/library/library.component.html b/frontend/src/app/features/library/library.component.html index f50ed09..6646cff 100644 --- a/frontend/src/app/features/library/library.component.html +++ b/frontend/src/app/features/library/library.component.html @@ -13,7 +13,9 @@
- @@ -23,20 +25,19 @@ -
- - - - +
+ + + +
-
    diff --git a/frontend/src/app/shared/components/lists/entry-list/entry-list.component.ts b/frontend/src/app/shared/components/lists/entry-list/entry-list.component.ts index c9a89a9..853944e 100644 --- a/frontend/src/app/shared/components/lists/entry-list/entry-list.component.ts +++ b/frontend/src/app/shared/components/lists/entry-list/entry-list.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; -import { TmdbService } from '../../../core/services/tmdb.service'; -import { Entry } from '../../../shared/models/entry.model'; +import { TmdbService } from '../../../../core/services/tmdb.service'; +import { Entry } from '../../../../shared/models/entry.model'; @Component({ selector: 'app-entry-list', diff --git a/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html b/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html index 4751462..d7c3188 100644 --- a/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html +++ b/frontend/src/app/shared/components/modals/list-selection-modal/user-collections-modal.component.html @@ -19,7 +19,7 @@ -->