import { OnboardingButtons, useDismiss, useNextClick } from '.' import { onboardingPaths } from 'routes/Onboarding/paths' import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext' import { Themes, getSystemTheme } from 'lib/theme' import { bracket } from 'lib/exampleKcl' import { getNextProjectIndex, interpolateProjectNameWithIndex, } from 'lib/tauriFS' import { isTauri } from 'lib/isTauri' import { useNavigate } from 'react-router-dom' import { paths } from 'lib/paths' import { useEffect } from 'react' import { codeManager, kclManager } from 'lib/singletons' import { join } from '@tauri-apps/api/path' import { APP_NAME, ONBOARDING_PROJECT_NAME, PROJECT_ENTRYPOINT, } from 'lib/constants' import { createNewProjectDirectory, listProjects } from 'lib/tauri' function OnboardingWithNewFile() { const navigate = useNavigate() const dismiss = useDismiss() const next = useNextClick(onboardingPaths.INDEX) async function createAndOpenNewProject() { const projects = await listProjects() const nextIndex = getNextProjectIndex(ONBOARDING_PROJECT_NAME, projects) const name = interpolateProjectNameWithIndex( ONBOARDING_PROJECT_NAME, nextIndex ) const newFile = await createNewProjectDirectory(name, bracket) navigate( `${paths.FILE}/${encodeURIComponent( await join(newFile.path, PROJECT_ENTRYPOINT) )}${paths.ONBOARDING.INDEX}` ) } return (
{!isTauri() ? ( <>

Replaying onboarding resets your code

We see you have some of your own code written in this project. Please save it somewhere else before continuing the onboarding.

{ // We do want to update both the state and editor here. codeManager.updateCodeStateEditor(bracket) kclManager.executeCode(true) next() }} nextText="Overwrite code and continue" /> ) : ( <>

Would you like to create a new project?

You have some content in this project that we don't want to overwrite. If you would like to create a new project, please click the button below.

{ void createAndOpenNewProject() codeManager.updateCodeStateEditor(bracket) dismiss() }} nextText="Make a new project" /> )}
) } export default function Introduction() { const { settings: { state: { context: { app: { theme }, }, }, }, } = useSettingsAuthContext() const getLogoTheme = () => theme.current === Themes.Light || (theme.current === Themes.System && getSystemTheme() === Themes.Light) ? '-dark' : '' const dismiss = useDismiss() const next = useNextClick(onboardingPaths.CAMERA) const currentCode = codeManager.code const isStarterCode = currentCode === '' || currentCode === bracket useEffect(() => { if (codeManager.code === '') codeManager.updateCodeStateEditor(bracket) }, []) return isStarterCode ? (

{APP_NAME} Alpha

Welcome to {APP_NAME}! This is a hardware design tool that lets you edit visually, with code, or both. It's powered by the KittyCAD Design API, the first API created for anyone to build hardware design tools. The 3D view is not running on your computer, but is instead being streamed to you from an instance of our Geometry Engine on a remote GPU as video.

This is an alpha release, so you will encounter bugs and missing features. You can read our{' '} expectations for alpha users here , and please give us feedback on your experience{' '} our Discord ! We are trying to release as early as possible to get feedback from users like you.

) : ( ) }