import { useEffect, useEffectEvent, useRef } from 'react' import { useSearchParams } from 'react-router' import type { TalkTopic } from '@nalssigak/shared/api/client/types.gen' import { cx } from '../lib/utils' import { useAuth } from './authContext' import { useSheet } from './sheetContext' import { FeedComposer, TalkCard } from './talk' import { TOPICS, useMyTalks, useTopicTalks } from './talkState' import { Rail, Sec } from './ui' type Tab = TalkTopic | 'all' | 'mine' /** 목록 끝이 화면 아래 600px 안에 들어오면 다음 쪽을 받는다 (글이 많아도 버튼 없이 이어서) */ function MoreOnScroll({ onMore }: { onMore: () => void }) { const ref = useRef(null) const more = useEffectEvent(onMore) useEffect(() => { const el = ref.current if (!el) return const io = new IntersectionObserver(([e]) => e.isIntersecting && more(), { rootMargin: '0px 0px 600px 0px' }) io.observe(el) return () => io.disconnect() }, []) return