mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-18 10:40:50 +08:00
refactor: move modelsToEntries and entriesToModels to modelInputListUtils for better organization
This commit is contained in:
@@ -29,14 +29,8 @@ const PROVIDERS: ProviderNavItem[] = [
|
||||
export function ProviderNav() {
|
||||
const resolvedTheme = useThemeStore((state) => state.resolvedTheme);
|
||||
const [activeProvider, setActiveProvider] = useState<ProviderId | null>(null);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const scrollContainerRef = useRef<HTMLElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
return () => setMounted(false);
|
||||
}, []);
|
||||
|
||||
const getScrollContainer = useCallback(() => {
|
||||
if (scrollContainerRef.current) return scrollContainerRef.current;
|
||||
const container = document.querySelector('.content') as HTMLElement | null;
|
||||
@@ -74,7 +68,6 @@ export function ProviderNav() {
|
||||
const container = getScrollContainer();
|
||||
if (!container) return;
|
||||
|
||||
handleScroll();
|
||||
container.addEventListener('scroll', handleScroll, { passive: true });
|
||||
return () => container.removeEventListener('scroll', handleScroll);
|
||||
}, [handleScroll, getScrollContainer]);
|
||||
@@ -120,7 +113,7 @@ export function ProviderNav() {
|
||||
</div>
|
||||
);
|
||||
|
||||
if (!mounted) return null;
|
||||
if (typeof document === 'undefined') return null;
|
||||
|
||||
return createPortal(navContent, document.body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user