feat(lotto): 브리핑 컴포넌트 + CSS
This commit is contained in:
@@ -1475,3 +1475,37 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Briefing UI ──────────────────────────────────────────────────────────── */
|
||||||
|
.briefing-header { padding: 16px; border-radius: 12px; background: rgba(129,140,248,0.08); margin-bottom: 16px; }
|
||||||
|
.briefing-header-row { display: flex; justify-content: space-between; align-items: center; }
|
||||||
|
.briefing-meta { display: flex; gap: 12px; color: #94a3b8; font-size: 0.85rem; margin-top: 4px; flex-wrap: wrap; }
|
||||||
|
.briefing-confidence strong { color: #e2e8f0; }
|
||||||
|
.briefing-tokens { font-family: monospace; }
|
||||||
|
.briefing-confidence-bar { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 8px; overflow: hidden; }
|
||||||
|
.briefing-confidence-bar > div { height: 100%; background: linear-gradient(90deg, #818cf8, #34d399); transition: width .3s; }
|
||||||
|
.briefing-summary { padding: 12px 16px; background: rgba(0,0,0,0.2); border-radius: 10px; margin-bottom: 16px; }
|
||||||
|
.briefing-summary h3 { margin: 0 0 8px; }
|
||||||
|
.briefing-3lines { margin: 0; padding-left: 20px; }
|
||||||
|
.briefing-hotcold { color: #fbbf24; margin-top: 8px; }
|
||||||
|
.briefing-warning { color: #f87171; margin-top: 8px; }
|
||||||
|
.pick-card { padding: 12px; border-radius: 10px; background: rgba(255,255,255,0.04); border-left: 3px solid #64748b; margin-bottom: 8px; }
|
||||||
|
.pick-card--안정 { border-left-color: #34d399; }
|
||||||
|
.pick-card--균형 { border-left-color: #fbbf24; }
|
||||||
|
.pick-card--공격 { border-left-color: #f87171; }
|
||||||
|
.pick-card-header { display: flex; justify-content: space-between; font-size: 0.85rem; color: #94a3b8; margin-bottom: 6px; }
|
||||||
|
.pick-card-balls { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
|
||||||
|
.ball { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; color: #fff; }
|
||||||
|
.ball--1 { background: #fbbf24; } .ball--2 { background: #60a5fa; } .ball--3 { background: #f87171; }
|
||||||
|
.ball--4 { background: #94a3b8; } .ball--5 { background: #34d399; }
|
||||||
|
.pick-card-reason { margin: 0; font-size: 0.85rem; color: #cbd5e1; }
|
||||||
|
.briefing-empty { text-align: center; padding: 40px 20px; color: #94a3b8; }
|
||||||
|
.briefing-empty button { margin-top: 12px; padding: 8px 20px; }
|
||||||
|
.briefing-empty-hint { font-size: 0.85rem; }
|
||||||
|
.briefing-error { color: #f87171; margin-top: 8px; }
|
||||||
|
.curator-usage-footer { display: flex; gap: 12px; padding: 10px 14px; background: rgba(0,0,0,0.25); border-radius: 8px; font-size: 0.8rem; color: #94a3b8; margin-top: 24px; flex-wrap: wrap; font-family: monospace; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.briefing-meta { font-size: 0.75rem; }
|
||||||
|
.briefing-tokens { width: 100%; }
|
||||||
|
.pick-card-balls { justify-content: center; }
|
||||||
|
}
|
||||||
|
|||||||
12
src/pages/lotto/components/briefing/BriefingEmpty.jsx
Normal file
12
src/pages/lotto/components/briefing/BriefingEmpty.jsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export default function BriefingEmpty({ regenerating, onRegenerate, error }) {
|
||||||
|
return (
|
||||||
|
<div className="briefing-empty">
|
||||||
|
<p>아직 이번 주 브리핑이 없습니다.</p>
|
||||||
|
<p className="briefing-empty-hint">매주 월요일 07:00에 자동 생성됩니다.</p>
|
||||||
|
<button onClick={onRegenerate} disabled={regenerating}>
|
||||||
|
{regenerating ? '⏳ 생성 중...' : '지금 생성'}
|
||||||
|
</button>
|
||||||
|
{error && <p className="briefing-error">⚠️ {error}</p>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
28
src/pages/lotto/components/briefing/BriefingHeader.jsx
Normal file
28
src/pages/lotto/components/briefing/BriefingHeader.jsx
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { estimateCost, fmtUsd, fmtTokens } from './pricing';
|
||||||
|
|
||||||
|
export default function BriefingHeader({ briefing, regenerating, onRegenerate }) {
|
||||||
|
const cost = estimateCost(briefing);
|
||||||
|
const genDate = new Date(briefing.generated_at).toLocaleString('ko-KR');
|
||||||
|
return (
|
||||||
|
<div className="briefing-header">
|
||||||
|
<div className="briefing-header-row">
|
||||||
|
<h2>🗓 #{briefing.draw_no}회 브리핑</h2>
|
||||||
|
<button onClick={onRegenerate} disabled={regenerating}>
|
||||||
|
{regenerating ? '⏳ 생성 중...' : '🔄 다시 생성'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="briefing-meta">
|
||||||
|
<span>{genDate}</span>
|
||||||
|
<span className="briefing-confidence">
|
||||||
|
신뢰도 <strong>{briefing.confidence}</strong>/100
|
||||||
|
</span>
|
||||||
|
<span className="briefing-tokens">
|
||||||
|
{fmtTokens(briefing.tokens_input)} in · {fmtTokens(briefing.tokens_output)} out · {fmtUsd(cost)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="briefing-confidence-bar">
|
||||||
|
<div style={{ width: `${briefing.confidence}%` }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
16
src/pages/lotto/components/briefing/BriefingSummary.jsx
Normal file
16
src/pages/lotto/components/briefing/BriefingSummary.jsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export default function BriefingSummary({ narrative }) {
|
||||||
|
return (
|
||||||
|
<div className="briefing-summary">
|
||||||
|
<h3>{narrative.headline}</h3>
|
||||||
|
<ul className="briefing-3lines">
|
||||||
|
{narrative.summary_3lines.map((line, i) => <li key={i}>{line}</li>)}
|
||||||
|
</ul>
|
||||||
|
{narrative.hot_cold_comment && (
|
||||||
|
<p className="briefing-hotcold">🔥❄️ {narrative.hot_cold_comment}</p>
|
||||||
|
)}
|
||||||
|
{narrative.warnings && (
|
||||||
|
<p className="briefing-warning">⚠️ {narrative.warnings}</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
17
src/pages/lotto/components/briefing/CuratorUsageFooter.jsx
Normal file
17
src/pages/lotto/components/briefing/CuratorUsageFooter.jsx
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import useCuratorUsage from '../../hooks/useCuratorUsage';
|
||||||
|
import { estimateCost, fmtUsd, fmtTokens } from './pricing';
|
||||||
|
|
||||||
|
export default function CuratorUsageFooter() {
|
||||||
|
const { usage } = useCuratorUsage(30);
|
||||||
|
if (!usage) return null;
|
||||||
|
const cost = estimateCost(usage);
|
||||||
|
return (
|
||||||
|
<div className="curator-usage-footer">
|
||||||
|
<span>최근 30일 큐레이터:</span>
|
||||||
|
<span>{usage.calls}회 호출</span>
|
||||||
|
<span>{fmtTokens(usage.tokens_input + usage.tokens_output)} tokens</span>
|
||||||
|
<span>{fmtUsd(cost)}</span>
|
||||||
|
<span>캐시 {(usage.cache_hit_rate * 100).toFixed(0)}%</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
18
src/pages/lotto/components/briefing/PickSetCard.jsx
Normal file
18
src/pages/lotto/components/briefing/PickSetCard.jsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const RISK_BADGE = { '안정': '🟢', '균형': '🟡', '공격': '🔴' };
|
||||||
|
|
||||||
|
export default function PickSetCard({ pick, index }) {
|
||||||
|
return (
|
||||||
|
<div className={`pick-card pick-card--${pick.risk_tag}`}>
|
||||||
|
<div className="pick-card-header">
|
||||||
|
<span className="pick-card-index">Set {index + 1}</span>
|
||||||
|
<span className="pick-card-risk">{RISK_BADGE[pick.risk_tag] || '⚪'} {pick.risk_tag}</span>
|
||||||
|
</div>
|
||||||
|
<div className="pick-card-balls">
|
||||||
|
{pick.numbers.map(n => (
|
||||||
|
<span key={n} className={`ball ball--${Math.ceil(n / 10)}`}>{n}</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="pick-card-reason">{pick.reason}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
23
src/pages/lotto/components/briefing/pricing.js
Normal file
23
src/pages/lotto/components/briefing/pricing.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
const IN_PER_M = 3.00;
|
||||||
|
const OUT_PER_M = 15.00;
|
||||||
|
const CACHE_READ_PER_M = 0.30;
|
||||||
|
const CACHE_WRITE_PER_M = 3.75;
|
||||||
|
|
||||||
|
export function estimateCost({ tokens_input = 0, tokens_output = 0, cache_read = 0, cache_write = 0 }) {
|
||||||
|
const usd =
|
||||||
|
(tokens_input / 1_000_000) * IN_PER_M +
|
||||||
|
(tokens_output / 1_000_000) * OUT_PER_M +
|
||||||
|
(cache_read / 1_000_000) * CACHE_READ_PER_M +
|
||||||
|
(cache_write / 1_000_000) * CACHE_WRITE_PER_M;
|
||||||
|
return usd;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fmtUsd(usd) {
|
||||||
|
if (usd < 0.01) return `$${usd.toFixed(4)}`;
|
||||||
|
return `$${usd.toFixed(3)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fmtTokens(n) {
|
||||||
|
if (n >= 1000) return `${(n / 1000).toFixed(1)}K`;
|
||||||
|
return String(n);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user