[Fix] Using main.kcl for more of the workflows that generate kcl files (#7017)
* fix: when creating a t2c in a new project make the file name main.kcl * fix: when creating a sample in a new project and there is only 1 file make the filename main.kcl * fix: auto fixes * fix: share links generate main.kcl * fix: codespell typoe * fix: fixing E2E tests * Fix 3 more tests * fix: share url link e2e file name fix --------- Co-authored-by: Pierre Jacquier <pierre@zoo.dev> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
@ -6,7 +6,7 @@ import {
|
||||
ToastTextToCadError,
|
||||
ToastTextToCadSuccess,
|
||||
} from '@src/components/ToastTextToCad'
|
||||
import { FILE_EXT } from '@src/lib/constants'
|
||||
import { FILE_EXT, PROJECT_ENTRYPOINT } from '@src/lib/constants'
|
||||
import crossPlatformFetch from '@src/lib/crossPlatformFetch'
|
||||
import { getNextFileName } from '@src/lib/desktopFS'
|
||||
import { isDesktop } from '@src/lib/isDesktop'
|
||||
@ -196,12 +196,18 @@ export async function submitAndAwaitTextToKclSystemIO({
|
||||
}
|
||||
|
||||
const TRUNCATED_PROMPT_LENGTH = 24
|
||||
// Only add the prompt name if it is a preexisting project
|
||||
newFileName = `${value.prompt
|
||||
.slice(0, TRUNCATED_PROMPT_LENGTH)
|
||||
.replace(/\s/gi, '-')
|
||||
.replace(/\W/gi, '-')
|
||||
.toLowerCase()}${FILE_EXT}`
|
||||
|
||||
// If the project is new generate a main.kcl
|
||||
if (isProjectNew) {
|
||||
newFileName = PROJECT_ENTRYPOINT
|
||||
}
|
||||
|
||||
if (isDesktop()) {
|
||||
// We have to preemptively run our unique file name logic,
|
||||
// so that we can pass the unique file name to the toast,
|
||||
|
Reference in New Issue
Block a user