diff --git a/booklore-ui/src/app/features/stats/component/peak-hours-chart/peak-hours-chart.component.ts b/booklore-ui/src/app/features/stats/component/peak-hours-chart/peak-hours-chart.component.ts
index 1dab8237c..a4056b8e1 100644
--- a/booklore-ui/src/app/features/stats/component/peak-hours-chart/peak-hours-chart.component.ts
+++ b/booklore-ui/src/app/features/stats/component/peak-hours-chart/peak-hours-chart.component.ts
@@ -88,9 +88,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
if (label === 'Sessions') {
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
} else {
- const hours = Math.floor(value / 3600);
- const minutes = Math.floor((value % 3600) / 60);
- return `${label}: ${hours}h ${minutes}m`;
+ return `${label}: ${value} min`;
}
}
}
@@ -149,7 +147,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
position: 'right',
title: {
display: true,
- text: 'Duration (minutes)',
+ text: 'Avg Duration (min)',
color: 'rgba(251, 191, 36, 0.9)',
font: {
family: "'Inter', sans-serif",
@@ -227,9 +225,13 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
return hourData?.sessionCount || 0;
});
- const durations = allHours.map(hour => {
+ // Calculate average duration per session (in minutes) for each hour
+ const avgDurations = allHours.map(hour => {
const hourData = hourMap.get(hour);
- return hourData ? hourData.totalDurationSeconds / 60 : 0; // Convert to minutes
+ if (hourData && hourData.sessionCount > 0) {
+ return Math.round(hourData.totalDurationSeconds / 60 / hourData.sessionCount);
+ }
+ return 0;
});
this.chartDataSubject.next({
@@ -251,8 +253,8 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
yAxisID: 'y'
},
{
- label: 'Duration (minutes)',
- data: durations,
+ label: 'Avg Duration (min)',
+ data: avgDurations,
borderColor: 'rgba(251, 191, 36, 0.9)',
backgroundColor: 'rgba(251, 191, 36, 0.1)',
borderWidth: 2,
diff --git a/booklore-ui/src/app/features/stats/component/reading-dna-chart/reading-dna-chart.component.ts b/booklore-ui/src/app/features/stats/component/reading-dna-chart/reading-dna-chart.component.ts
index 9fc6a8f6f..e2847f5e6 100644
--- a/booklore-ui/src/app/features/stats/component/reading-dna-chart/reading-dna-chart.component.ts
+++ b/booklore-ui/src/app/features/stats/component/reading-dna-chart/reading-dna-chart.component.ts
@@ -101,7 +101,7 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
backgroundColor: 'rgba(0, 0, 0, 0.95)',
titleColor: '#ffffff',
bodyColor: '#ffffff',
- borderColor: '#4fc3f7',
+ borderColor: '#e91e63',
borderWidth: 2,
cornerRadius: 8,
padding: 16,
@@ -199,8 +199,8 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
];
const gradientColors = [
- '#ff6b9d', '#45aaf2', '#96f7d2', '#feca57',
- '#ff9ff3', '#54a0ff', '#5f27cd', '#00d2d3'
+ '#e91e63', '#2196f3', '#00bcd4', '#ff9800',
+ '#9c27b0', '#3f51b5', '#673ab7', '#009688'
];
this.chartDataSubject.next({
@@ -211,8 +211,8 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
datasets: [{
label: 'Reading DNA Profile',
data,
- backgroundColor: 'rgba(79, 195, 247, 0.2)',
- borderColor: '#4fc3f7',
+ backgroundColor: 'rgba(233, 30, 99, 0.2)',
+ borderColor: '#e91e63',
borderWidth: 3,
pointBackgroundColor: gradientColors,
pointBorderColor: '#ffffff',
@@ -514,49 +514,49 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
trait: 'Adventurous',
score: profile.adventurous,
description: 'You explore diverse genres and experimental content',
- color: '#ff6b9d'
+ color: '#e91e63'
},
{
trait: 'Perfectionist',
score: profile.perfectionist,
description: 'You prefer high-quality books and finish what you start',
- color: '#45aaf2'
+ color: '#2196f3'
},
{
trait: 'Intellectual',
score: profile.intellectual,
description: 'You gravitate toward complex, educational material',
- color: '#96f7d2'
+ color: '#00bcd4'
},
{
trait: 'Emotional',
score: profile.emotional,
description: 'You connect emotionally with fiction and personal stories',
- color: '#feca57'
+ color: '#ff9800'
},
{
trait: 'Patient',
score: profile.patient,
description: 'You tackle long books and complete series',
- color: '#ff9ff3'
+ color: '#9c27b0'
},
{
trait: 'Social',
score: profile.social,
description: 'You enjoy popular, widely-discussed books',
- color: '#54a0ff'
+ color: '#3f51b5'
},
{
trait: 'Nostalgic',
score: profile.nostalgic,
description: 'You appreciate classic literature and older works',
- color: '#5f27cd'
+ color: '#673ab7'
},
{
trait: 'Ambitious',
score: profile.ambitious,
description: 'You challenge yourself with volume and difficulty',
- color: '#00d2d3'
+ color: '#009688'
}
];
}
diff --git a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.html b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.html
index 34ce9c953..fce032e68 100644
--- a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.html
+++ b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.html
@@ -77,7 +77,11 @@
[style.left.%]="session.left"
[style.width.%]="session.width"
[style.top]="session.totalLevels > 1 ? 'calc(' + session.level + ' / ' + session.totalLevels + ' * 100% + ' + session.level * 2 + 'px)' : '0'"
- [style.height]="session.totalLevels > 1 ? 'calc((1 / ' + session.totalLevels + ' * 100%) - ' + (session.totalLevels - 1) * 2 / session.totalLevels + 'px)' : '100%'">
+ [style.height]="session.totalLevels > 1 ? 'calc((1 / ' + session.totalLevels + ' * 100%) - ' + (session.totalLevels - 1) * 2 / session.totalLevels + 'px)' : '100%'"
+ [pTooltip]="getTooltipContent(session)"
+ [escape]="false"
+ tooltipPosition="top"
+ [appendTo]="'body'">
@if (isDurationGreaterThanOneHour(session.duration)) {
@@ -88,36 +92,6 @@
}
-
-
}
diff --git a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.scss b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.scss
index 53cc8775f..4e1df9608 100644
--- a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.scss
+++ b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.scss
@@ -290,15 +290,39 @@
}
}
+ &.book-type-fb2 {
+ background: rgba(34, 197, 94, 0.8);
+ border: 1px solid rgba(34, 197, 94, 1);
+ box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
+
+ &:hover {
+ box-shadow: 0 4px 8px rgba(34, 197, 94, 0.5);
+ }
+ }
+
+ &.book-type-mobi {
+ background: rgba(168, 85, 247, 0.8);
+ border: 1px solid rgba(168, 85, 247, 1);
+ box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
+
+ &:hover {
+ box-shadow: 0 4px 8px rgba(168, 85, 247, 0.5);
+ }
+ }
+
+ &.book-type-azw3 {
+ background: rgba(236, 72, 153, 0.8);
+ border: 1px solid rgba(236, 72, 153, 1);
+ box-shadow: 0 2px 4px rgba(236, 72, 153, 0.3);
+
+ &:hover {
+ box-shadow: 0 4px 8px rgba(236, 72, 153, 0.5);
+ }
+ }
+
&:hover {
transform: translateY(-2px);
z-index: 10;
-
- .session-tooltip {
- opacity: 1;
- transform: translate(-50%, 0);
- pointer-events: auto;
- }
}
.session-content {
@@ -333,32 +357,33 @@
}
}
-.session-tooltip {
- position: absolute;
- bottom: calc(100% + 15px);
- left: 50%;
- transform: translate(-50%, 10px);
- background: rgba(30, 30, 30, 0.98);
- border: 1px solid rgba(255, 255, 255, 0.2);
- border-radius: 8px;
- padding: 0;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
- z-index: 9999;
- pointer-events: none;
- min-width: 320px;
- max-width: 350px;
- backdrop-filter: blur(10px);
- opacity: 0;
- transition: opacity 0.2s ease, transform 0.2s ease;
- white-space: normal;
+::ng-deep .p-tooltip {
+ --p-tooltip-max-width: 300px;
+ --p-tooltip-background: rgba(30, 30, 30, 0.98);
+ --p-tooltip-color: #ffffff;
+ --p-tooltip-border-radius: 12px;
+ --p-tooltip-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
+ --p-tooltip-padding: 0 !important;
+ --p-tooltip-gutter: 12px;
- .tooltip-content {
- display: flex;
- gap: 1rem;
- padding: 1rem;
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ min-width: 320px;
+ padding: 0 !important;
+
+ .p-tooltip-text {
+ padding: 0 !important;
+ margin: 0 !important;
+ white-space: normal;
}
- .tooltip-cover {
+ .session-tooltip-content {
+ display: flex;
+ gap: 1rem;
+ padding: 0.75rem;
+ }
+
+ .session-tooltip-cover {
flex-shrink: 0;
width: 80px;
height: 120px;
@@ -372,53 +397,50 @@
}
}
- .tooltip-details {
+ .session-tooltip-details {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
}
- .tooltip-header {
+ .session-tooltip-header {
display: flex;
align-items: center;
gap: 0.75rem;
- padding: 0;
- background: none;
+ margin-bottom: 0.75rem;
i {
font-size: 1.1rem;
color: rgba(239, 68, 68, 1);
}
-
- .tooltip-title {
- color: #ffffff;
- font-weight: 600;
- font-size: 0.95rem;
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
}
- .tooltip-divider {
+ .session-tooltip-title {
+ color: #ffffff;
+ font-weight: 600;
+ font-size: 0.95rem;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .session-tooltip-divider {
height: 1px;
background: linear-gradient(90deg,
transparent 0%,
rgba(255, 255, 255, 0.1) 50%,
transparent 100%);
- margin: 0.75rem 0;
+ margin-bottom: 0.75rem;
}
- .tooltip-body {
- padding: 0;
+ .session-tooltip-body {
display: flex;
flex-direction: column;
gap: 0.625rem;
}
- .tooltip-row {
+ .session-tooltip-row {
display: grid;
grid-template-columns: auto auto 1fr;
align-items: center;
@@ -431,31 +453,17 @@
width: 16px;
text-align: center;
}
-
- .tooltip-label {
- color: rgba(255, 255, 255, 0.7);
- font-weight: 500;
- }
-
- .tooltip-value {
- color: #ffffff;
- text-align: right;
- font-weight: 500;
- }
}
- &::after {
- content: '';
- position: absolute;
- top: 100%;
- left: 50%;
- transform: translateX(-50%);
- width: 0;
- height: 0;
- border-left: 8px solid transparent;
- border-right: 8px solid transparent;
- border-top: 8px solid rgba(30, 30, 30, 0.98);
- filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
+ .session-tooltip-label {
+ color: rgba(255, 255, 255, 0.7);
+ font-weight: 500;
+ }
+
+ .session-tooltip-value {
+ color: #ffffff;
+ text-align: right;
+ font-weight: 500;
}
}
diff --git a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.ts b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.ts
index 117b2a081..5d13dcf04 100644
--- a/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.ts
+++ b/booklore-ui/src/app/features/stats/component/reading-session-timeline/reading-session-timeline.component.ts
@@ -7,6 +7,7 @@ import {catchError} from 'rxjs/operators';
import {of} from 'rxjs';
import {Select} from 'primeng/select';
import {FormsModule} from '@angular/forms';
+import {Tooltip} from 'primeng/tooltip';
import {
addWeeks,
endOfISOWeek,
@@ -51,7 +52,7 @@ interface DayTimeline {
@Component({
selector: 'app-reading-session-timeline',
standalone: true,
- imports: [CommonModule, Select, FormsModule],
+ imports: [CommonModule, Select, FormsModule, Tooltip],
templateUrl: './reading-session-timeline.component.html',
styleUrls: ['./reading-session-timeline.component.scss']
})
@@ -340,9 +341,9 @@ export class ReadingSessionTimelineComponent implements OnInit {
const secs = totalSeconds % 60;
const parts: string[] = [];
- if (hours) parts.push(`${hours}H`);
- if (mins || hours) parts.push(`${mins}M`);
- parts.push(`${secs}S`);
+ if (hours) parts.push(`${hours}h`);
+ if (mins || hours) parts.push(`${mins}m`);
+ parts.push(`${secs}s`);
return parts.join(' ');
}
@@ -365,4 +366,40 @@ export class ReadingSessionTimelineComponent implements OnInit {
public getCoverUrl(bookId: number): string {
return this.urlHelperService.getThumbnailUrl1(bookId);
}
+
+ public getTooltipContent(session: TimelineSession): string {
+ return `
+
+ `;
+ }
}