refactor(frontend): decouple app shell from PrimeNG layout system (#307)

* refactor(layout): decouple shell from PrimeNG

* fix(frontend): review fixes for layout decoupling

- Rewrite layout service spec to match new API surface
- Remove dead ToastModule import from AppLayoutComponent
- Add missing type="button" to profile and logout buttons
- Add missing i18n keys to all non-English locales

* chore(frontend): Layout shell consistency

* chore(frontend): shell and routing improvements

* chore(frontend): remove stray shimmer effect

* chore(frontend): code cleanup

* chore(ui): Fix navitem types consistency

* chore(frontend): simplify layout structure + imports

* chore(frontend): remove empty files

* chore(frontend): Menu component cleanup

* chore(frontend): remove nav translation layer

* chore(frontend): revert stray artwork change

* chore(frontend): revert author animation tweak

* chore(frontend): review fixes

* fix(frontend): restore topbar template after rebase conflict
This commit is contained in:
Alex
2026-04-22 17:26:57 -04:00
committed by Zach Yale
parent 61b9b53a60
commit 55a6343f65
110 changed files with 1688 additions and 1518 deletions
@@ -172,11 +172,13 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
return [];
}
return this.entityService.isLibrary(entity)
const actions = this.entityService.isLibrary(entity)
? this.libraryShelfMenuService.initializeLibraryMenuItems(entity)
: this.entityService.isMagicShelf(entity)
? this.libraryShelfMenuService.initializeMagicShelfMenuItems(entity)
: this.libraryShelfMenuService.initializeShelfMenuItems(entity);
return actions;
});
readonly books = computed(() => {
const {entityId, entityType} = this.entityInfo();
@@ -999,4 +1001,5 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
this.mobileColumnCount = saved;
}
}
}
@@ -33,12 +33,12 @@
.cover-container.audiobook-cover {
aspect-ratio: 5/7;
background-color: var(--surface-ground);
background-color: var(--ground-background);
}
.cover-container.square-library-cover {
aspect-ratio: 1/1;
background-color: var(--surface-ground);
background-color: var(--ground-background);
}
.book-cover {
@@ -115,12 +115,12 @@
}
&::-webkit-scrollbar-track {
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 4px;
}
&::-webkit-scrollbar-thumb {
background: var(--surface-border);
background: var(--border-color);
border-radius: 4px;
&:hover {
@@ -293,7 +293,7 @@
.review-title-section {
flex-shrink: 0;
border-bottom: 1px solid var(--surface-border);
border-bottom: 1px solid var(--border-color);
padding: 8px 16px 4px;
}
@@ -363,12 +363,12 @@
}
&::-webkit-scrollbar-track {
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 2px;
}
&::-webkit-scrollbar-thumb {
background: var(--surface-border);
background: var(--border-color);
border-radius: 2px;
&:hover {
@@ -139,7 +139,7 @@
object-fit: cover;
border-radius: 4px;
box-shadow: 0 2px 4px rgb(0 0 0 / 10%);
background-color: var(--surface-ground);
background-color: var(--ground-background);
aspect-ratio: 2/3;
}
@@ -192,7 +192,7 @@
.search-book-year {
font-size: 0.8rem;
color: var(--text-secondary-color);
background-color: var(--surface-ground);
background-color: var(--ground-background);
padding: 0.125rem 0.5rem;
border-radius: 4px;
white-space: nowrap;
@@ -285,7 +285,7 @@
align-items: center;
gap: 0.5rem;
padding: 0.625rem 0.875rem;
background: var(--surface-ground);
background: var(--ground-background);
border-bottom: 1px solid var(--border-color);
border-radius: 0.75rem 0.75rem 0 0;
font-weight: 600;
@@ -1,19 +1,20 @@
import {inject, Injectable} from '@angular/core';
import {ConfirmationService, MenuItem, MessageService} from 'primeng/api';
import {Router} from '@angular/router';
import {LibraryService} from './library.service';
import {ShelfService} from './shelf.service';
import {Library} from '../model/library.model';
import {Shelf} from '../model/shelf.model';
import {MetadataRefreshType} from '../../metadata/model/request/metadata-refresh-type.enum';
import {MagicShelf, MagicShelfService} from '../../magic-shelf/service/magic-shelf.service';
import {TaskHelperService} from '../../settings/task-management/task-helper.service';
import {UserService} from "../../settings/user-management/user.service";
import {LoadingService} from '../../../core/services/loading.service';
import {finalize} from 'rxjs';
import {DialogLauncherService} from '../../../shared/services/dialog-launcher.service';
import {BookDialogHelperService} from '../components/book-browser/book-dialog-helper.service';
import {TranslocoService} from '@jsverse/transloco';
import { inject, Injectable } from '@angular/core';
import { ConfirmationService, MessageService } from 'primeng/api';
import { Router } from '@angular/router';
import { LibraryService } from './library.service';
import { ShelfService } from './shelf.service';
import { Library } from '../model/library.model';
import { Shelf } from '../model/shelf.model';
import { MetadataRefreshType } from '../../metadata/model/request/metadata-refresh-type.enum';
import { MagicShelf, MagicShelfService } from '../../magic-shelf/service/magic-shelf.service';
import { TaskHelperService } from '../../settings/task-management/task-helper.service';
import { UserService } from '../../settings/user-management/user.service';
import { LoadingService } from '../../../core/services/loading.service';
import { finalize } from 'rxjs';
import { DialogLauncherService } from '../../../shared/services/dialog-launcher.service';
import { BookDialogHelperService } from '../components/book-browser/book-dialog-helper.service';
import { TranslocoService } from '@jsverse/transloco';
import type { MenuItem } from 'primeng/api';
@Injectable({
providedIn: 'root',
@@ -33,7 +34,7 @@ export class LibraryShelfMenuService {
private bookDialogHelperService = inject(BookDialogHelperService);
private readonly t = inject(TranslocoService);
initializeLibraryMenuItems(entity: Library | Shelf | MagicShelf | null): MenuItem[] {
initializeLibraryMenuItems(entity: Library | null): MenuItem[] {
return [
{
label: this.t.translate('book.shelfMenuService.library.optionsLabel'),
@@ -85,9 +86,12 @@ export class LibraryShelfMenuService {
severity: 'success',
},
accept: () => {
const entityId = entity?.id;
if (entityId == null) return;
this.libraryService.refreshLibrary(entityId).subscribe({
const libraryId = entity?.id;
if (libraryId == null) {
return;
}
this.libraryService.refreshLibrary(libraryId).subscribe({
complete: () => {
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.libraryRefreshSuccessDetail')});
},
@@ -149,13 +153,14 @@ export class LibraryShelfMenuService {
},
accept: () => {
const loader = this.loadingService.show(this.t.translate('book.shelfMenuService.loading.deletingLibrary', {name: entity?.name}));
const entityId = entity?.id;
if (entityId == null) {
const libraryId = entity?.id;
if (libraryId == null) {
this.loadingService.hide(loader);
return;
}
this.libraryService.deleteLibrary(entityId)
this.libraryService.deleteLibrary(libraryId)
.pipe(finalize(() => this.loadingService.hide(loader)))
.subscribe({
complete: () => {
@@ -219,9 +224,12 @@ export class LibraryShelfMenuService {
severity: 'secondary'
},
accept: () => {
const entityId = entity?.id;
if (entityId == null) return;
this.shelfService.deleteShelf(entityId).subscribe({
const shelfId = entity?.id;
if (shelfId == null) {
return;
}
this.shelfService.deleteShelf(shelfId).subscribe({
complete: () => {
this.router.navigate(['/']);
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.shelfDeletedDetail')});
@@ -293,9 +301,12 @@ export class LibraryShelfMenuService {
severity: 'secondary'
},
accept: () => {
const entityId = entity?.id;
if (entityId == null) return;
this.magicShelfService.deleteShelf(entityId).subscribe({
const shelfId = entity?.id;
if (shelfId == null) {
return;
}
this.magicShelfService.deleteShelf(shelfId).subscribe({
complete: () => {
this.router.navigate(['/']);
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.magicShelfDeletedDetail')});
@@ -88,7 +88,7 @@
width: 116px;
flex: 0 0 124px;
scroll-snap-align: start;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
transition: transform 0.25s ease;
position: relative;
&.square-card {
@@ -103,52 +103,7 @@
}
&:hover, &.menu-open {
transform: translateY(-4px) scale(1.04);
filter: drop-shadow(0 25px 50px rgb(0 0 0 / 40%));
&::after {
opacity: 1;
transform: scale(1.2);
}
&::before {
opacity: 0.8;
}
}
&::before {
content: '';
position: absolute;
inset: -2px;
background: linear-gradient(
135deg,
color-mix(in srgb, var(--p-primary-400), transparent 70%),
color-mix(in srgb, var(--p-primary-800), transparent 70%)
);
border-radius: 12px;
z-index: -1;
opacity: 0;
transition: opacity 0.4s ease;
filter: blur(8px);
}
&::after {
content: '';
position: absolute;
bottom: -8px;
left: 10%;
right: 10%;
height: 5px;
background: linear-gradient(
90deg,
transparent,
var(--p-primary-500),
transparent
);
border-radius: 50%;
opacity: 0;
transition: all 0.4s ease;
filter: blur(6px);
transform: translateY(-2px);
}
// Audiobook covers should fill the container height
@@ -409,7 +409,7 @@ label {
gap: 0.5rem;
padding: 0.75rem 1rem;
min-height: 2.5rem;
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 0.75rem;
font-size: 0.875rem;
font-weight: 600;
@@ -181,7 +181,7 @@
text-transform: none;
letter-spacing: normal;
color: var(--text-secondary-color);
background: var(--surface-ground);
background: var(--ground-background);
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 0.125rem 0.5rem;
@@ -293,7 +293,7 @@
justify-content: center;
width: 120px;
height: 120px;
background: var(--surface-ground);
background: var(--ground-background);
border: 1px dashed var(--border-color);
border-radius: 6px;
color: var(--text-secondary-color);
@@ -635,7 +635,7 @@
align-items: center;
justify-content: space-between;
padding: 0.625rem 0.875rem;
background: var(--surface-ground);
background: var(--ground-background);
border-bottom: 1px solid var(--border-color);
border-radius: 0.75rem 0.75rem 0 0;
font-weight: 600;
@@ -88,7 +88,7 @@
justify-content: center;
padding: 3rem 2rem;
text-align: center;
background: var(--surface-ground);
background: var(--ground-background);
border: 1px dashed var(--border-color);
border-radius: 0.75rem;
@@ -147,7 +147,7 @@
}
.json-viewer {
background: var(--surface-ground);
background: var(--ground-background);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
overflow: hidden;
@@ -189,7 +189,7 @@
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
background: var(--surface-ground);
background: var(--ground-background);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
font-size: 0.875rem;
@@ -37,8 +37,8 @@
// Search Section
.search-section {
flex-shrink: 0;
background: var(--surface-ground);
border: 1px solid var(--surface-border);
background: var(--ground-background);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 1.25rem 1.5rem;
margin-bottom: 1.5rem;
@@ -123,8 +123,8 @@
justify-content: center;
padding: 3rem;
text-align: center;
background: var(--surface-ground);
border: 1px dashed var(--surface-border);
background: var(--ground-background);
border: 1px dashed var(--border-color);
border-radius: 12px;
h3 {
@@ -181,7 +181,7 @@
gap: 0.75rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--surface-border);
border-bottom: 1px solid var(--border-color);
.results-count {
display: flex;
@@ -224,7 +224,7 @@
height: 220px;
border-radius: 8px;
overflow: hidden;
background: var(--surface-ground);
background: var(--ground-background);
border: 2px solid transparent;
&:hover {
@@ -257,7 +257,7 @@
border: 1px solid rgb(128 128 128 / 20%);
border-radius: 8px;
overflow: hidden;
background: var(--surface-ground);
background: var(--ground-background);
display: flex;
flex-direction: column;
flex: 1;
@@ -349,7 +349,7 @@
.delete-info {
padding: 1rem;
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 8px;
border: 1px solid rgb(128 128 128 / 20%);
@@ -394,7 +394,7 @@
.current-value {
padding: 1rem;
background: var(--surface-ground);
background: var(--ground-background);
border: 1px solid rgb(128 128 128 / 20%);
border-radius: 8px;
margin-bottom: 1.5rem;
@@ -70,17 +70,17 @@
.sidecar-section-header {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--surface-border);
border-top: 1px solid var(--border-color);
}
.nested-setting {
margin-left: 1.5rem;
padding-left: 1rem;
border-left: 2px solid var(--surface-border);
border-left: 2px solid var(--border-color);
}
code {
background: var(--surface-ground);
background: var(--ground-background);
padding: 0.125rem 0.375rem;
border-radius: 4px;
font-family: monospace;
@@ -5,10 +5,10 @@
}
.add-restriction-form {
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 8px;
padding: 1rem;
border: 1px solid var(--surface-border);
border: 1px solid var(--border-color);
.form-row {
display: flex;
@@ -76,10 +76,10 @@
}
.restrictions-group {
background: var(--surface-ground);
background: var(--ground-background);
border-radius: 8px;
padding: 1rem;
border: 1px solid var(--surface-border);
border: 1px solid var(--border-color);
.group-title {
display: flex;
@@ -103,7 +103,7 @@
}
.config-modal {
background: var(--surface-card, rgb(30 30 30 / 95%));
background: var(--card-background, rgb(30 30 30 / 95%));
border-radius: 12px;
box-shadow: 0 20px 40px rgb(0 0 0 / 40%);
border: 1px solid rgb(255 255 255 / 15%);
@@ -120,7 +120,7 @@
align-items: center;
padding: 20px 25px;
border-bottom: 1px solid rgb(255 255 255 / 10%);
background: var(--surface-ground, rgb(40 40 40 / 80%));
background: var(--ground-background, rgb(40 40 40 / 80%));
h3 {
color: var(--text-color, #fff);
@@ -167,7 +167,7 @@
gap: 12px;
padding: 20px 25px;
border-bottom: 1px solid rgb(255 255 255 / 10%);
background: var(--surface-ground, rgb(35 35 35 / 60%));
background: var(--ground-background, rgb(35 35 35 / 60%));
.config-action-btn {
background: rgb(255 255 255 / 10%);