diff --git a/src/pages/lotto/Functions.jsx b/src/pages/lotto/Functions.jsx index db22443..a385a03 100644 --- a/src/pages/lotto/Functions.jsx +++ b/src/pages/lotto/Functions.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { deleteHistory, getHistory, getLatest, getStats, recommend } from '../../api'; const fmtKST = (value) => value?.replace('T', ' ') ?? ''; @@ -166,21 +166,26 @@ const FrequencyChart = ({ stats }) => {
- {series.map((item) => ( -
- - {item.number} -
- ))} + {series.map((item) => { + const showLabel = item.number === 1 || item.number % 5 === 0; + return ( +
+ + + {showLabel ? item.number : ''} + +
+ ); + })}
); @@ -205,6 +210,9 @@ export default function Functions() { const [result, setResult] = useState(null); const [history, setHistory] = useState([]); + const [historyExpanded, setHistoryExpanded] = useState(false); + const historyEndRef = useRef(null); + const prevHistoryExpandedRef = useRef(false); const [stats, setStats] = useState(() => readStatsCache()); const [statsLoading, setStatsLoading] = useState(false); const [statsError, setStatsError] = useState(''); @@ -306,6 +314,20 @@ export default function Functions() { refreshStats(); }, []); + const visibleHistory = historyExpanded ? history : history.slice(0, 5); + + useEffect(() => { + if (historyExpanded && !prevHistoryExpandedRef.current) { + requestAnimationFrame(() => { + historyEndRef.current?.scrollIntoView({ + behavior: 'smooth', + block: 'end', + }); + }); + } + prevHistoryExpandedRef.current = historyExpanded; + }, [historyExpanded, visibleHistory.length]); + return (
{error ? ( @@ -542,47 +564,46 @@ export default function Functions() { )} -
-
-
-

Distribution

-

전체 회차 번호 분포

-

- 1~45번 번호가 등장한 횟수를 기준으로 분포를 표시합니다. -

-
-
- {statsLoading ? ( - 로딩 중 - ) : null} - {stats?.total_draws ? ( - - {stats.total_draws}회차 - - ) : null} - -
-
- - {statsError ? ( -

{statsError}

- ) : null} - {stats ? ( - - ) : ( -

- 통계 데이터를 불러오지 못했습니다. -

- )} -
+
+
+
+

Distribution

+

전체 회차 번호 분포

+

+ 1~45번 번호가 등장한 횟수를 기준으로 분포를 표시합니다. +

+
+
+ {statsLoading ? ( + 로딩 중 + ) : null} + {stats?.total_draws ? ( + + {stats.total_draws}회차 + + ) : null} + +
+
+ + {statsError ?

{statsError}

: null} + {stats ? ( + + ) : ( +

+ 통계 데이터를 불러오지 못했습니다. +

+ )} +
+
@@ -594,6 +615,30 @@ export default function Functions() {
{history.length}건 + {history.length > 5 ? ( + + ) : null}
diff --git a/src/pages/lotto/Lotto.css b/src/pages/lotto/Lotto.css index b728aa0..07d05e1 100644 --- a/src/pages/lotto/Lotto.css +++ b/src/pages/lotto/Lotto.css @@ -69,6 +69,18 @@ gap: 16px; } +.lotto-panel--wide .lotto-chart { + grid-template-columns: 60px minmax(0, 1fr); +} + +.lotto-panel--wide .lotto-chart__plot { + height: 220px; +} + +.lotto-panel--wide .lotto-chart__ticks { + min-height: 220px; +} + .lotto-panel__head { display: flex; justify-content: space-between; @@ -505,6 +517,22 @@ gap: 12px; } +.lotto-history-toggle { + display: inline-flex; + align-items: center; + gap: 6px; +} + +.lotto-history-toggle__icon { + display: inline-block; + transition: transform 0.2s ease; + font-size: 10px; +} + +.lotto-history-toggle__icon.is-open { + transform: rotate(180deg); +} + .lotto-history__item { border: 1px solid var(--line); border-radius: 18px;