Show all metric insights with descriptions
This commit is contained in:
1 parent
741fce0adb
commit
cfbc74d882
9 files changed
+171
-33
No files matched your search
+34
-13
@@ -361,36 +361,58 @@
|
||||
|
||||
.metric-card-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
min-width: 0;
|
||||
min-height: 94px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--surface-soft);
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.metric-card span {
|
||||
color: var(--text-muted);
|
||||
font-size: 13px;
|
||||
.metric-card-heading {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.metric-card-heading h3 {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.metric-card strong {
|
||||
.metric-card-heading strong {
|
||||
flex: 0 0 auto;
|
||||
color: var(--text-strong);
|
||||
font-size: 24px;
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.metric-card p {
|
||||
margin: 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.metric-card > span {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: 1.35;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.champion-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
@@ -640,8 +662,7 @@
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.summary-stat-grid,
|
||||
.metric-card-list {
|
||||
.summary-stat-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { METRICS, type MetricId, type Role } from '@persona-lenz/shared';
|
||||
import {
|
||||
METRICS,
|
||||
type MetricDefinition,
|
||||
type MetricId,
|
||||
type Role,
|
||||
} from '@persona-lenz/shared';
|
||||
|
||||
export const ROLE_LABELS: Record<Role, string> = {
|
||||
BOTTOM: '원딜',
|
||||
@@ -22,6 +27,9 @@ export const STAGE_LABELS: Record<string, string> = {
|
||||
const metricLabelById = new Map<MetricId, string>(
|
||||
METRICS.map((metric) => [metric.id, metric.label]),
|
||||
);
|
||||
const metricDefinitionById = new Map<MetricId, MetricDefinition>(
|
||||
METRICS.map((metric) => [metric.id, metric]),
|
||||
);
|
||||
|
||||
export function formatPercent(value: number): string {
|
||||
return `${Math.round(value * 100)}%`;
|
||||
@@ -31,6 +39,25 @@ export function getMetricLabel(metricId: MetricId): string {
|
||||
return metricLabelById.get(metricId) ?? metricId;
|
||||
}
|
||||
|
||||
export function getMetricDescription(metricId: MetricId): string {
|
||||
return (
|
||||
metricDefinitionById.get(metricId)?.description ??
|
||||
'정규화된 플레이스타일 지표입니다.'
|
||||
);
|
||||
}
|
||||
|
||||
export function getMetricDirectionLabel(metricId: MetricId): string {
|
||||
const direction = metricDefinitionById.get(metricId)?.direction;
|
||||
|
||||
if (direction === 'lowerIsBetter') {
|
||||
return '낮을수록 좋음';
|
||||
}
|
||||
if (direction === 'higherIsBetter') {
|
||||
return '높을수록 좋음';
|
||||
}
|
||||
return '참고 지표';
|
||||
}
|
||||
|
||||
export function getStageLabel(stage?: string): string {
|
||||
if (!stage) {
|
||||
return '작업 상태 확인';
|
||||
|
||||
@@ -33,6 +33,8 @@ import {
|
||||
import {
|
||||
formatPercent,
|
||||
formatTier,
|
||||
getMetricDescription,
|
||||
getMetricDirectionLabel,
|
||||
getMetricLabel,
|
||||
ROLE_LABELS,
|
||||
} from '../lib/format';
|
||||
@@ -251,8 +253,16 @@ export function DashboardPage() {
|
||||
</section>
|
||||
|
||||
<section className="insight-grid" aria-label="강점과 약점">
|
||||
<MetricInsightList title="강점 Top 3" values={analysis.strengths} />
|
||||
<MetricInsightList title="약점 Top 3" values={analysis.weaknesses} />
|
||||
<MetricInsightList
|
||||
description="방향성을 반영했을 때 현재 프로필에서 상대적으로 좋은 순서입니다."
|
||||
title="강점 지표"
|
||||
values={analysis.strengths}
|
||||
/>
|
||||
<MetricInsightList
|
||||
description="방향성을 반영했을 때 개선 여지가 큰 순서입니다."
|
||||
title="약점 지표"
|
||||
values={analysis.weaknesses}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section className="champion-section" aria-labelledby="champion-title">
|
||||
@@ -310,20 +320,32 @@ function SummaryStat({ label, value }: { label: string; value: string }) {
|
||||
}
|
||||
|
||||
function MetricInsightList({
|
||||
description,
|
||||
title,
|
||||
values,
|
||||
}: {
|
||||
description: string;
|
||||
title: string;
|
||||
values: MetricValueDto[];
|
||||
}) {
|
||||
return (
|
||||
<section className="insight-section">
|
||||
<h2>{title}</h2>
|
||||
<div className="section-heading">
|
||||
<div>
|
||||
<h2>{title}</h2>
|
||||
<p className="section-copy">{description}</p>
|
||||
</div>
|
||||
<span className="status-pill">{values.length} metrics</span>
|
||||
</div>
|
||||
<div className="metric-card-list">
|
||||
{values.map((metricValue) => (
|
||||
<article className="metric-card" key={metricValue.metricId}>
|
||||
<span>{getMetricLabel(metricValue.metricId)}</span>
|
||||
<strong>{formatPercent(metricValue.value)}</strong>
|
||||
<div className="metric-card-heading">
|
||||
<h3>{getMetricLabel(metricValue.metricId)}</h3>
|
||||
<strong>{formatPercent(metricValue.value)}</strong>
|
||||
</div>
|
||||
<p>{getMetricDescription(metricValue.metricId)}</p>
|
||||
<span>{getMetricDirectionLabel(metricValue.metricId)}</span>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user