Franknoirot/help menu (#2173)
* Add exclamationMark icon * Add basic LowerRightControls component * Create a help menu * Remove NetworkHealthIndicator from AppHeader * Refactor Tooltip to be able to be corner-anchored * Add a better flag back to the Tooltip * Give tooltip a faint theme outline on light mode too * Fix broken reset onboarding behavior on home page * Fix bug with isInProject * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -19,6 +19,7 @@ import {
|
||||
FILE_EXT,
|
||||
INDEX_IDENTIFIER,
|
||||
MAX_PADDING,
|
||||
ONBOARDING_PROJECT_NAME,
|
||||
PROJECT_ENTRYPOINT,
|
||||
PROJECT_FOLDER,
|
||||
RELEVANT_FILE_TYPES,
|
||||
@ -26,6 +27,8 @@ import {
|
||||
} from 'lib/constants'
|
||||
import { SaveSettingsPayload, SettingsLevel } from './settings/settingsTypes'
|
||||
import { initPromise, tomlParse } from 'lang/wasm'
|
||||
import { bracket } from './exampleKcl'
|
||||
import { paths } from './paths'
|
||||
|
||||
type PathWithPossibleError = {
|
||||
path: string | null
|
||||
@ -428,3 +431,20 @@ export async function getSettingsFolderPaths(projectPath?: string) {
|
||||
project,
|
||||
}
|
||||
}
|
||||
|
||||
export async function createAndOpenNewProject(
|
||||
projectDirectory: string,
|
||||
navigate: (path: string) => void
|
||||
) {
|
||||
const projects = await getProjectsInDir(projectDirectory)
|
||||
const nextIndex = await getNextProjectIndex(ONBOARDING_PROJECT_NAME, projects)
|
||||
const name = interpolateProjectNameWithIndex(
|
||||
ONBOARDING_PROJECT_NAME,
|
||||
nextIndex
|
||||
)
|
||||
const newFile = await createNewProject(
|
||||
await join(projectDirectory, name),
|
||||
bracket
|
||||
)
|
||||
navigate(`${paths.FILE}/${encodeURIComponent(newFile.path)}`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user