({
onDone
}: Props)
| 44 | } |
| 45 | |
| 46 | export function Onboarding({ |
| 47 | onDone |
| 48 | }: Props): React.ReactNode { |
| 49 | const [currentStepIndex, setCurrentStepIndex] = useState(0); |
| 50 | const [skipOAuth, setSkipOAuth] = useState(() => |
| 51 | shouldSkipOAuthOnboardingStep(), |
| 52 | ); |
| 53 | const [oauthEnabled] = useState(() => isCurrentFirstPartyOauthUiEnabled()); |
| 54 | const [theme, setTheme] = useTheme(); |
| 55 | useEffect(() => { |
| 56 | logEvent('ncode_began_setup', { |
| 57 | oauthEnabled |
| 58 | }); |
| 59 | }, [oauthEnabled]); |
| 60 | function goToNextStep() { |
| 61 | if (currentStepIndex < steps.length - 1) { |
| 62 | const nextIndex = currentStepIndex + 1; |
| 63 | setCurrentStepIndex(nextIndex); |
| 64 | logEvent('ncode_onboarding_step', { |
| 65 | oauthEnabled, |
| 66 | stepId: steps[nextIndex]?.id as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 67 | }); |
| 68 | } else { |
| 69 | onDone(); |
| 70 | } |
| 71 | } |
| 72 | function handleThemeSelection(newTheme: ThemeSetting) { |
| 73 | setTheme(newTheme); |
| 74 | goToNextStep(); |
| 75 | } |
| 76 | const exitState = useExitOnCtrlCDWithKeybindings(); |
| 77 | |
| 78 | // Define all onboarding steps |
| 79 | const themeStep = <Box marginX={1}> |
| 80 | <ThemePicker onThemeSelect={handleThemeSelection} showIntroText={true} helpText="To change this later, run /theme" hideEscToCancel={true} skipExitHandling={true} // Skip exit handling as Onboarding already handles it |
| 81 | /> |
| 82 | </Box>; |
| 83 | const securityStep = <Box flexDirection="column" gap={1} paddingLeft={1}> |
| 84 | <Text bold>Security notes:</Text> |
| 85 | <Box flexDirection="column" width={70}> |
| 86 | {/** |
| 87 | * OrderedList misnumbers items when rendering conditionally, |
| 88 | * so put all items in the if/else |
| 89 | */} |
| 90 | <OrderedList> |
| 91 | <OrderedList.Item> |
| 92 | <Text>Code can make mistakes</Text> |
| 93 | <Text dimColor wrap="wrap"> |
| 94 | You should always review Code's responses, especially when |
| 95 | <Newline /> |
| 96 | running code. |
| 97 | <Newline /> |
| 98 | </Text> |
| 99 | </OrderedList.Item> |
| 100 | <OrderedList.Item> |
| 101 | <Text> |
| 102 | Due to prompt injection risks, only use it with code you trust |
| 103 | </Text> |
nothing calls this directly
no test coverage detected