UNPKG

gensx

Version:
36 lines 1.35 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Box, Text } from "ink"; import { useCallback, useEffect, useState } from "react"; import { LoginUI } from "../commands/login.js"; import { getState, saveState } from "../utils/config.js"; export function FirstTimeSetup() { const [isComplete, setIsComplete] = useState(false); const [isLoading, setIsLoading] = useState(true); const checkFirstTimeSetup = useCallback(async () => { try { const state = await getState(); if (!state.hasCompletedFirstTimeSetup) { // Ensure that we don't ask again. await saveState({ hasCompletedFirstTimeSetup: true }); setIsLoading(false); } else { setIsComplete(true); } } catch (_error) { setIsLoading(false); } }, []); useEffect(() => { void checkFirstTimeSetup(); }, [checkFirstTimeSetup]); if (isLoading) { return null; } if (isComplete) { return null; } return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { children: _jsx(Text, { color: "yellow", children: "Welcome to GenSX! Let's get you set up first." }) }), _jsx(LoginUI, {})] })); } //# sourceMappingURL=FirstTimeSetup.js.map