2025-05-14 09:06:29 -04:00
|
|
|
import { useEffect, useRef, useState } from 'react'
|
2025-04-01 23:54:26 -07:00
|
|
|
import toast from 'react-hot-toast'
|
2025-04-01 15:31:19 -07:00
|
|
|
import { useHotkeys } from 'react-hotkeys-hook'
|
|
|
|
|
import ModalContainer from 'react-modal-promise'
|
2025-04-01 23:54:26 -07:00
|
|
|
import {
|
|
|
|
|
useLoaderData,
|
2025-05-02 15:54:49 -04:00
|
|
|
useLocation,
|
2025-04-01 23:54:26 -07:00
|
|
|
useNavigate,
|
2025-04-07 07:08:31 -04:00
|
|
|
useSearchParams,
|
2025-04-01 23:54:26 -07:00
|
|
|
} from 'react-router-dom'
|
|
|
|
|
|
|
|
|
|
import { AppHeader } from '@src/components/AppHeader'
|
2025-04-07 07:08:31 -04:00
|
|
|
import { EngineStream } from '@src/components/EngineStream'
|
2025-04-01 23:54:26 -07:00
|
|
|
import Gizmo from '@src/components/Gizmo'
|
|
|
|
|
import { LowerRightControls } from '@src/components/LowerRightControls'
|
|
|
|
|
import { useLspContext } from '@src/components/LspProvider'
|
|
|
|
|
import { ModelingSidebar } from '@src/components/ModelingSidebar/ModelingSidebar'
|
|
|
|
|
import { UnitsMenu } from '@src/components/UnitsMenu'
|
|
|
|
|
import { useAbsoluteFilePath } from '@src/hooks/useAbsoluteFilePath'
|
2025-05-17 07:51:25 -04:00
|
|
|
import { useQueryParamEffects } from '@src/hooks/useQueryParamEffects'
|
2025-04-01 23:54:26 -07:00
|
|
|
import { useEngineConnectionSubscriptions } from '@src/hooks/useEngineConnectionSubscriptions'
|
|
|
|
|
import { useHotKeyListener } from '@src/hooks/useHotKeyListener'
|
|
|
|
|
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
|
|
|
|
import { isDesktop } from '@src/lib/isDesktop'
|
|
|
|
|
import { PATHS } from '@src/lib/paths'
|
2025-05-06 15:07:22 -04:00
|
|
|
import {
|
|
|
|
|
billingActor,
|
|
|
|
|
sceneInfra,
|
|
|
|
|
codeManager,
|
|
|
|
|
kclManager,
|
2025-05-16 23:25:04 -04:00
|
|
|
settingsActor,
|
2025-05-06 15:07:22 -04:00
|
|
|
} from '@src/lib/singletons'
|
2025-04-01 23:54:26 -07:00
|
|
|
import { maybeWriteToDisk } from '@src/lib/telemetry'
|
2025-05-02 15:54:49 -04:00
|
|
|
import type { IndexLoaderData } from '@src/lib/types'
|
2025-04-24 13:32:49 -05:00
|
|
|
import { engineStreamActor, useSettings, useToken } from '@src/lib/singletons'
|
2025-04-07 07:08:31 -04:00
|
|
|
import { EngineStreamTransition } from '@src/machines/engineStreamMachine'
|
2025-05-06 15:07:22 -04:00
|
|
|
import { BillingTransition } from '@src/machines/billingMachine'
|
2025-04-23 15:20:45 -04:00
|
|
|
import { CommandBarOpenButton } from '@src/components/CommandBarOpenButton'
|
|
|
|
|
import { ShareButton } from '@src/components/ShareButton'
|
2025-05-02 15:54:49 -04:00
|
|
|
import {
|
|
|
|
|
needsToOnboard,
|
|
|
|
|
TutorialRequestToast,
|
|
|
|
|
} from '@src/routes/Onboarding/utils'
|
2025-05-14 09:06:29 -04:00
|
|
|
import { reportRejection } from '@src/lib/trap'
|
2025-05-17 18:01:12 -04:00
|
|
|
import { DownloadAppToast } from '@src/components/DownloadAppToast'
|
|
|
|
|
import { WasmErrToast } from '@src/components/WasmErrToast'
|
2025-05-16 23:25:04 -04:00
|
|
|
import openWindow from '@src/lib/openWindow'
|
|
|
|
|
import {
|
|
|
|
|
APP_DOWNLOAD_PATH,
|
|
|
|
|
DOWNLOAD_APP_TOAST_ID,
|
|
|
|
|
ONBOARDING_TOAST_ID,
|
2025-05-17 18:01:12 -04:00
|
|
|
WASM_INIT_FAILED_TOAST_ID,
|
2025-05-16 23:25:04 -04:00
|
|
|
} from '@src/lib/constants'
|
|
|
|
|
import { isPlaywright } from '@src/lib/isPlaywright'
|
|
|
|
|
import { VITE_KC_SITE_BASE_URL } from '@src/env'
|
2025-04-01 23:54:26 -07:00
|
|
|
|
2025-04-07 07:08:31 -04:00
|
|
|
// CYCLIC REF
|
|
|
|
|
sceneInfra.camControls.engineStreamActor = engineStreamActor
|
|
|
|
|
|
2024-11-07 17:23:03 -05:00
|
|
|
maybeWriteToDisk()
|
|
|
|
|
.then(() => {})
|
|
|
|
|
.catch(() => {})
|
2022-11-22 09:06:08 +11:00
|
|
|
|
2023-06-22 16:43:33 +10:00
|
|
|
export function App() {
|
2025-05-17 07:51:25 -04:00
|
|
|
useQueryParamEffects()
|
2023-11-07 14:29:50 +11:00
|
|
|
const { project, file } = useLoaderData() as IndexLoaderData
|
2025-05-14 09:06:29 -04:00
|
|
|
const [nativeFileMenuCreated, setNativeFileMenuCreated] = useState(false)
|
Add ability to create and open URLs to create files (#4166)
* Rename `homeMachine` and accessories to `projectsMachine`
* Separate out `/home` route from `projectsMachine`
* Add logic to navigate out from deleted or renamed project
* Show a warning in the command palette for deleting a project
* Make it navigate when you create a project
* Update "New project" button to use command bar flow
Closes #2585
* More explicit warning message text
* Make projects watching code not run in web
* Tests first version: nested loops
* Tests second version: flattened
* Remove console logs
* Fix tsc
* @jtran feedback, use the type guard util
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Fix tests that relied on one-click, no-navigation project creation
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)"
This reverts commit 7545b61b49dd35cbd229aa5c35273d52e5db8739.
* Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)"
This reverts commit 3d2e48732c588b9964502b6590da139c1a0d91b0.
* Add a mask to the state indicator to client-side scale test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Fix lint
* Fix tsc
* Add menu item to share link to file
* Forward query params while redirecting to /home or /file
* Add (broken) event logic and command triggering logic
* Fix a couple stray tests that still relied on the old way of creating projects
* De-flake another text that could be thrown off by toast-based selectors
* FMT
* Dumb test error because I was rushing
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Ahhh more flaky toasts, they're everywhere!
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)
* Side quest: Only register commands once, power their disabled status while selecting commands via optional actor
* Get query-triggered command working in browser too
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)
* Tests always run on localhost, don't expect the prod origin
* rerun CI
* wip
* wip
* Everything's pretty much done but url.zoo.dev has been broken and we need to think about how to test reliably
* Merge branch 'main' into franknoirot/4088/create-file-url
* Add useCreateFileLinkQuery on Home page
* Get primary user flow working on desktop
* Rework to open browser app first, then send along to the desktop app if asked
* Styling updates to OpenInDesktopAppHandler
* Clean up unecessary file
* Merge branch 'main' into franknoirot/4088/create-file-url
* Separate creating `createFileUrl` and shortlink so it is unit testable
* Add E2E test for importing file from URL
* Add a couple component tests for OpenInDesktopAppHandler
* Fix the "existing project" user flow
* Add E2E test for "add to existing project" user flow
* Undo mistaken or unecessary changes
* Lints, fmt, tsc
* Fix unit test
* Fix broken rename and delete project commands
Something about the `optionsFromContext` config no longer works with file I/O-related commands. I suspect this has to do with our read/write loop patching
* Fix unit test, use kebab-case for url query param
* Use dev urls everywhere when configured that way
I think we were just using some constants that ended up returning bad
values for dev, it seemed to return a working shortlink when I went
through the flow.
* Clean up unneeded PROD_TOKEN
* Fix browser command flow, because we had made the projectMachine desktop-only on main
* Make the test executor a bit more patient (#5004)
* Fix so that all artifact commands are returned regardless of caching (#5005)
* Fix so that all artifact commands are returned regardless of caching
* Add some more docs and fix up old ones
* Add new lint to disallow use of confusing isNaN (#4999)
* Point-and-click Sweep (first PR) (#4989)
* Refactor 'Delete selection' as actor
Will fix #4662
* WIP logging
* WIP: working Solid3dGetExtrusionFaceInfo for loft
* Working wall deletion of loft
* Add offset plane deletion
* Add feature tree deletion of shell
* Clean up
* Revert "Clean up"
This reverts commit 214763cc2bdf6227d8d8abda0f600f4ec5399327.
* Clean up rust changes, taking the sketch with the most paths
* Working cap selection and deletion
* Clean up
* Add test for loft and offset plane deletion via selection
* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-16-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores)
* Set reenter: false as it was originally
* Passing test
* Add shell deletion via feature tree test
* Revert the migration to promise actor
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Trigger CI
* Use cmd.id as solid_id after latest engine merge
* Add feature tree deletion of offset plane and fix lint
* Add feature tree deletion of loft
* Clean up
* Better comment
* Lint fix
* Remove sketch sorting
* WIP: sweep point-and-click
* Working sweep
* Add test
* Make sweep a development command
* Fix tsc error
* Clean up for review
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Upgrade typescript-eslint from 5.62.0 to 8.19.1 and remove eslint-config-react-app (#5006)
* Fix lost lints and add new ones (#5011)
* Add eslint-plugin-jsx-a11y dependency
* Add jsx-a11y lint
* Add eslint-plugin-react-hooks dependency
* Add react hooks lints
* Ignore new react hooks lint in tests
* Add eslint-plugin-testing-library dependency
* Add testing-library lint
* Fix yarn lint to use all files recursively
* Developer workflow: added auto generated workspace file from vitest extension in vscode (#4997)
* chore: added auto generated workspace file from vitest extension in vscode
* fix: auto fmt fixes
* Change Dependabot PRs to always be made on Mondays (#5025)
* Add packages to Dependabot updates (#5024)
* Bump @lezer/generator from 1.7.1 to 1.7.2 (#5018)
Bumps [@lezer/generator](https://github.com/lezer-parser/generator) from 1.7.1 to 1.7.2.
- [Changelog](https://github.com/lezer-parser/generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lezer-parser/generator/compare/1.7.1...1.7.2)
---
updated-dependencies:
- dependency-name: "@lezer/generator"
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Bump handlebars from 6.2.0 to 6.3.0 in /src/wasm-lib (#5012)
Bumps [handlebars](https://github.com/sunng87/handlebars-rust) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/sunng87/handlebars-rust/releases)
- [Changelog](https://github.com/sunng87/handlebars-rust/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sunng87/handlebars-rust/compare/v6.2.0...v6.3.0)
---
updated-dependencies:
- dependency-name: handlebars
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Bump syn from 2.0.95 to 2.0.96 in /src/wasm-lib (#5015)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.95 to 2.0.96.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.95...2.0.96)
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix artifact types to be more accurate (#5022)
* Fix Cargo.lock to not have changes (#5034)
* Upgrade all wasm-bindgen dependencies together (#5037)
* Disable auto-updater on non-versioned builds (#5042)
* turns on helix from edge (#5036)
* updates for new lib
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* autocomplete
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* bump version
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* bump all the things
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* new samples
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* docs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
---------
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* ci: Add yarn test of packages/codemirror-lang-kcl (#5035)
* ci: Add yarn test of packages/codemirror-lang-kcl
* Fix CI error running tests
* Fix postcss config error
* Bump xstate from 5.17.4 to 5.19.2 (#5027)
* Hook up chamfer UI with AST-mod (#4694)
* button
* config
* hook up with ast
* cmd bar test
* button states fix and test
* little naming fix
* xState action to actor
* remove button state test updates
* fixture-based approach
* nightly
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Update src/lib/toolbar.ts
Co-authored-by: Frank Noirot <frank@zoo.dev>
---------
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
* Remove Redundant Fillet Button State Test (#5009)
delete obsolete test
* Bump @types/node from 20.14.9 to 22.10.6 in /packages/codemirror-lsp-client (#5041)
* custom axis and origin example for helix (#5057)
* custom axis and origin for helix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* empty
---------
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Bump typescript from 5.7.2 to 5.7.3 (#5021)
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.2 to 5.7.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)
---
updated-dependencies:
- dependency-name: typescript
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Refactor: break out `copyFileShareLink` into standalone function
* Add "Share file" to command palette
* Update dumb use of site URL instead of prod app URL
* fmt
* @lf94 nit
* @pierremtb spinner feedback
* Hide share link command and disable menu item for now
* Just comment out the command config for now
---------
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: 49lf <ircsurfer33@gmail.com>
Co-authored-by: Adam Sunderland <iterion@gmail.com>
Co-authored-by: Adam Sunderland <adam@kittycad.io>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
Co-authored-by: max <margorskyi@gmail.com>
2025-01-23 19:18:27 -05:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
const location = useLocation()
|
2024-02-12 18:11:47 -05:00
|
|
|
const navigate = useNavigate()
|
|
|
|
|
const filePath = useAbsoluteFilePath()
|
2024-03-11 17:50:31 -07:00
|
|
|
const { onProjectOpen } = useLspContext()
|
2024-04-11 13:15:49 -07:00
|
|
|
// We need the ref for the outermost div so we can screenshot the app for
|
|
|
|
|
// the coredump.
|
|
|
|
|
const ref = useRef<HTMLDivElement>(null)
|
2024-03-11 17:50:31 -07:00
|
|
|
|
2025-04-07 07:08:31 -04:00
|
|
|
// Stream related refs and data
|
2025-05-02 15:54:49 -04:00
|
|
|
const [searchParams] = useSearchParams()
|
2025-04-07 07:08:31 -04:00
|
|
|
const pool = searchParams.get('pool')
|
|
|
|
|
|
2024-03-12 23:57:43 -07:00
|
|
|
const projectName = project?.name || null
|
|
|
|
|
const projectPath = project?.path || null
|
2025-02-01 06:40:02 -05:00
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
// Run LSP file open hook when navigating between projects or files
|
2024-03-11 17:50:31 -07:00
|
|
|
useEffect(() => {
|
2024-03-12 23:57:43 -07:00
|
|
|
onProjectOpen({ name: projectName, path: projectPath }, file || null)
|
2025-05-02 15:54:49 -04:00
|
|
|
}, [onProjectOpen, projectName, projectPath, file])
|
2023-09-09 01:38:36 -04:00
|
|
|
|
2023-02-21 10:28:34 +11:00
|
|
|
useHotKeyListener()
|
2024-04-11 13:15:49 -07:00
|
|
|
|
2025-02-21 13:47:36 -05:00
|
|
|
const settings = useSettings()
|
2025-04-07 07:08:31 -04:00
|
|
|
const authToken = useToken()
|
2024-06-28 18:06:40 -07:00
|
|
|
|
2024-02-15 14:25:26 -05:00
|
|
|
useHotkeys('backspace', (e) => {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
})
|
2024-05-20 20:52:33 -07:00
|
|
|
useHotkeyWrapper(
|
2024-08-16 07:15:42 -04:00
|
|
|
[isDesktop() ? 'mod + ,' : 'shift + mod + ,'],
|
2024-08-09 02:47:25 -04:00
|
|
|
() => navigate(filePath + PATHS.SETTINGS),
|
2024-02-12 18:11:47 -05:00
|
|
|
{
|
|
|
|
|
splitKey: '|',
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-08-06 21:29:26 -04:00
|
|
|
|
2025-03-31 14:37:04 -04:00
|
|
|
useHotkeyWrapper(['mod + s'], () => {
|
|
|
|
|
toast.success('Your work is auto-saved in real-time')
|
|
|
|
|
})
|
|
|
|
|
|
2023-09-15 04:35:48 -07:00
|
|
|
useEngineConnectionSubscriptions()
|
2023-07-31 06:33:10 -04:00
|
|
|
|
2025-04-07 07:08:31 -04:00
|
|
|
useEffect(() => {
|
2025-05-06 15:07:22 -04:00
|
|
|
// Not too useful for regular flows but on modeling view refresh,
|
|
|
|
|
// fetch the token count. The regular flow is the count is initialized
|
|
|
|
|
// by the Projects view.
|
|
|
|
|
billingActor.send({ type: BillingTransition.Update, apiToken: authToken })
|
|
|
|
|
|
2025-05-29 15:02:12 -04:00
|
|
|
// Tell engineStream to wait for dependencies to start streaming.
|
|
|
|
|
engineStreamActor.send({ type: EngineStreamTransition.WaitForDependencies })
|
|
|
|
|
|
2025-04-07 07:08:31 -04:00
|
|
|
// When leaving the modeling scene, cut the engine stream.
|
|
|
|
|
return () => {
|
2025-05-15 11:58:00 -04:00
|
|
|
// When leaving the modeling scene, cut the engine stream.
|
|
|
|
|
// Stop is more serious than Pause
|
|
|
|
|
engineStreamActor.send({ type: EngineStreamTransition.Stop })
|
2025-04-07 07:08:31 -04:00
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
2025-05-02 15:54:49 -04:00
|
|
|
// Show a custom toast to users if they haven't done the onboarding
|
|
|
|
|
// and they're on the web
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const onboardingStatus =
|
|
|
|
|
settings.app.onboardingStatus.current ||
|
|
|
|
|
settings.app.onboardingStatus.default
|
2025-05-19 09:38:38 -04:00
|
|
|
const needsOnboarded =
|
|
|
|
|
!isDesktop() &&
|
|
|
|
|
searchParams.size === 0 &&
|
|
|
|
|
needsToOnboard(location, onboardingStatus)
|
2025-05-02 15:54:49 -04:00
|
|
|
|
2025-05-19 09:38:38 -04:00
|
|
|
if (needsOnboarded) {
|
2025-05-02 15:54:49 -04:00
|
|
|
toast.success(
|
|
|
|
|
() =>
|
|
|
|
|
TutorialRequestToast({
|
|
|
|
|
onboardingStatus: settings.app.onboardingStatus.current,
|
|
|
|
|
navigate,
|
|
|
|
|
codeManager,
|
|
|
|
|
kclManager,
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
id: ONBOARDING_TOAST_ID,
|
|
|
|
|
duration: Number.POSITIVE_INFINITY,
|
|
|
|
|
icon: null,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
2025-05-19 09:38:38 -04:00
|
|
|
}, [settings.app.onboardingStatus])
|
2025-05-02 15:54:49 -04:00
|
|
|
|
2025-05-16 23:25:04 -04:00
|
|
|
useEffect(() => {
|
|
|
|
|
const needsDownloadAppToast =
|
|
|
|
|
!isDesktop() &&
|
|
|
|
|
!isPlaywright() &&
|
2025-05-17 21:23:43 -04:00
|
|
|
searchParams.size === 0 &&
|
2025-05-16 23:25:04 -04:00
|
|
|
!settings.app.dismissWebBanner.current
|
|
|
|
|
if (needsDownloadAppToast) {
|
|
|
|
|
toast.success(
|
|
|
|
|
() =>
|
|
|
|
|
DownloadAppToast({
|
|
|
|
|
onAccept: () => {
|
|
|
|
|
openWindow(`${VITE_KC_SITE_BASE_URL}/${APP_DOWNLOAD_PATH}`)
|
|
|
|
|
.then(() => {
|
|
|
|
|
toast.dismiss(DOWNLOAD_APP_TOAST_ID)
|
|
|
|
|
})
|
|
|
|
|
.catch(reportRejection)
|
|
|
|
|
},
|
|
|
|
|
onDismiss: () => {
|
|
|
|
|
toast.dismiss(DOWNLOAD_APP_TOAST_ID)
|
|
|
|
|
settingsActor.send({
|
|
|
|
|
type: 'set.app.dismissWebBanner',
|
|
|
|
|
data: { level: 'user', value: true },
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
id: DOWNLOAD_APP_TOAST_ID,
|
|
|
|
|
duration: Number.POSITIVE_INFINITY,
|
|
|
|
|
icon: null,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
2025-05-17 18:01:12 -04:00
|
|
|
useEffect(() => {
|
|
|
|
|
const needsWasmInitFailedToast = !isDesktop() && kclManager.wasmInitFailed
|
|
|
|
|
if (needsWasmInitFailedToast) {
|
|
|
|
|
toast.success(
|
|
|
|
|
() =>
|
|
|
|
|
WasmErrToast({
|
|
|
|
|
onDismiss: () => {
|
|
|
|
|
toast.dismiss(WASM_INIT_FAILED_TOAST_ID)
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
id: WASM_INIT_FAILED_TOAST_ID,
|
|
|
|
|
duration: Number.POSITIVE_INFINITY,
|
|
|
|
|
icon: null,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}, [kclManager.wasmInitFailed])
|
|
|
|
|
|
2025-05-14 09:06:29 -04:00
|
|
|
// Only create the native file menus on desktop
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (isDesktop()) {
|
|
|
|
|
window.electron
|
|
|
|
|
.createModelingPageMenu()
|
|
|
|
|
.then(() => {
|
|
|
|
|
setNativeFileMenuCreated(true)
|
|
|
|
|
})
|
|
|
|
|
.catch(reportRejection)
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
2022-11-12 13:11:54 +11:00
|
|
|
return (
|
2024-09-12 22:06:50 -04:00
|
|
|
<div className="relative h-full flex flex-col" ref={ref}>
|
2023-08-06 21:29:26 -04:00
|
|
|
<AppHeader
|
2025-05-08 20:37:21 -04:00
|
|
|
className="transition-opacity transition-duration-75"
|
2023-10-16 13:28:41 -04:00
|
|
|
project={{ project, file }}
|
2023-08-18 10:27:01 -04:00
|
|
|
enableMenu={true}
|
2025-05-14 09:06:29 -04:00
|
|
|
nativeFileMenuCreated={nativeFileMenuCreated}
|
2025-04-23 15:20:45 -04:00
|
|
|
>
|
|
|
|
|
<CommandBarOpenButton />
|
|
|
|
|
<ShareButton />
|
|
|
|
|
</AppHeader>
|
2024-04-18 20:09:40 -07:00
|
|
|
<ModalContainer />
|
2025-05-08 20:37:21 -04:00
|
|
|
<ModelingSidebar />
|
2025-04-07 07:08:31 -04:00
|
|
|
<EngineStream pool={pool} authToken={authToken} />
|
2024-02-11 12:59:00 +11:00
|
|
|
{/* <CamToggle /> */}
|
2025-05-02 15:54:49 -04:00
|
|
|
<LowerRightControls navigate={navigate}>
|
2024-07-05 18:40:43 -04:00
|
|
|
<UnitsMenu />
|
2024-05-24 13:00:15 +10:00
|
|
|
<Gizmo />
|
|
|
|
|
</LowerRightControls>
|
2022-11-12 13:11:54 +11:00
|
|
|
</div>
|
2022-11-26 08:34:23 +11:00
|
|
|
)
|
2022-11-12 13:11:54 +11:00
|
|
|
}
|