Compare commits
3 Commits
2543dc335d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c998753eea | |||
| a846ab89e6 | |||
| ef392f02ed |
@@ -59,6 +59,18 @@
|
|||||||
.ic-keyword-row__meta { font-size: 0.72rem; color: rgba(255,255,255,.35); white-space: nowrap; }
|
.ic-keyword-row__meta { font-size: 0.72rem; color: rgba(255,255,255,.35); white-space: nowrap; }
|
||||||
.ic-keyword-row__score { font-size: 0.75rem; font-weight: 700; color: #ec4899; min-width: 36px; text-align: right; }
|
.ic-keyword-row__score { font-size: 0.75rem; font-weight: 700; color: #ec4899; min-width: 36px; text-align: right; }
|
||||||
|
|
||||||
|
/* 키워드 페이저 (10개씩, 이전/다음) */
|
||||||
|
.ic-keywords__pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
|
||||||
|
.ic-pager-btn {
|
||||||
|
display: inline-flex; align-items: center; justify-content: center;
|
||||||
|
width: 36px; height: 36px; border-radius: 99px;
|
||||||
|
border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
|
||||||
|
color: rgba(255,255,255,.7); font-size: 1.1rem; cursor: pointer; transition: all .15s;
|
||||||
|
}
|
||||||
|
.ic-pager-btn:hover:not(:disabled) { background: rgba(236,72,153,.18); border-color: #ec4899; color: #ec4899; }
|
||||||
|
.ic-pager-btn:disabled { opacity: .3; cursor: not-allowed; }
|
||||||
|
.ic-pager-info { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,.55); min-width: 48px; text-align: center; }
|
||||||
|
|
||||||
/* 슬레이트 그리드 — 모바일 2칸 강제, 데스크탑 auto-fill */
|
/* 슬레이트 그리드 — 모바일 2칸 강제, 데스크탑 auto-fill */
|
||||||
.ic-slates-grid {
|
.ic-slates-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
||||||
import PullToRefresh from '../../components/PullToRefresh';
|
import PullToRefresh from '../../components/PullToRefresh';
|
||||||
import {
|
import {
|
||||||
getInstaStatus,
|
getInstaStatus,
|
||||||
@@ -521,11 +521,13 @@ function TriggerPanel() {
|
|||||||
|
|
||||||
/* ══════════════════════ 키워드 목록 ══════════════════════════════════════ */
|
/* ══════════════════════ 키워드 목록 ══════════════════════════════════════ */
|
||||||
const CATEGORIES = ['전체', 'economy', 'psychology', 'celebrity'];
|
const CATEGORIES = ['전체', 'economy', 'psychology', 'celebrity'];
|
||||||
|
const KEYWORDS_PER_PAGE = 10;
|
||||||
|
|
||||||
function KeywordsPanel({ onCreateSlate }) {
|
function KeywordsPanel({ onCreateSlate }) {
|
||||||
const [category, setCategory] = useState('전체');
|
const [category, setCategory] = useState('전체');
|
||||||
const [keywords, setKeywords] = useState([]);
|
const [keywords, setKeywords] = useState([]);
|
||||||
const [creating, setCreating] = useState(null); // keyword_id being created
|
const [creating, setCreating] = useState(null); // keyword_id being created
|
||||||
|
const [page, setPage] = useState(0);
|
||||||
|
|
||||||
const load = useCallback(() => {
|
const load = useCallback(() => {
|
||||||
const cat = category === '전체' ? undefined : category;
|
const cat = category === '전체' ? undefined : category;
|
||||||
@@ -533,6 +535,23 @@ function KeywordsPanel({ onCreateSlate }) {
|
|||||||
}, [category]);
|
}, [category]);
|
||||||
|
|
||||||
useEffect(() => { load(); }, [load]);
|
useEffect(() => { load(); }, [load]);
|
||||||
|
useEffect(() => { setPage(0); }, [category]); // 카테고리 변경 시 첫 페이지로
|
||||||
|
|
||||||
|
// 동일 keyword 중복 제거(최고 score 1개만 유지) + score 내림차순
|
||||||
|
const deduped = useMemo(() => {
|
||||||
|
const best = new Map();
|
||||||
|
for (const kw of keywords) {
|
||||||
|
const name = (kw.keyword || '').trim();
|
||||||
|
if (!name) continue;
|
||||||
|
const prev = best.get(name);
|
||||||
|
if (!prev || (kw.score ?? 0) > (prev.score ?? 0)) best.set(name, kw);
|
||||||
|
}
|
||||||
|
return [...best.values()].sort((a, b) => (b.score ?? 0) - (a.score ?? 0));
|
||||||
|
}, [keywords]);
|
||||||
|
|
||||||
|
const totalPages = Math.max(1, Math.ceil(deduped.length / KEYWORDS_PER_PAGE));
|
||||||
|
const safePage = Math.min(page, totalPages - 1);
|
||||||
|
const pageItems = deduped.slice(safePage * KEYWORDS_PER_PAGE, safePage * KEYWORDS_PER_PAGE + KEYWORDS_PER_PAGE);
|
||||||
|
|
||||||
// 부모(InstaCards)의 handleCreateSlate에 위임 — progress 배너 + 스크롤 + 자동 미리보기 공통화
|
// 부모(InstaCards)의 handleCreateSlate에 위임 — progress 배너 + 스크롤 + 자동 미리보기 공통화
|
||||||
async function handleCreate(kw) {
|
async function handleCreate(kw) {
|
||||||
@@ -568,27 +587,47 @@ function KeywordsPanel({ onCreateSlate }) {
|
|||||||
|
|
||||||
{/* progress 표시는 상단 ic-slate-progress 배너에서 일괄 처리 */}
|
{/* progress 표시는 상단 ic-slate-progress 배너에서 일괄 처리 */}
|
||||||
|
|
||||||
{keywords.length === 0 ? (
|
{deduped.length === 0 ? (
|
||||||
<div className="ic-empty">키워드가 없습니다. 키워드 추출을 실행하세요.</div>
|
<div className="ic-empty">키워드가 없습니다. 키워드 추출을 실행하세요.</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="ic-keywords">
|
<>
|
||||||
{keywords.map((kw) => (
|
<div className="ic-keywords">
|
||||||
<div key={kw.id} className="ic-keyword-row">
|
{pageItems.map((kw) => (
|
||||||
<span className="ic-keyword-row__kw">{kw.keyword}</span>
|
<div key={kw.id} className="ic-keyword-row">
|
||||||
<span className="ic-keyword-row__meta">
|
<span className="ic-keyword-row__kw">{kw.keyword}</span>
|
||||||
{kw.category} · {kw.articles_count ?? 0}건
|
<span className="ic-keyword-row__meta">
|
||||||
</span>
|
{kw.category} · {kw.articles_count ?? 0}건
|
||||||
<span className="ic-keyword-row__score">{kw.score?.toFixed(1) ?? '-'}</span>
|
</span>
|
||||||
|
<span className="ic-keyword-row__score">{kw.score?.toFixed(1) ?? '-'}</span>
|
||||||
|
<button
|
||||||
|
className="ic-btn ic-btn--primary ic-btn--sm"
|
||||||
|
onClick={() => handleCreate(kw)}
|
||||||
|
disabled={!!creating}
|
||||||
|
>
|
||||||
|
{creating === kw.id ? <span className="ic-spinner" /> : '🎴'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{totalPages > 1 && (
|
||||||
|
<div className="ic-keywords__pager">
|
||||||
<button
|
<button
|
||||||
className="ic-btn ic-btn--primary ic-btn--sm"
|
className="ic-pager-btn"
|
||||||
onClick={() => handleCreate(kw)}
|
onClick={() => setPage((p) => Math.max(0, p - 1))}
|
||||||
disabled={!!creating}
|
disabled={safePage === 0}
|
||||||
>
|
aria-label="이전 키워드"
|
||||||
{creating === kw.id ? <span className="ic-spinner" /> : '🎴'}
|
>←</button>
|
||||||
</button>
|
<span className="ic-pager-info">{safePage + 1} / {totalPages}</span>
|
||||||
|
<button
|
||||||
|
className="ic-pager-btn"
|
||||||
|
onClick={() => setPage((p) => Math.min(totalPages - 1, p + 1))}
|
||||||
|
disabled={safePage >= totalPages - 1}
|
||||||
|
aria-label="다음 키워드"
|
||||||
|
>→</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)}
|
||||||
</div>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,51 +1,194 @@
|
|||||||
.evolver { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
|
/* Evolver tab — dark theme matching Lotto.css patterns */
|
||||||
.evolver-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; gap: 16px; }
|
|
||||||
.evolver-kicker { letter-spacing: 0.12em; color: #6b7280; font-size: 0.75rem; margin: 0 0 4px; }
|
|
||||||
.evolver-header h1 { margin: 0 0 8px; font-size: 2rem; }
|
|
||||||
.evolver-sub { color: #6b7280; margin: 0; }
|
|
||||||
.refresh-btn { padding: 8px 14px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; }
|
|
||||||
|
|
||||||
.evolver-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
|
.lotto-evolver { display: flex; flex-direction: column; gap: 16px; }
|
||||||
.evolver-card.empty .muted { color: #9ca3af; }
|
.lotto-evolver-muted { color: #94a3b8; }
|
||||||
.evolver-card h2 { margin: 0 0 12px; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
||||||
.evolver-card .badge { background: #ecfdf5; color: #065f46; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: normal; }
|
|
||||||
|
|
||||||
.winner-card .winner-meta { display: flex; gap: 16px; flex-wrap: wrap; color: #6b7280; font-size: 0.9rem; margin-bottom: 12px; }
|
.lotto-evolver-intro {
|
||||||
.winner-card .winner-meta strong { color: #111827; }
|
display: flex; justify-content: space-between; align-items: center;
|
||||||
|
gap: 12px; flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.lotto-evolver-sub { margin: 0; color: #94a3b8; font-size: 0.9rem; flex: 1; }
|
||||||
|
.lotto-evolver-refresh {
|
||||||
|
padding: 6px 12px;
|
||||||
|
background: rgba(255,255,255,0.06);
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #cbd5e1;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.lotto-evolver-refresh:hover { background: rgba(255,255,255,0.1); }
|
||||||
|
|
||||||
.trials-grid .grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 140px; align-items: end; }
|
/* Generic card */
|
||||||
.trial-cell { border: none; background: #f9fafb; border-radius: 6px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; justify-content: end; cursor: pointer; height: 100%; }
|
.evolver-card {
|
||||||
.trial-cell.winner { background: #ecfdf5; }
|
background: rgba(255,255,255,0.04);
|
||||||
.trial-cell .bar { width: 80%; background: #34d399; border-radius: 3px 3px 0 0; min-height: 4px; }
|
border: 1px solid rgba(255,255,255,0.08);
|
||||||
.trial-cell.winner .bar { background: #059669; }
|
border-radius: 12px;
|
||||||
.trial-cell .label { font-size: 0.85rem; margin-top: 6px; }
|
padding: 18px 20px;
|
||||||
.trial-cell .max-correct { font-size: 0.7rem; color: #6b7280; }
|
color: #e2e8f0;
|
||||||
.trial-detail { margin-top: 16px; padding: 12px; background: #f9fafb; border-radius: 6px; }
|
}
|
||||||
|
.evolver-card h2 {
|
||||||
|
margin: 0 0 12px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #f1f5f9;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.evolver-card .badge {
|
||||||
|
background: rgba(52,211,153,0.15);
|
||||||
|
color: #34d399;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.evolver-card.empty .muted, .evolver-card .muted { color: #64748b; }
|
||||||
|
|
||||||
|
.lotto-evolver-empty h3 { margin: 0 0 6px; color: #f1f5f9; }
|
||||||
|
.lotto-evolver-empty p { color: #94a3b8; margin: 0 0 12px; }
|
||||||
|
|
||||||
|
/* WinnerCard */
|
||||||
|
.winner-card .winner-meta {
|
||||||
|
display: flex; gap: 16px; flex-wrap: wrap;
|
||||||
|
color: #94a3b8; font-size: 0.85rem; margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
.winner-card .winner-meta strong { color: #f1f5f9; font-weight: 600; }
|
||||||
|
.winner-card .winner-chart { background: rgba(0,0,0,0.15); border-radius: 8px; padding: 8px; }
|
||||||
|
|
||||||
|
/* TrialsGrid */
|
||||||
|
.trials-grid .grid {
|
||||||
|
display: grid; grid-template-columns: repeat(6, 1fr);
|
||||||
|
gap: 8px; height: 140px; align-items: end;
|
||||||
|
}
|
||||||
|
.trial-cell {
|
||||||
|
border: 1px solid rgba(255,255,255,0.06);
|
||||||
|
background: rgba(255,255,255,0.03);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 8px 4px;
|
||||||
|
display: flex; flex-direction: column;
|
||||||
|
align-items: center; justify-content: end;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 100%;
|
||||||
|
color: #cbd5e1;
|
||||||
|
transition: background 0.15s;
|
||||||
|
}
|
||||||
|
.trial-cell:hover { background: rgba(255,255,255,0.06); }
|
||||||
|
.trial-cell.winner { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); }
|
||||||
|
.trial-cell .bar {
|
||||||
|
width: 80%;
|
||||||
|
background: #475569;
|
||||||
|
border-radius: 3px 3px 0 0;
|
||||||
|
min-height: 4px;
|
||||||
|
}
|
||||||
|
.trial-cell.winner .bar { background: #34d399; }
|
||||||
|
.trial-cell .label { font-size: 0.85rem; margin-top: 6px; color: #e2e8f0; }
|
||||||
|
.trial-cell .max-correct { font-size: 0.7rem; color: #94a3b8; }
|
||||||
|
.trial-detail {
|
||||||
|
margin-top: 14px; padding: 12px;
|
||||||
|
background: rgba(0,0,0,0.15);
|
||||||
|
border-radius: 6px;
|
||||||
|
color: #cbd5e1;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.trial-detail h3 { margin: 0 0 8px; font-size: 0.9rem; color: #f1f5f9; }
|
||||||
.trial-detail ul { margin: 8px 0 0; padding-left: 18px; }
|
.trial-detail ul { margin: 8px 0 0; padding-left: 18px; }
|
||||||
|
.trial-detail li { margin-bottom: 4px; }
|
||||||
|
|
||||||
.base-diff .diff-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
|
/* BaseDiff */
|
||||||
.metric-card { padding: 12px; background: #f9fafb; border-radius: 8px; text-align: center; }
|
.base-diff .diff-grid {
|
||||||
.metric-card .metric-name { color: #6b7280; font-size: 0.75rem; text-transform: uppercase; }
|
display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
|
||||||
.metric-card .metric-values { margin: 6px 0; font-size: 0.85rem; }
|
}
|
||||||
.metric-card .metric-diff { font-weight: bold; }
|
.metric-card {
|
||||||
.metric-card.up .metric-diff, .metric-card.up-big .metric-diff { color: #059669; }
|
padding: 12px 8px;
|
||||||
.metric-card.down .metric-diff, .metric-card.down-big .metric-diff { color: #dc2626; }
|
background: rgba(255,255,255,0.03);
|
||||||
.metric-card.eq .metric-diff { color: #9ca3af; }
|
border: 1px solid rgba(255,255,255,0.06);
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
color: #cbd5e1;
|
||||||
|
}
|
||||||
|
.metric-card .metric-name {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
.metric-card .metric-values { margin: 6px 0; font-size: 0.8rem; }
|
||||||
|
.metric-card .metric-values strong { color: #f1f5f9; }
|
||||||
|
.metric-card .metric-diff { font-weight: 600; font-size: 0.8rem; }
|
||||||
|
.metric-card.up .metric-diff, .metric-card.up-big .metric-diff { color: #34d399; }
|
||||||
|
.metric-card.down .metric-diff, .metric-card.down-big .metric-diff { color: #f87171; }
|
||||||
|
.metric-card.eq .metric-diff { color: #64748b; }
|
||||||
|
|
||||||
.activity-card .activity-list { list-style: none; padding: 0; margin: 0; }
|
/* BaseHistory chart container */
|
||||||
.activity-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
|
.base-history { background: rgba(255,255,255,0.04); }
|
||||||
.activity-item .ts { color: #9ca3af; font-size: 0.75rem; white-space: nowrap; }
|
|
||||||
.activity-item .status.ok { color: #059669; }
|
|
||||||
.activity-item .status.err { color: #dc2626; }
|
|
||||||
.activity-item .detail { color: #6b7280; font-size: 0.85rem; }
|
|
||||||
|
|
||||||
|
/* ActivityCard — scrollable */
|
||||||
|
.activity-card .activity-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
max-height: 420px;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
|
.activity-card .activity-list::-webkit-scrollbar { width: 6px; }
|
||||||
|
.activity-card .activity-list::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255,255,255,0.15); border-radius: 3px;
|
||||||
|
}
|
||||||
|
.activity-item {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 24px 1fr auto;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 4px;
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||||
|
color: #cbd5e1;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.activity-item:last-child { border-bottom: none; }
|
||||||
|
.activity-item .icon { font-size: 1rem; text-align: center; }
|
||||||
|
.activity-item .body .line { color: #e2e8f0; }
|
||||||
|
.activity-item .body strong { color: #f1f5f9; }
|
||||||
|
.activity-item .ts {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
.activity-item .status.ok { color: #34d399; }
|
||||||
|
.activity-item .status.err { color: #f87171; }
|
||||||
|
.activity-item .status.pending { color: #fbbf24; }
|
||||||
|
.activity-item .detail { color: #94a3b8; font-size: 0.78rem; margin-top: 2px; }
|
||||||
|
|
||||||
|
/* EvolverActions */
|
||||||
.actions-card .action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
|
.actions-card .action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||||
.actions-card button { padding: 8px 14px; background: #1f2937; color: #fff; border: none; border-radius: 6px; cursor: pointer; }
|
.actions-card button {
|
||||||
|
padding: 8px 14px;
|
||||||
|
background: rgba(52,211,153,0.15);
|
||||||
|
color: #34d399;
|
||||||
|
border: 1px solid rgba(52,211,153,0.3);
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.actions-card button:hover:not(:disabled) { background: rgba(52,211,153,0.25); }
|
||||||
.actions-card button:disabled { opacity: 0.5; cursor: wait; }
|
.actions-card button:disabled { opacity: 0.5; cursor: wait; }
|
||||||
.action-output { background: #1f2937; color: #d1d5db; padding: 12px; border-radius: 6px; margin-top: 12px; max-height: 200px; overflow: auto; font-size: 0.8rem; }
|
.action-output {
|
||||||
|
background: rgba(0,0,0,0.3);
|
||||||
|
color: #94a3b8;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin-top: 12px;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow: auto;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.trials-grid .grid { grid-template-columns: repeat(3, 1fr); height: auto; }
|
.trials-grid .grid { grid-template-columns: repeat(3, 1fr); height: auto; }
|
||||||
.base-diff .diff-grid { grid-template-columns: repeat(2, 1fr); }
|
.base-diff .diff-grid { grid-template-columns: repeat(3, 1fr); }
|
||||||
.evolver-header { flex-direction: column; }
|
.lotto-evolver-intro { flex-direction: column; align-items: stretch; }
|
||||||
|
.activity-card .activity-list { max-height: 360px; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './Evolver.css';
|
import Lotto from './Lotto';
|
||||||
import { useEvolverApi } from './evolver/useEvolverApi';
|
|
||||||
import WinnerCard from './evolver/WinnerCard';
|
|
||||||
import TrialsGrid from './evolver/TrialsGrid';
|
|
||||||
import BaseDiff from './evolver/BaseDiff';
|
|
||||||
import BaseHistory from './evolver/BaseHistory';
|
|
||||||
import LottoActivityTimeline from './evolver/LottoActivityTimeline';
|
|
||||||
import EvolverActions from './evolver/EvolverActions';
|
|
||||||
|
|
||||||
|
// /lotto/evolver URL → Lotto 페이지가 useLocation으로 활성 탭 자동 선택
|
||||||
export default function Evolver() {
|
export default function Evolver() {
|
||||||
const { status, history, activity, loading, error, refetch } = useEvolverApi({ days: 7, weeks: 12 });
|
return <Lotto />;
|
||||||
|
|
||||||
if (loading) return <div className="evolver"><p>로딩 중...</p></div>;
|
|
||||||
if (error) return <div className="evolver"><p>에러: {String(error)}</p></div>;
|
|
||||||
|
|
||||||
const latestBase = (history.items || [])[0];
|
|
||||||
const previousBase = (history.items || [])[1]?.weight || status?.current_base || [0.2, 0.2, 0.2, 0.2, 0.2];
|
|
||||||
const newBase = latestBase?.weight || status?.current_base;
|
|
||||||
|
|
||||||
const trials = status?.trials || [];
|
|
||||||
const winnerTrialId = latestBase?.source_trial_id;
|
|
||||||
const winnerTrial = trials.find(t => t.id === winnerTrialId);
|
|
||||||
const winnerInfo = winnerTrial ? {
|
|
||||||
day_of_week: winnerTrial.day_of_week,
|
|
||||||
weight: winnerTrial.weight,
|
|
||||||
avg_score: latestBase?.winner_score,
|
|
||||||
max_correct: latestBase?.winner_max_correct,
|
|
||||||
n_picks: (winnerTrial.picks || []).length,
|
|
||||||
} : null;
|
|
||||||
|
|
||||||
const perDay = trials.map(t => ({
|
|
||||||
day_of_week: t.day_of_week,
|
|
||||||
trial_id: t.id,
|
|
||||||
avg_score: (t.picks || []).reduce((s, p) => s + (p.meta_score || 0), 0) / Math.max(1, (t.picks || []).length),
|
|
||||||
max_correct: Math.max(0, ...(t.picks || []).map(p => p.correct || 0)),
|
|
||||||
}));
|
|
||||||
|
|
||||||
const hasBase = (history.items || []).length > 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="evolver">
|
|
||||||
<header className="evolver-header">
|
|
||||||
<div>
|
|
||||||
<p className="evolver-kicker">Lotto · Weight Evolver</p>
|
|
||||||
<h1>자율 학습 루프</h1>
|
|
||||||
<p className="evolver-sub">
|
|
||||||
매주 6가지 가중치를 시도해서 best 조합을 다음주 base로 학습합니다.
|
|
||||||
{status?.latest_draw && ` 마지막 회차: ${status.latest_draw}회.`}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button className="refresh-btn" onClick={refetch}>↻ 새로고침</button>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{!hasBase ? (
|
|
||||||
<div className="evolver-card empty-state">
|
|
||||||
<h2>아직 학습 시작 전</h2>
|
|
||||||
<p>다음 월요일 09:00에 자동 시작 또는 수동 트리거 사용.</p>
|
|
||||||
<EvolverActions onChange={refetch} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<WinnerCard
|
|
||||||
winner={winnerInfo}
|
|
||||||
previousBase={previousBase}
|
|
||||||
updateReason={latestBase?.update_reason}
|
|
||||||
drawNo={status?.latest_draw}
|
|
||||||
/>
|
|
||||||
<TrialsGrid trials={trials} perDay={perDay} winnerTrialId={winnerTrialId} />
|
|
||||||
<BaseDiff
|
|
||||||
previousBase={previousBase}
|
|
||||||
newBase={newBase}
|
|
||||||
updateReason={latestBase?.update_reason}
|
|
||||||
/>
|
|
||||||
<BaseHistory history={history.items || []} />
|
|
||||||
<LottoActivityTimeline activity={activity} days={7} />
|
|
||||||
<EvolverActions onChange={refetch} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useState } from 'react';
|
|||||||
import BriefingTab from './tabs/BriefingTab';
|
import BriefingTab from './tabs/BriefingTab';
|
||||||
import AnalysisTab from './tabs/AnalysisTab';
|
import AnalysisTab from './tabs/AnalysisTab';
|
||||||
import PurchaseTab from './tabs/PurchaseTab';
|
import PurchaseTab from './tabs/PurchaseTab';
|
||||||
|
import EvolverTab from './tabs/EvolverTab';
|
||||||
import { useIsMobile } from '../../hooks/useIsMobile';
|
import { useIsMobile } from '../../hooks/useIsMobile';
|
||||||
import SwipeableView from '../../components/SwipeableView';
|
import SwipeableView from '../../components/SwipeableView';
|
||||||
|
|
||||||
@@ -9,10 +10,19 @@ const TABS = [
|
|||||||
{ id: 'briefing', label: '🗓 이번 주 브리핑' },
|
{ id: 'briefing', label: '🗓 이번 주 브리핑' },
|
||||||
{ id: 'analysis', label: '📚 자료실 / Deep Dive' },
|
{ id: 'analysis', label: '📚 자료실 / Deep Dive' },
|
||||||
{ id: 'purchase', label: '💰 구매·성과' },
|
{ id: 'purchase', label: '💰 구매·성과' },
|
||||||
|
{ id: 'evolver', label: '🧬 자율 학습' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function Functions() {
|
function renderTab(id) {
|
||||||
const [tab, setTab] = useState('briefing');
|
if (id === 'briefing') return <BriefingTab />;
|
||||||
|
if (id === 'analysis') return <AnalysisTab />;
|
||||||
|
if (id === 'purchase') return <PurchaseTab />;
|
||||||
|
if (id === 'evolver') return <EvolverTab />;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Functions({ initialTab = 'briefing' }) {
|
||||||
|
const [tab, setTab] = useState(initialTab);
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
|
||||||
const tabIndex = TABS.findIndex(t => t.id === tab);
|
const tabIndex = TABS.findIndex(t => t.id === tab);
|
||||||
@@ -28,7 +38,7 @@ export default function Functions() {
|
|||||||
tabs={TABS.map(t => ({
|
tabs={TABS.map(t => ({
|
||||||
key: t.id,
|
key: t.id,
|
||||||
label: t.label,
|
label: t.label,
|
||||||
content: t.id === 'briefing' ? <BriefingTab /> : t.id === 'analysis' ? <AnalysisTab /> : <PurchaseTab />,
|
content: renderTab(t.id),
|
||||||
}))}
|
}))}
|
||||||
activeIndex={tabIndex}
|
activeIndex={tabIndex}
|
||||||
onTabChange={handleTabChange}
|
onTabChange={handleTabChange}
|
||||||
@@ -45,9 +55,7 @@ export default function Functions() {
|
|||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
<div className="lotto-tab-body">
|
<div className="lotto-tab-body">
|
||||||
{tab === 'briefing' && <BriefingTab />}
|
{renderTab(tab)}
|
||||||
{tab === 'analysis' && <AnalysisTab />}
|
|
||||||
{tab === 'purchase' && <PurchaseTab />}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
import Functions from './Functions';
|
import Functions from './Functions';
|
||||||
import './Lotto.css';
|
import './Lotto.css';
|
||||||
|
|
||||||
const Lotto = () => {
|
const Lotto = () => {
|
||||||
|
const location = useLocation();
|
||||||
|
const initialTab = location.pathname.endsWith('/evolver') ? 'evolver' : 'briefing';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="lotto">
|
<div className="lotto">
|
||||||
<header className="lotto-header">
|
<header className="lotto-header">
|
||||||
@@ -15,16 +19,17 @@ const Lotto = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="lotto-card">
|
<div className="lotto-card">
|
||||||
<p className="lotto-card__title">시뮬레이션 추천 시스템</p>
|
<p className="lotto-card__title">자율 학습 시뮬레이션</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>하루 6회 몬테카를로 시뮬레이션 자동 실행</li>
|
<li>매주 6가지 가중치 시도 → 토요일 회고로 best base 학습</li>
|
||||||
<li>20,000개 후보를 5가지 통계 기법으로 스코어링</li>
|
<li>능동 시그널 모니터링 (Sim·Drift·Confidence z-score) + 텔레그램 알림</li>
|
||||||
<li>핫·콜드·오버듀 번호 통계 분석 제공</li>
|
<li>4시간마다 몬테카를로 20,000 후보 × 5종 점수 가중 평가</li>
|
||||||
|
<li>AI 큐레이터 + 핫·콜드·오버듀 통계 분석</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<Functions />
|
<Functions initialTab={initialTab} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
78
src/pages/lotto/tabs/EvolverTab.jsx
Normal file
78
src/pages/lotto/tabs/EvolverTab.jsx
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import '../Evolver.css';
|
||||||
|
import { useEvolverApi } from '../evolver/useEvolverApi';
|
||||||
|
import WinnerCard from '../evolver/WinnerCard';
|
||||||
|
import TrialsGrid from '../evolver/TrialsGrid';
|
||||||
|
import BaseDiff from '../evolver/BaseDiff';
|
||||||
|
import BaseHistory from '../evolver/BaseHistory';
|
||||||
|
import LottoActivityTimeline from '../evolver/LottoActivityTimeline';
|
||||||
|
import EvolverActions from '../evolver/EvolverActions';
|
||||||
|
|
||||||
|
export default function EvolverTab() {
|
||||||
|
const { status, history, activity, loading, error, refetch } = useEvolverApi({ days: 7, weeks: 12 });
|
||||||
|
|
||||||
|
if (loading) return <div className="lotto-evolver"><p className="lotto-evolver-muted">로딩 중...</p></div>;
|
||||||
|
if (error) return <div className="lotto-evolver"><p className="lotto-evolver-muted">에러: {String(error)}</p></div>;
|
||||||
|
|
||||||
|
const latestBase = (history.items || [])[0];
|
||||||
|
const previousBase = (history.items || [])[1]?.weight || status?.current_base || [0.2, 0.2, 0.2, 0.2, 0.2];
|
||||||
|
const newBase = latestBase?.weight || status?.current_base;
|
||||||
|
|
||||||
|
const trials = status?.trials || [];
|
||||||
|
const winnerTrialId = latestBase?.source_trial_id;
|
||||||
|
const winnerTrial = trials.find(t => t.id === winnerTrialId);
|
||||||
|
const winnerInfo = winnerTrial ? {
|
||||||
|
day_of_week: winnerTrial.day_of_week,
|
||||||
|
weight: winnerTrial.weight,
|
||||||
|
avg_score: latestBase?.winner_score,
|
||||||
|
max_correct: latestBase?.winner_max_correct,
|
||||||
|
n_picks: (winnerTrial.picks || []).length,
|
||||||
|
} : null;
|
||||||
|
|
||||||
|
const perDay = trials.map(t => ({
|
||||||
|
day_of_week: t.day_of_week,
|
||||||
|
trial_id: t.id,
|
||||||
|
avg_score: (t.picks || []).reduce((s, p) => s + (p.meta_score || 0), 0) / Math.max(1, (t.picks || []).length),
|
||||||
|
max_correct: Math.max(0, ...(t.picks || []).map(p => p.correct || 0)),
|
||||||
|
}));
|
||||||
|
|
||||||
|
const hasBase = (history.items || []).length > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="lotto-evolver">
|
||||||
|
<div className="lotto-evolver-intro">
|
||||||
|
<p className="lotto-evolver-sub">
|
||||||
|
매주 6가지 가중치를 시도해서 best 조합을 다음주 base로 학습합니다.
|
||||||
|
{status?.latest_draw && ` 마지막 회차: ${status.latest_draw}회.`}
|
||||||
|
</p>
|
||||||
|
<button className="lotto-evolver-refresh" onClick={refetch}>↻ 새로고침</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{!hasBase ? (
|
||||||
|
<div className="evolver-card lotto-evolver-empty">
|
||||||
|
<h3>아직 학습 시작 전</h3>
|
||||||
|
<p>다음 월요일 09:00에 자동 시작 또는 수동 트리거 사용.</p>
|
||||||
|
<EvolverActions onChange={refetch} />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<WinnerCard
|
||||||
|
winner={winnerInfo}
|
||||||
|
previousBase={previousBase}
|
||||||
|
updateReason={latestBase?.update_reason}
|
||||||
|
drawNo={status?.latest_draw}
|
||||||
|
/>
|
||||||
|
<TrialsGrid trials={trials} perDay={perDay} winnerTrialId={winnerTrialId} />
|
||||||
|
<BaseDiff
|
||||||
|
previousBase={previousBase}
|
||||||
|
newBase={newBase}
|
||||||
|
updateReason={latestBase?.update_reason}
|
||||||
|
/>
|
||||||
|
<BaseHistory history={history.items || []} />
|
||||||
|
<LottoActivityTimeline activity={activity} days={7} />
|
||||||
|
<EvolverActions onChange={refetch} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user