diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 0d784b19..52b8bfaf 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -13,20 +13,28 @@ import { css } from '../../styled-system/css' import { container, grid, hstack, stack } from '../../styled-system/patterns' import { token } from '../../styled-system/tokens' -// Mini abacus that cycles through random 3-digit numbers -function MiniAbacus() { - const [currentValue, setCurrentValue] = useState(123) +// Mini abacus that cycles through a sequence of values +function MiniAbacus({ + values, + columns = 3, + interval = 2500, +}: { + values: number[] + columns?: number + interval?: number +}) { + const [currentIndex, setCurrentIndex] = useState(0) const appConfig = useAbacusConfig() useEffect(() => { - // Cycle through random 3-digit numbers every 2.5 seconds - const interval = setInterval(() => { - const randomNum = Math.floor(Math.random() * 1000) // 0-999 - setCurrentValue(randomNum) - }, 2500) + if (values.length === 0) return - return () => clearInterval(interval) - }, []) + const timer = setInterval(() => { + setCurrentIndex((prev) => (prev + 1) % values.length) + }, interval) + + return () => clearInterval(timer) + }, [values, interval]) // Dark theme styles for the abacus const darkStyles = { @@ -54,8 +62,8 @@ function MiniAbacus() { >