diff --git a/components/RankingPanel.tsx b/components/RankingPanel.tsx index 1eaa250..5f0dc39 100644 --- a/components/RankingPanel.tsx +++ b/components/RankingPanel.tsx @@ -27,12 +27,18 @@ export default function RankingPanel() { likes: [] }) const [loading, setLoading] = useState(true) - const [position, setPosition] = useState({ x: 32, y: window.innerHeight / 2 - 200 }) + const [position, setPosition] = useState(() => ({ + x: 32, + y: typeof window === 'undefined' ? 200 : window.innerHeight / 2 - 200, + })) const [isDragging, setIsDragging] = useState(false) const [dragOffset, setDragOffset] = useState({ x: 0, y: 0 }) const panelRef = useRef(null) const buttonRef = useRef(null) - const [buttonPosition, setButtonPosition] = useState({ x: 32, y: window.innerHeight / 2 - 24 }) + const [buttonPosition, setButtonPosition] = useState(() => ({ + x: 32, + y: typeof window === 'undefined' ? 200 : window.innerHeight / 2 - 24, + })) const [isButtonDragging, setIsButtonDragging] = useState(false) const [buttonDragOffset, setButtonDragOffset] = useState({ x: 0, y: 0 }) const clickStartRef = useRef<{ x: number; y: number; time: number } | null>(null)