Refactor book service in BE and FE (#2013)

* Refactor book service in BE and FE

* Add missing method

---------

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2025-12-28 19:37:35 -07:00
committed by GitHub
co-authored by acx10
parent 60095c2173
commit 01446c2537
37 changed files with 2085 additions and 807 deletions
@@ -44,16 +44,20 @@
@if (versionInfo) {
<div style="margin-top: auto;" class="p-4 text-center w-full text-sm">
<div class="text-gray-200">
<a
[href]="getVersionUrl(versionInfo.current)"
target="_blank"
rel="noopener noreferrer"
class="hover:underline hover:text-gray-100 text-sm"
>
{{ versionInfo.current }}
</a>
@if (isSemanticVersion(versionInfo.current)) {
<a
[href]="getVersionUrl(versionInfo.current)"
target="_blank"
rel="noopener noreferrer"
class="hover:underline hover:text-gray-100 text-sm"
>
{{ versionInfo.current }}
</a>
} @else {
<span class="text-sm">{{ versionInfo.current }}</span>
}
</div>
@if (versionInfo.latest && versionInfo.latest !== versionInfo.current) {
@if (isSemanticVersion(versionInfo.current) && versionInfo.latest && versionInfo.latest !== versionInfo.current) {
<div>
<a
(click)="openChangelogDialog()"
@@ -208,6 +208,12 @@ export class AppMenuComponent implements OnInit {
: `https://github.com/booklore-app/booklore/commit/${version}`;
}
isSemanticVersion(version: string | undefined): boolean {
if (!version) return false;
const semanticVersionPattern = /^v\d+\.\d+\.\d+$/;
return semanticVersionPattern.test(version);
}
private sortArray<T>(array: T[], field: 'name' | 'id', order: 'asc' | 'desc'): T[] {
return [...array].sort((a, b) => {
const aVal = (a as any)[field] ?? '';
@@ -56,7 +56,7 @@
<app-icon-display
[icon]="getIconSelection()"
iconClass="layout-menuitem-icon"
size="16px"
size="18px"
></app-icon-display>
<span class="layout-menuitem-text menu-item-text">
{{ item.label }}
@@ -71,7 +71,7 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 0.5rem;
margin-left: 0.35rem;
}
.menu-item-end-content {
@@ -11,7 +11,7 @@
}
@if (!loading && changelog.length > 0) {
<div class="space-y-6 p-4 max-h-[70vh] overflow-auto">
<div class="space-y-6 p-4 overflow-auto">
@for (release of changelog; track release) {
<div class="border-b pb-4">
<p class="font-bold text-2xl pb-2">
@@ -59,7 +59,12 @@
(click)="shouldShowStatsMenu ? statsMenu.toggle($event) : handleStatsButtonClick($event)"
[pTooltip]="statsTooltip"
tooltipPosition="bottom">
<i class="pi pi-chart-bar text-surface-100"></i>
<svg class="multi-color-chart-icon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1.25" y="10" width="2.5" height="9" rx="0.5" fill="#ef4444"/>
<rect x="6.25" y="7" width="2.5" height="12" rx="0.5" fill="#f59e0b"/>
<rect x="11.25" y="3" width="2.5" height="16" rx="0.5" fill="#10b981"/>
<rect x="16.25" y="5" width="2.5" height="14" rx="0.5" fill="#3b82f6"/>
</svg>
</button>
@if (shouldShowStatsMenu) {
<p-menu #statsMenu [model]="statsMenuItems" [popup]="true" appendTo="body" />
@@ -213,7 +218,12 @@
class="flex items-center gap-2 w-full text-left p-2 hover:bg-surface-200 dark:hover:bg-surface-700 rounded"
(click)="shouldShowStatsMenu ? statsMenuMobile.toggle($event) : handleStatsButtonClick($event)"
>
<i class="pi pi-chart-bar text-surface-100"></i>
<svg class="multi-color-chart-icon" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="1" y="13" width="2.5" height="6" rx="0.5" fill="#ef4444"/>
<rect x="5" y="10" width="2.5" height="9" rx="0.5" fill="#f59e0b"/>
<rect x="9" y="6" width="2.5" height="13" rx="0.5" fill="#10b981"/>
<rect x="13" y="8" width="2.5" height="11" rx="0.5" fill="#3b82f6"/>
</svg>
Charts
</button>
@if (shouldShowStatsMenu) {