UNPKG

@hhoangphuoc/escape-room-cli

Version:

A CLI for playing AI-generated escape room games. Install globally with: npm install -g @hhoangphuoc/escape-room-cli

28 lines (27 loc) 1.39 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useState } from 'react'; import { Box, Text } from 'ink'; import Terminal from './components/Terminal.js'; import Title from './components/Title.js'; import UserRegistration from './components/UserRegistration.js'; import { AuthProvider } from './context/AuthContext.js'; const AppContent = (props) => { // const { auth } = useAuth(); const [isRegistering, setIsRegistering] = useState(props.register); const handleRegistrationComplete = () => { setIsRegistering(false); }; const handleTriggerRegister = () => { setIsRegistering(true); }; const handleRegistrationCancel = () => { setIsRegistering(false); }; if (isRegistering) { return (_jsx(UserRegistration, { onRegistrationComplete: handleRegistrationComplete, onCancel: handleRegistrationCancel, username: props.name, email: props.email })); } return (_jsxs(Box, { flexDirection: "column", padding: 1, width: "100%", children: [_jsx(Title, {}), _jsx(Terminal, { autoLogin: props.login, onTriggerRegister: handleTriggerRegister }), _jsx(Box, { marginTop: 0.5, children: _jsx(Text, { color: "gray", children: "Type / to interact \u2022 Ctrl+C to exit" }) })] })); }; export default function App(props) { return (_jsx(AuthProvider, { children: _jsx(AppContent, { ...props }) })); }