Onboarding updates (#1967)

* Make onboarding line references dynamic and error if they aren't found
Fixes https://github.com/KittyCAD/modeling-app/issues/1918

* More clear and correct Sketch onboarding step
Fixes https://github.com/KittyCAD/modeling-app/issues/1790
Fixes https://github.com/KittyCAD/modeling-app/issues/1789

* Make sample code line references dynamic and error on app start if they break so we can know before release
Fixes https://github.com/KittyCAD/modeling-app/issues/1918

* Better error message for searchText failure

* JB onboarding feedback

* Make list more explicit, instruct to hold down key first
This commit is contained in:
Frank Noirot
2024-03-29 12:56:32 -04:00
committed by GitHub
parent 6f36371e6d
commit 0360a4021b
6 changed files with 69 additions and 21 deletions

View File

@ -34,5 +34,28 @@ const bracket = startSketchOn('XY')
|> fillet({
radius: filletR + thickness,
tags: [getNextAdjacentEdge('outerEdge', %)]
}, %)
`
}, %)`
function findLineInExampleCode({
searchText,
example = bracket,
}: {
searchText: string
example?: string
}) {
const lines = example.split('\n')
const lineNumber = lines.findIndex((l) => l.includes(searchText)) + 1
if (lineNumber === 0) {
throw new Error(
`Could not find the line with search text "${searchText}" in the example code. Was it removed?`
)
}
return lineNumber
}
export const bracketWidthConstantLine = findLineInExampleCode({
searchText: 'const width',
})
export const bracketThicknessCalculationLine = findLineInExampleCode({
searchText: 'const thickness',
})