feat(reports): implement reports page and data visualization components
Implement a comprehensive reports dashboard including user question summaries, AI performance metrics, and usage trends. This includes the creation of several reusable chart components and supporting services. - Add `ReportsPage` with tabbed navigation for questions and performance - Implement `ReportsService` with mock data support for rapid development - Create reusable UI components: `BarChartComponent`, `DoughnutChartComponent`, and `LineChartComponent` - Add `format.util.ts` for Persian digit and number formatting - Integrate 'Lahze' font family and add font assets - Add unit tests for `ReportsPage` and `ReportsService`
This commit is contained in:
@@ -0,0 +1,181 @@
|
||||
.doughnut-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.doughnut-chart {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.doughnut-svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.doughnut-base {
|
||||
fill: none;
|
||||
stroke: var(--doughnut-base-bg, rgba(100, 116, 139, 0.14));
|
||||
stroke-width: 22;
|
||||
}
|
||||
|
||||
.doughnut-segment {
|
||||
fill: none;
|
||||
stroke-width: 22;
|
||||
stroke-linecap: butt;
|
||||
cursor: default;
|
||||
transition: stroke-width 0.2s ease, opacity 0.2s ease;
|
||||
animation: doughnutDraw 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||
}
|
||||
|
||||
.doughnut-segment-active {
|
||||
stroke-width: 27;
|
||||
}
|
||||
|
||||
.doughnut-center {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.15rem;
|
||||
pointer-events: none;
|
||||
text-align: center;
|
||||
padding: 0 2.2rem;
|
||||
}
|
||||
|
||||
.doughnut-center-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.doughnut-center-caption {
|
||||
font-size: 0.6875rem;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.doughnut-legend {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.5rem 1rem;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.35rem 0.5rem;
|
||||
border-radius: 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
transition: background 0.2s ease;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.legend-item-active,
|
||||
.legend-item:hover {
|
||||
background: var(--sidebar-hover);
|
||||
}
|
||||
|
||||
.legend-dot {
|
||||
width: 0.625rem;
|
||||
height: 0.625rem;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.legend-label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.legend-value {
|
||||
margin-inline-start: auto;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.legend-percent {
|
||||
min-width: 2.75rem;
|
||||
text-align: end;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.chart-tooltip {
|
||||
position: absolute;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
min-width: max-content;
|
||||
max-width: 240px;
|
||||
padding: 0.55rem 0.75rem;
|
||||
border: 1px solid var(--card-border);
|
||||
border-radius: 0.75rem;
|
||||
background: var(--surface-bg);
|
||||
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
|
||||
transform: translate(50%, -110%);
|
||||
pointer-events: none;
|
||||
animation: tooltipFade 0.15s ease-out;
|
||||
}
|
||||
|
||||
.chart-tooltip-title {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.chart-tooltip-row {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.chart-empty {
|
||||
padding: 2.5rem 1rem;
|
||||
text-align: center;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
@keyframes doughnutDraw {
|
||||
from {
|
||||
opacity: 0;
|
||||
stroke-dasharray: 0 377;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tooltipFade {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.doughnut-segment {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
:host-context([data-bs-theme='dark']) .doughnut-base {
|
||||
stroke: rgba(148, 163, 184, 0.18);
|
||||
}
|
||||
|
||||
:host-context([data-bs-theme='dark']) .chart-tooltip {
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
Reference in New Issue
Block a user