Make onboarding optional, able to be ignored on desktop (#6564)
* Remove unused `telemetryLoader` * Remove onboarding redirect behavior * Allow subRoute to be passed to navigateToProject * Replace warning dialog routes with toasts * Wire up new utilities and toasts to UI components * Add home sidebar buttons for tutorial flow * Rename menu item * Add flex-1 so home-layout fills available space * Remove onboarding avatar tests, they are becoming irrelevant * Consolidate onboarding tests to one longer one and update it to not use pixel color checks, and use fixtures. * Shorten warning toast button text * tsc, lint, and circular deps * Update circular dep file * Fix mistakes made in circular update tweaking * One more dumb created circular dep * Update src/routes/Onboarding/utils.tsx Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Fix narrow screen home layout breaking * fix: kevin, navigation routes fixed * fix: filename parsing is correct now for onboarding with the last file sep * Fix e2e test state checks that are diff on Linux * Create onboarding project entirely through systemIOMachine * Fix Windows path construction --------- Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Co-authored-by: Kevin Nadro <kevin@zoo.dev>
This commit is contained in:
@ -6,16 +6,12 @@ import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { Fragment } from 'react/jsx-runtime'
|
||||
|
||||
import { ActionButton } from '@src/components/ActionButton'
|
||||
import { useLspContext } from '@src/components/LspProvider'
|
||||
import { SettingsFieldInput } from '@src/components/Settings/SettingsFieldInput'
|
||||
import { SettingsSection } from '@src/components/Settings/SettingsSection'
|
||||
import { useDotDotSlash } from '@src/hooks/useDotDotSlash'
|
||||
import {
|
||||
createAndOpenNewTutorialProject,
|
||||
getSettingsFolderPaths,
|
||||
} from '@src/lib/desktopFS'
|
||||
import { getSettingsFolderPaths } from '@src/lib/desktopFS'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
|
||||
import { ONBOARDING_SUBPATHS } from '@src/lib/onboardingPaths'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { Setting } from '@src/lib/settings/initialSettings'
|
||||
import type {
|
||||
@ -28,9 +24,17 @@ import {
|
||||
} from '@src/lib/settings/settingsUtils'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import { toSync } from '@src/lib/utils'
|
||||
import { settingsActor, useSettings } from '@src/lib/singletons'
|
||||
import {
|
||||
codeManager,
|
||||
kclManager,
|
||||
settingsActor,
|
||||
useSettings,
|
||||
} from '@src/lib/singletons'
|
||||
import { APP_VERSION, IS_NIGHTLY, getReleaseUrl } from '@src/routes/utils'
|
||||
import { waitFor } from 'xstate'
|
||||
import {
|
||||
acceptOnboarding,
|
||||
catchOnboardingWarnError,
|
||||
} from '@src/routes/Onboarding/utils'
|
||||
|
||||
interface AllSettingsFieldsProps {
|
||||
searchParamTab: SettingsLevel
|
||||
@ -44,8 +48,6 @@ export const AllSettingsFields = forwardRef(
|
||||
) => {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const { onProjectOpen } = useLspContext()
|
||||
const dotDotSlash = useDotDotSlash()
|
||||
const context = useSettings()
|
||||
|
||||
const projectPath = useMemo(() => {
|
||||
@ -63,26 +65,18 @@ export const AllSettingsFields = forwardRef(
|
||||
: undefined
|
||||
|
||||
return projectPath
|
||||
}, [location.pathname])
|
||||
}, [location.pathname, isFileSettings])
|
||||
|
||||
async function restartOnboarding() {
|
||||
settingsActor.send({
|
||||
type: `set.app.onboardingStatus`,
|
||||
data: { level: 'user', value: '' },
|
||||
})
|
||||
await waitFor(settingsActor, (s) => s.matches('idle'), {
|
||||
timeout: 10_000,
|
||||
}).catch(reportRejection)
|
||||
|
||||
if (isFileSettings) {
|
||||
// If we're in a project, first navigate to the onboarding start here
|
||||
// so we can trigger the warning screen if necessary
|
||||
navigate(dotDotSlash(1) + PATHS.ONBOARDING.INDEX)
|
||||
} else {
|
||||
// If we're in the global settings, create a new project and navigate
|
||||
// to the onboarding start in that project
|
||||
await createAndOpenNewTutorialProject({ onProjectOpen, navigate })
|
||||
const props = {
|
||||
onboardingStatus: ONBOARDING_SUBPATHS.INDEX,
|
||||
navigate,
|
||||
codeManager,
|
||||
kclManager,
|
||||
}
|
||||
acceptOnboarding(props).catch((reason) =>
|
||||
catchOnboardingWarnError(reason, props)
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user