/** * @license * Copyright 2025 Vybestack LLC * SPDX-License-Identifier: Apache-2.0 */ import type React from 'react'; import { useCallback } from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../../colors.js'; import { RadioButtonSelect } from '../shared/RadioButtonSelect.js'; import { useKeypress } from '../../hooks/useKeypress.js'; import { formatConfigSummary } from './utils.js'; import type { WizardState } from './types.js'; interface ProfileSuccessSummaryProps { state: WizardState; onClose: () => void; onLoadProfile?: (profileName: string) => void; } export const ProfileSuccessSummary: React.FC = ({ state, onClose, onLoadProfile, }) => { // Handle Escape key to close useKeypress( (key) => { if (key.name === 'escape') { onClose(); } }, { isActive: true }, ); const handleSelect = useCallback( (value: string) => { if (value === 'load') { // Load the profile using the provided handler if (onLoadProfile && state.profileName) { onLoadProfile(state.profileName); } onClose(); } else if (value === 'done') { onClose(); } }, [onClose, onLoadProfile, state.profileName], ); const summary = formatConfigSummary(state); return ( ✓ Profile Created Successfully! Profile: {state.profileName} Configuration Summary: {summary.split('\n').map((line, idx) => ( {line} ))} You can load this profile with: /profile load {state.profileName} Esc Close ); };