Merge main
This commit is contained in:
committed by
Adam Chalmers
parent
956f00c5a1
commit
b54a17a4fa
10
.github/workflows/playwright.yml
vendored
10
.github/workflows/playwright.yml
vendored
@ -33,8 +33,18 @@ jobs:
|
|||||||
rust:
|
rust:
|
||||||
- 'src/wasm-lib/**'
|
- 'src/wasm-lib/**'
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
playwright-chrome:
|
playwright-chrome:
|
||||||
timeout-minutes: ${{ matrix.os == 'macos-14' && 60 || 40 }}
|
timeout-minutes: ${{ matrix.os == 'macos-14' && 60 || 40 }}
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
playwright-ubuntu:
|
||||||
|
timeout-minutes: 30
|
||||||
|
runs-on: ubuntu-latest-8-cores
|
||||||
|
=======
|
||||||
|
playwright-ubuntu:
|
||||||
|
timeout-minutes: 30
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -314,6 +314,7 @@ export function normaliseKclNumbers(code: string, ignoreZero = true): string {
|
|||||||
return replaceNumbers(code)
|
return replaceNumbers(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export async function getUtils(page: Page, test_?: typeof test) {
|
export async function getUtils(page: Page, test_?: typeof test) {
|
||||||
if (!test) {
|
if (!test) {
|
||||||
console.warn(
|
console.warn(
|
||||||
@ -321,6 +322,11 @@ export async function getUtils(page: Page, test_?: typeof test) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
export async function getUtils(page: Page) {
|
||||||
|
=======
|
||||||
|
export async function getUtils(page: Page) {
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
// Chrome devtools protocol session only works in Chromium
|
// Chrome devtools protocol session only works in Chromium
|
||||||
const browserType = page.context().browser()?.browserType().name()
|
const browserType = page.context().browser()?.browserType().name()
|
||||||
const cdpSession =
|
const cdpSession =
|
||||||
|
@ -755,7 +755,8 @@ const part001 = startSketchOn('XZ')
|
|||||||
await clickConstrained({
|
await clickConstrained({
|
||||||
hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y },
|
hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y },
|
||||||
constraintType: 'xAbsolute',
|
constraintType: 'xAbsolute',
|
||||||
expectBeforeUnconstrained: 'tangentialArcTo([3.14 + 13, -3.14], false, %)',
|
expectBeforeUnconstrained:
|
||||||
|
'tangentialArcTo([3.14 + 13, -3.14], false, %)',
|
||||||
expectAfterUnconstrained: 'tangentialArcTo([16.14, -3.14], false, %)',
|
expectAfterUnconstrained: 'tangentialArcTo([16.14, -3.14], false, %)',
|
||||||
expectFinal: 'tangentialArcTo([xAbs001, -3.14], false, %)',
|
expectFinal: 'tangentialArcTo([xAbs001, -3.14], false, %)',
|
||||||
ang: ang + 180,
|
ang: ang + 180,
|
||||||
@ -766,8 +767,10 @@ const part001 = startSketchOn('XZ')
|
|||||||
await clickUnconstrained({
|
await clickUnconstrained({
|
||||||
hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y },
|
hoverPos: { x: tangentialArcTo.x, y: tangentialArcTo.y },
|
||||||
constraintType: 'yAbsolute',
|
constraintType: 'yAbsolute',
|
||||||
expectBeforeUnconstrained: 'tangentialArcTo([xAbs001, -3.14], false, %)',
|
expectBeforeUnconstrained:
|
||||||
expectAfterUnconstrained: 'tangentialArcTo([xAbs001, yAbs001], false, %)',
|
'tangentialArcTo([xAbs001, -3.14], false, %)',
|
||||||
|
expectAfterUnconstrained:
|
||||||
|
'tangentialArcTo([xAbs001, yAbs001], false, %)',
|
||||||
expectFinal: 'tangentialArcTo([xAbs001, -3.14], false, %)',
|
expectFinal: 'tangentialArcTo([xAbs001, -3.14], false, %)',
|
||||||
ang: ang + 180,
|
ang: ang + 180,
|
||||||
steps: 10,
|
steps: 10,
|
||||||
|
@ -77,7 +77,17 @@ test.describe('Testing settings', () => {
|
|||||||
exact: true,
|
exact: true,
|
||||||
})
|
})
|
||||||
const inputLocator = page.locator('input[name="modeling-showDebugPanel"]')
|
const inputLocator = page.locator('input[name="modeling-showDebugPanel"]')
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Open the settings modal with the browser keyboard shortcut
|
||||||
|
await page.keyboard.press('Meta+Shift+,')
|
||||||
|
=======
|
||||||
|
|
||||||
|
// Open the settings modal with the browser keyboard shortcut
|
||||||
|
await page.keyboard.press('Meta+Shift+,')
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// Open the settings modal with the browser keyboard shortcut
|
// Open the settings modal with the browser keyboard shortcut
|
||||||
await page.keyboard.press('ControlOrMeta+Shift+,')
|
await page.keyboard.press('ControlOrMeta+Shift+,')
|
||||||
|
|
||||||
@ -128,7 +138,58 @@ test.describe('Testing settings', () => {
|
|||||||
const u = await getUtils(page)
|
const u = await getUtils(page)
|
||||||
await page.setViewportSize({ width: 1200, height: 500 })
|
await page.setViewportSize({ width: 1200, height: 500 })
|
||||||
await u.waitForAuthSkipAppStart()
|
await u.waitForAuthSkipAppStart()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
await expect(
|
||||||
|
page.getByRole('heading', { name: 'Settings', exact: true })
|
||||||
|
).toBeVisible()
|
||||||
|
await page
|
||||||
|
.locator('select[name="app-theme"]')
|
||||||
|
.selectOption({ value: 'light' })
|
||||||
|
|
||||||
|
// Verify the toast appeared
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Set theme to "light" for this project`)
|
||||||
|
).toBeVisible()
|
||||||
|
// Check that the theme changed
|
||||||
|
await expect(page.locator('body')).not.toHaveClass(`body-bg dark`)
|
||||||
|
|
||||||
|
// Check that the user setting was not changed
|
||||||
|
await page.getByRole('radio', { name: 'User' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('dark')
|
||||||
|
|
||||||
|
// Roll back to default "system" theme
|
||||||
|
await page
|
||||||
|
.getByText(
|
||||||
|
'themeRoll back themeRoll back to match defaultThe overall appearance of the appl'
|
||||||
|
)
|
||||||
|
.hover()
|
||||||
|
await page
|
||||||
|
.getByRole('button', {
|
||||||
|
name: 'Roll back theme',
|
||||||
|
})
|
||||||
|
.click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
|
||||||
|
// Check that the project setting did not change
|
||||||
|
await page.getByRole('radio', { name: 'Project' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('light')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Project settings can be opened with keybinding from the editor', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const u = await getUtils(page)
|
||||||
|
await page.setViewportSize({ width: 1200, height: 500 })
|
||||||
|
await u.waitForAuthSkipAppStart()
|
||||||
|
await page
|
||||||
|
.getByRole('button', { name: 'Start Sketch' })
|
||||||
|
.waitFor({ state: 'visible' })
|
||||||
|
=======
|
||||||
|
await expect(headingLocator).toBeVisible()
|
||||||
|
await page.locator('#showDebugPanel').getByText('OffOn').click()
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
await test.step('Open keybindings settings', async () => {
|
await test.step('Open keybindings settings', async () => {
|
||||||
// Open the settings modal with the browser keyboard shortcut
|
// Open the settings modal with the browser keyboard shortcut
|
||||||
await page.keyboard.press('ControlOrMeta+Shift+,')
|
await page.keyboard.press('ControlOrMeta+Shift+,')
|
||||||
@ -141,7 +202,31 @@ test.describe('Testing settings', () => {
|
|||||||
// Go to the hotkey for Command Palette.
|
// Go to the hotkey for Command Palette.
|
||||||
const commandPalette = page.getByText('Toggle Command Palette')
|
const commandPalette = page.getByText('Toggle Command Palette')
|
||||||
await commandPalette.scrollIntoViewIfNeeded()
|
await commandPalette.scrollIntoViewIfNeeded()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Put the cursor in the editor
|
||||||
|
await page.locator('.cm-content').click()
|
||||||
|
|
||||||
|
// Open the settings modal with the browser keyboard shortcut
|
||||||
|
await page.keyboard.press('Meta+Shift+,')
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.getByRole('heading', { name: 'Settings', exact: true })
|
||||||
|
).toBeVisible()
|
||||||
|
await page
|
||||||
|
.locator('select[name="app-theme"]')
|
||||||
|
.selectOption({ value: 'light' })
|
||||||
|
=======
|
||||||
|
// Close it and open again with keyboard shortcut, while KCL editor is focused
|
||||||
|
// Put the cursor in the editor
|
||||||
|
await test.step('Open settings with keyboard shortcut', async () => {
|
||||||
|
await page.getByTestId('settings-close-button').click()
|
||||||
|
await page.locator('.cm-content').click()
|
||||||
|
await page.keyboard.press('Meta+Shift+,')
|
||||||
|
await expect(headingLocator).toBeVisible()
|
||||||
|
})
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// The heading is above it and should be in view now.
|
// The heading is above it and should be in view now.
|
||||||
const commandPaletteHeading = page.getByRole('heading', {
|
const commandPaletteHeading = page.getByRole('heading', {
|
||||||
name: 'Command Palette',
|
name: 'Command Palette',
|
||||||
@ -150,6 +235,63 @@ test.describe('Testing settings', () => {
|
|||||||
const hotkey = commandPaletteHeading.locator('+ div kbd')
|
const hotkey = commandPaletteHeading.locator('+ div kbd')
|
||||||
const text = process.platform === 'darwin' ? 'Command+K' : 'Control+K'
|
const text = process.platform === 'darwin' ? 'Command+K' : 'Control+K'
|
||||||
await expect(hotkey).toHaveText(text)
|
await expect(hotkey).toHaveText(text)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Verify the toast appeared
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Set theme to "light" for this project`)
|
||||||
|
).toBeVisible()
|
||||||
|
// Check that the theme changed
|
||||||
|
await expect(page.locator('body')).not.toHaveClass(`body-bg dark`)
|
||||||
|
|
||||||
|
// Check that the user setting was not changed
|
||||||
|
await page.getByRole('radio', { name: 'User' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('dark')
|
||||||
|
|
||||||
|
// Roll back to default "system" theme
|
||||||
|
await page
|
||||||
|
.getByText(
|
||||||
|
'themeRoll back themeRoll back to match defaultThe overall appearance of the appl'
|
||||||
|
)
|
||||||
|
.hover()
|
||||||
|
await page
|
||||||
|
.getByRole('button', {
|
||||||
|
name: 'Roll back theme',
|
||||||
|
})
|
||||||
|
.click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
|
||||||
|
// Check that the project setting did not change
|
||||||
|
await page.getByRole('radio', { name: 'Project' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('light')
|
||||||
|
=======
|
||||||
|
// Verify the toast appeared
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Set show debug panel to "false" for this project`)
|
||||||
|
).toBeVisible()
|
||||||
|
// Check that the theme changed
|
||||||
|
await expect(paneButtonLocator).not.toBeVisible()
|
||||||
|
|
||||||
|
// Check that the user setting was not changed
|
||||||
|
await page.getByRole('radio', { name: 'User' }).click()
|
||||||
|
await expect(inputLocator).toBeChecked()
|
||||||
|
|
||||||
|
// Roll back to default of "off"
|
||||||
|
await await page
|
||||||
|
.getByText('show debug panelRoll back show debug panelRoll back to match')
|
||||||
|
.hover()
|
||||||
|
await page
|
||||||
|
.getByRole('button', {
|
||||||
|
name: 'Roll back show debug panel',
|
||||||
|
})
|
||||||
|
.click()
|
||||||
|
await expect(inputLocator).not.toBeChecked()
|
||||||
|
|
||||||
|
// Check that the project setting did not change
|
||||||
|
await page.getByRole('radio', { name: 'Project' }).click()
|
||||||
|
await expect(
|
||||||
|
page.locator('input[name="modeling-showDebugPanel"]')
|
||||||
|
).not.toBeChecked()
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Project and user settings can be reset', async ({ page }) => {
|
test('Project and user settings can be reset', async ({ page }) => {
|
||||||
@ -186,6 +328,7 @@ test.describe('Testing settings', () => {
|
|||||||
|
|
||||||
// Set project-level value to 50
|
// Set project-level value to 50
|
||||||
await themeColorSetting.fill(settingValues.project)
|
await themeColorSetting.fill(settingValues.project)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
// Set user-level value to 120
|
// Set user-level value to 120
|
||||||
await userSettingsTab.click()
|
await userSettingsTab.click()
|
||||||
@ -375,7 +518,14 @@ test.describe('Testing settings', () => {
|
|||||||
await page
|
await page
|
||||||
.getByRole('button', { name: 'Start Sketch' })
|
.getByRole('button', { name: 'Start Sketch' })
|
||||||
.waitFor({ state: 'visible' })
|
.waitFor({ state: 'visible' })
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
await page
|
||||||
|
.locator('select[name="app-theme"]')
|
||||||
|
.selectOption({ value: 'light' })
|
||||||
|
=======
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const userSettingsTab = page.getByRole('radio', { name: 'User' })
|
const userSettingsTab = page.getByRole('radio', { name: 'User' })
|
||||||
|
|
||||||
// Open the settings modal with lower-right button
|
// Open the settings modal with lower-right button
|
||||||
@ -383,13 +533,39 @@ test.describe('Testing settings', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
page.getByRole('heading', { name: 'Settings', exact: true })
|
page.getByRole('heading', { name: 'Settings', exact: true })
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Verify the toast appeared
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Set theme to "light" for this project`)
|
||||||
|
).toBeVisible()
|
||||||
|
// Check that the theme changed
|
||||||
|
await expect(page.locator('body')).not.toHaveClass(`body-bg dark`)
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('light')
|
||||||
|
=======
|
||||||
|
// Set user-level value to 120
|
||||||
|
await userSettingsTab.click()
|
||||||
|
await themeColorSetting.fill(settingValues.user)
|
||||||
|
await projectSettingsTab.click()
|
||||||
|
})
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const resetButton = page.getByRole('button', {
|
const resetButton = page.getByRole('button', {
|
||||||
name: 'Restore default settings',
|
name: 'Restore default settings',
|
||||||
})
|
})
|
||||||
// Default unit should be mm
|
// Default unit should be mm
|
||||||
await resetButton.click()
|
await resetButton.click()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Check that the user setting was not changed
|
||||||
|
await page.getByRole('radio', { name: 'User' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
=======
|
||||||
|
await test.step('Reset project settings', async () => {
|
||||||
|
// Click the reset settings button.
|
||||||
|
await resetButton.click()
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
await test.step('Change modeling default unit within project tab', async () => {
|
await test.step('Change modeling default unit within project tab', async () => {
|
||||||
const changeUnitOfMeasureInProjectTab = async (unitOfMeasure: string) => {
|
const changeUnitOfMeasureInProjectTab = async (unitOfMeasure: string) => {
|
||||||
await test.step(`Set modeling default unit to ${unitOfMeasure}`, async () => {
|
await test.step(`Set modeling default unit to ${unitOfMeasure}`, async () => {
|
||||||
@ -409,7 +585,15 @@ test.describe('Testing settings', () => {
|
|||||||
await changeUnitOfMeasureInProjectTab('cm')
|
await changeUnitOfMeasureInProjectTab('cm')
|
||||||
await changeUnitOfMeasureInProjectTab('m')
|
await changeUnitOfMeasureInProjectTab('m')
|
||||||
})
|
})
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Click the reset settings button.
|
||||||
|
await page.getByRole('button', { name: 'Restore default settings' }).click()
|
||||||
|
=======
|
||||||
|
// Verify it is now set to the inherited user value
|
||||||
|
await expect(themeColorSetting).toHaveValue(settingValues.default)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// Go to the user tab
|
// Go to the user tab
|
||||||
await userSettingsTab.click()
|
await userSettingsTab.click()
|
||||||
await test.step('Change modeling default unit within user tab', async () => {
|
await test.step('Change modeling default unit within user tab', async () => {
|
||||||
@ -431,11 +615,33 @@ test.describe('Testing settings', () => {
|
|||||||
await changeUnitOfMeasureInUserTab('cm')
|
await changeUnitOfMeasureInUserTab('cm')
|
||||||
await changeUnitOfMeasureInUserTab('m')
|
await changeUnitOfMeasureInUserTab('m')
|
||||||
})
|
})
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Verify it is now set to the default value
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
=======
|
||||||
|
// Check that the user setting also rolled back
|
||||||
|
await userSettingsTab.click()
|
||||||
|
await expect(themeColorSetting).toHaveValue(settingValues.default)
|
||||||
|
await projectSettingsTab.click()
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// Close settings
|
// Close settings
|
||||||
const settingsCloseButton = page.getByTestId('settings-close-button')
|
const settingsCloseButton = page.getByTestId('settings-close-button')
|
||||||
await settingsCloseButton.click()
|
await settingsCloseButton.click()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Set the user theme to light.
|
||||||
|
await page
|
||||||
|
.locator('select[name="app-theme"]')
|
||||||
|
.selectOption({ value: 'light' })
|
||||||
|
=======
|
||||||
|
// Set project-level value to 50 again to test the user-level reset
|
||||||
|
await themeColorSetting.fill(settingValues.project)
|
||||||
|
await userSettingsTab.click()
|
||||||
|
})
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
await test.step('Change modeling default unit within command bar', async () => {
|
await test.step('Change modeling default unit within command bar', async () => {
|
||||||
const commands = page.getByRole('button', { name: 'Commands' })
|
const commands = page.getByRole('button', { name: 'Commands' })
|
||||||
const changeUnitOfMeasureInCommandBar = async (unitOfMeasure: string) => {
|
const changeUnitOfMeasureInCommandBar = async (unitOfMeasure: string) => {
|
||||||
@ -445,13 +651,36 @@ test.describe('Testing settings', () => {
|
|||||||
'Settings · modeling · default unit'
|
'Settings · modeling · default unit'
|
||||||
)
|
)
|
||||||
await settingsModelingDefaultUnitCommand.click()
|
await settingsModelingDefaultUnitCommand.click()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Verify the toast appeared
|
||||||
|
await expect(
|
||||||
|
page.getByText(`Set theme to "light" as a user default`)
|
||||||
|
).toBeVisible()
|
||||||
|
// Check that the theme changed
|
||||||
|
await expect(page.locator('body')).not.toHaveClass(`body-bg dark`)
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('light')
|
||||||
|
=======
|
||||||
|
await test.step('Reset user settings', async () => {
|
||||||
|
// Change the setting and click the reset settings button.
|
||||||
|
await themeColorSetting.fill(settingValues.user)
|
||||||
|
await resetButton.click()
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const commandOption = page.getByRole('option', {
|
const commandOption = page.getByRole('option', {
|
||||||
name: unitOfMeasure,
|
name: unitOfMeasure,
|
||||||
exact: true,
|
exact: true,
|
||||||
})
|
})
|
||||||
await commandOption.click()
|
await commandOption.click()
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
await page.getByRole('radio', { name: 'Project' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('light')
|
||||||
|
=======
|
||||||
|
// Verify it is now set to the default value
|
||||||
|
await expect(themeColorSetting).toHaveValue(settingValues.default)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const toastMessage = page.getByText(
|
const toastMessage = page.getByText(
|
||||||
`Set default unit to "${unitOfMeasure}" for this project`
|
`Set default unit to "${unitOfMeasure}" for this project`
|
||||||
)
|
)
|
||||||
@ -491,6 +720,25 @@ test.describe('Testing settings', () => {
|
|||||||
await changeUnitOfMeasureInGizmo('mm', 'Millimeters')
|
await changeUnitOfMeasureInGizmo('mm', 'Millimeters')
|
||||||
await changeUnitOfMeasureInGizmo('cm', 'Centimeters')
|
await changeUnitOfMeasureInGizmo('cm', 'Centimeters')
|
||||||
await changeUnitOfMeasureInGizmo('m', 'Meters')
|
await changeUnitOfMeasureInGizmo('m', 'Meters')
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// Click the reset settings button.
|
||||||
|
await page.getByRole('button', { name: 'Restore default settings' }).click()
|
||||||
|
// Verify it is now set to the default value
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
|
||||||
|
await page.getByRole('radio', { name: 'User' }).click()
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
|
||||||
|
// Click the reset settings button.
|
||||||
|
await page.getByRole('button', { name: 'Restore default settings' }).click()
|
||||||
|
|
||||||
|
// Verify it is now set to the default value
|
||||||
|
await expect(page.locator('select[name="app-theme"]')).toHaveValue('system')
|
||||||
|
=======
|
||||||
|
// Check that the project setting also changed
|
||||||
|
await projectSettingsTab.click()
|
||||||
|
await expect(themeColorSetting).toHaveValue(settingValues.default)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
7295
src-tauri/Cargo.lock
generated
Normal file
7295
src-tauri/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
src-tauri/Cargo.toml
Normal file
47
src-tauri/Cargo.toml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[package]
|
||||||
|
name = "app"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "The Zoo Modeling App"
|
||||||
|
authors = ["Zoo Engineers <eng@zoo.dev>"]
|
||||||
|
license = ""
|
||||||
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
default-run = "app"
|
||||||
|
edition = "2021"
|
||||||
|
rust-version = "1.70"
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build = { version = "2.0.0-beta.18", features = [] }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1"
|
||||||
|
kcl-lib = { version = "0.2", path = "../src/wasm-lib/kcl" }
|
||||||
|
kittycad = "0.3.12"
|
||||||
|
log = "0.4.21"
|
||||||
|
mdns-sd = "0.11.1"
|
||||||
|
oauth2 = "4.4.2"
|
||||||
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
tauri = { version = "2.0.0-beta.23", features = [ "devtools", "unstable"] }
|
||||||
|
tauri-plugin-cli = { version = "2.0.0-beta.7" }
|
||||||
|
tauri-plugin-deep-link = { version = "2.0.0-beta.8" }
|
||||||
|
tauri-plugin-dialog = { version = "2.0.0-beta.6" }
|
||||||
|
tauri-plugin-fs = { version = "2.0.0-beta.10" }
|
||||||
|
tauri-plugin-http = { version = "2.0.0-beta.11" }
|
||||||
|
tauri-plugin-log = { version = "2.0.0-beta.7" }
|
||||||
|
tauri-plugin-os = { version = "2.0.0-beta.7" }
|
||||||
|
tauri-plugin-persisted-scope = { version = "2.0.0-beta.10" }
|
||||||
|
tauri-plugin-process = { version = "2.0.0-beta.7" }
|
||||||
|
tauri-plugin-shell = { version = "2.0.0-beta.8" }
|
||||||
|
tauri-plugin-updater = { version = "2.0.0-beta.9" }
|
||||||
|
tokio = { version = "1.37.0", features = ["time", "fs", "process"] }
|
||||||
|
toml = "0.8.2"
|
||||||
|
url = "2.5.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["updater"]
|
||||||
|
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
|
||||||
|
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
|
||||||
|
# DO NOT REMOVE!!
|
||||||
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
updater = []
|
13
src/App.tsx
13
src/App.tsx
@ -28,6 +28,12 @@ import { CoreDumpManager } from 'lib/coredump'
|
|||||||
import { UnitsMenu } from 'components/UnitsMenu'
|
import { UnitsMenu } from 'components/UnitsMenu'
|
||||||
|
|
||||||
export function App() {
|
export function App() {
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
useRefreshSettings(paths.FILE + 'SETTINGS')
|
||||||
|
=======
|
||||||
|
useRefreshSettings(PATHS.FILE + 'SETTINGS')
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
const { project, file } = useLoaderData() as IndexLoaderData
|
const { project, file } = useLoaderData() as IndexLoaderData
|
||||||
useRefreshSettings(PATHS.FILE + 'SETTINGS')
|
useRefreshSettings(PATHS.FILE + 'SETTINGS')
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -62,7 +68,14 @@ export function App() {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
useHotkeyWrapper(
|
useHotkeyWrapper(
|
||||||
|
<<<<<<< HEAD
|
||||||
[isDesktop() ? 'mod + ,' : 'shift + mod + ,'],
|
[isDesktop() ? 'mod + ,' : 'shift + mod + ,'],
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
[isTauri() ? 'mod + ,' : 'shift + mod + ,'],
|
||||||
|
() => navigate(filePath + paths.SETTINGS),
|
||||||
|
=======
|
||||||
|
[isTauri() ? 'mod + ,' : 'shift + mod + ,'],
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
() => navigate(filePath + PATHS.SETTINGS),
|
() => navigate(filePath + PATHS.SETTINGS),
|
||||||
{
|
{
|
||||||
splitKey: '|',
|
splitKey: '|',
|
||||||
|
@ -76,13 +76,27 @@ const router = createRouter([
|
|||||||
// Redirect to the file if we have a file path.
|
// Redirect to the file if we have a file path.
|
||||||
if (projectStartupFile.length > 0) {
|
if (projectStartupFile.length > 0) {
|
||||||
return redirect(
|
return redirect(
|
||||||
|
<<<<<<< HEAD
|
||||||
PATHS.FILE + '/' + encodeURIComponent(projectStartupFile)
|
PATHS.FILE + '/' + encodeURIComponent(projectStartupFile)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
paths.FILE + '/' + encodeURIComponent(appState.current_file)
|
||||||
|
=======
|
||||||
|
PATHS.FILE + '/' + encodeURIComponent(appState.current_file)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
return onDesktop
|
return onDesktop
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
return inTauri
|
||||||
|
? redirect(paths.HOME)
|
||||||
|
: redirect(paths.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
||||||
|
=======
|
||||||
|
return inTauri
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
? redirect(PATHS.HOME)
|
? redirect(PATHS.HOME)
|
||||||
: redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
: redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
||||||
},
|
},
|
||||||
|
@ -53,10 +53,18 @@ export const FileMachineProvider = ({
|
|||||||
if (event.data && 'name' in event.data) {
|
if (event.data && 'name' in event.data) {
|
||||||
commandBarSend({ type: 'Close' })
|
commandBarSend({ type: 'Close' })
|
||||||
navigate(
|
navigate(
|
||||||
|
<<<<<<< HEAD
|
||||||
`..${PATHS.FILE}/${encodeURIComponent(
|
`..${PATHS.FILE}/${encodeURIComponent(
|
||||||
context.selectedDirectory +
|
context.selectedDirectory +
|
||||||
window.electron.path.sep +
|
window.electron.path.sep +
|
||||||
event.data.name
|
event.data.name
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
`${paths.FILE}/${encodeURIComponent(
|
||||||
|
context.selectedDirectory + sep() + event.data.name
|
||||||
|
=======
|
||||||
|
`${PATHS.FILE}/${encodeURIComponent(
|
||||||
|
context.selectedDirectory + sep() + event.data.name
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
)}`
|
)}`
|
||||||
)
|
)
|
||||||
} else if (
|
} else if (
|
||||||
@ -65,7 +73,13 @@ export const FileMachineProvider = ({
|
|||||||
event.data.path.endsWith(FILE_EXT)
|
event.data.path.endsWith(FILE_EXT)
|
||||||
) {
|
) {
|
||||||
// Don't navigate to newly created directories
|
// Don't navigate to newly created directories
|
||||||
|
<<<<<<< HEAD
|
||||||
navigate(`..${PATHS.FILE}/${encodeURIComponent(event.data.path)}`)
|
navigate(`..${PATHS.FILE}/${encodeURIComponent(event.data.path)}`)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
navigate(`${paths.FILE}/${encodeURIComponent(event.data.path)}`)
|
||||||
|
=======
|
||||||
|
navigate(`${PATHS.FILE}/${encodeURIComponent(event.data.path)}`)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addFileToRenamingQueue: assign({
|
addFileToRenamingQueue: assign({
|
||||||
@ -198,13 +212,29 @@ export const FileMachineProvider = ({
|
|||||||
|
|
||||||
if (oldPath === file.path && project?.path) {
|
if (oldPath === file.path && project?.path) {
|
||||||
// If we just renamed the current file, navigate to the new path
|
// If we just renamed the current file, navigate to the new path
|
||||||
|
<<<<<<< HEAD
|
||||||
navigate(`..${PATHS.FILE}/${encodeURIComponent(newPath)}`)
|
navigate(`..${PATHS.FILE}/${encodeURIComponent(newPath)}`)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
navigate(paths.FILE + '/' + encodeURIComponent(newPath))
|
||||||
|
=======
|
||||||
|
navigate(PATHS.FILE + '/' + encodeURIComponent(newPath))
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
} else if (file?.path.includes(oldPath)) {
|
} else if (file?.path.includes(oldPath)) {
|
||||||
// If we just renamed a directory that the current file is in, navigate to the new path
|
// If we just renamed a directory that the current file is in, navigate to the new path
|
||||||
navigate(
|
navigate(
|
||||||
|
<<<<<<< HEAD
|
||||||
`..${PATHS.FILE}/${encodeURIComponent(
|
`..${PATHS.FILE}/${encodeURIComponent(
|
||||||
file.path.replace(oldPath, newPath)
|
file.path.replace(oldPath, newPath)
|
||||||
)}`
|
)}`
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
paths.FILE +
|
||||||
|
'/' +
|
||||||
|
encodeURIComponent(file.path.replace(oldPath, newDirPath))
|
||||||
|
=======
|
||||||
|
PATHS.FILE +
|
||||||
|
'/' +
|
||||||
|
encodeURIComponent(file.path.replace(oldPath, newDirPath))
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +290,13 @@ export const FileMachineProvider = ({
|
|||||||
file?.path.includes(event.data.path)) &&
|
file?.path.includes(event.data.path)) &&
|
||||||
project?.path
|
project?.path
|
||||||
) {
|
) {
|
||||||
|
<<<<<<< HEAD
|
||||||
navigate(`../${PATHS.FILE}/${encodeURIComponent(project.path)}`)
|
navigate(`../${PATHS.FILE}/${encodeURIComponent(project.path)}`)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
navigate(paths.FILE + '/' + encodeURIComponent(project.path))
|
||||||
|
=======
|
||||||
|
navigate(PATHS.FILE + '/' + encodeURIComponent(project.path))
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
}
|
}
|
||||||
|
|
||||||
return `Successfully deleted ${isDir ? 'folder' : 'file'} "${
|
return `Successfully deleted ${isDir ? 'folder' : 'file'} "${
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
import type { IndexLoaderData } from 'lib/types'
|
import type { IndexLoaderData } from 'lib/types'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import type { FileEntry, IndexLoaderData } from 'lib/types'
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
=======
|
||||||
|
import type { FileEntry, IndexLoaderData } from 'lib/types'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
import { ActionButton } from './ActionButton'
|
import { ActionButton } from './ActionButton'
|
||||||
import Tooltip from './Tooltip'
|
import Tooltip from './Tooltip'
|
||||||
@ -476,10 +483,16 @@ export const FileTreeInner = ({
|
|||||||
}, [documentHasFocus])
|
}, [documentHasFocus])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<<<<<<< HEAD
|
||||||
<div
|
<div
|
||||||
className="overflow-auto pb-12 absolute inset-0"
|
className="overflow-auto pb-12 absolute inset-0"
|
||||||
data-testid="file-pane-scroll-container"
|
data-testid="file-pane-scroll-container"
|
||||||
>
|
>
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
<div className="overflow-auto max-h-full pb-12">
|
||||||
|
=======
|
||||||
|
<div className="overflow-auto pb-12 absolute inset-0">
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
<ul
|
<ul
|
||||||
className="m-0 p-0 text-sm"
|
className="m-0 p-0 text-sm"
|
||||||
onClickCapture={(e) => {
|
onClickCapture={(e) => {
|
||||||
|
@ -3,8 +3,16 @@ import Tooltip from './Tooltip'
|
|||||||
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
||||||
import { CustomIcon } from './CustomIcon'
|
import { CustomIcon } from './CustomIcon'
|
||||||
import { useLocation, useNavigate } from 'react-router-dom'
|
import { useLocation, useNavigate } from 'react-router-dom'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
import { createAndOpenNewProject } from 'lib/desktopFS'
|
import { createAndOpenNewProject } from 'lib/desktopFS'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { createAndOpenNewProject } from 'lib/tauriFS'
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
=======
|
||||||
|
import { createAndOpenNewProject } from 'lib/tauriFS'
|
||||||
|
import { PATHS } from 'lib/paths'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
|
||||||
import { useLspContext } from './LspProvider'
|
import { useLspContext } from './LspProvider'
|
||||||
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
import { openExternalBrowserIfDesktop } from 'lib/openWindow'
|
||||||
|
@ -93,7 +93,15 @@ export function LowerRightControls({
|
|||||||
<Link
|
<Link
|
||||||
to={
|
to={
|
||||||
location.pathname.includes(PATHS.FILE)
|
location.pathname.includes(PATHS.FILE)
|
||||||
|
<<<<<<< HEAD
|
||||||
? filePath + PATHS.SETTINGS + '?tab=project'
|
? filePath + PATHS.SETTINGS + '?tab=project'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
location.pathname.includes(paths.FILE)
|
||||||
|
? filePath + paths.SETTINGS + '?tab=project'
|
||||||
|
: paths.HOME + paths.SETTINGS
|
||||||
|
=======
|
||||||
|
? filePath + PATHS.SETTINGS_PROJECT
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
: PATHS.HOME + PATHS.SETTINGS
|
: PATHS.HOME + PATHS.SETTINGS
|
||||||
}
|
}
|
||||||
data-testid="settings-link"
|
data-testid="settings-link"
|
||||||
|
@ -15,7 +15,14 @@ import { Extension } from '@codemirror/state'
|
|||||||
import { LanguageSupport } from '@codemirror/language'
|
import { LanguageSupport } from '@codemirror/language'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { FileEntry } from 'lib/project'
|
import { FileEntry } from 'lib/project'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
import { FileEntry } from 'lib/types'
|
||||||
|
=======
|
||||||
|
import { FileEntry } from 'lib/types'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import Worker from 'editor/plugins/lsp/worker.ts?worker'
|
import Worker from 'editor/plugins/lsp/worker.ts?worker'
|
||||||
import {
|
import {
|
||||||
KclWorkerOptions,
|
KclWorkerOptions,
|
||||||
|
@ -2,7 +2,14 @@ import { Popover, Transition } from '@headlessui/react'
|
|||||||
import { ActionButton, ActionButtonProps } from './ActionButton'
|
import { ActionButton, ActionButtonProps } from './ActionButton'
|
||||||
import { type IndexLoaderData } from 'lib/types'
|
import { type IndexLoaderData } from 'lib/types'
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { isDesktop } from '../lib/isDesktop'
|
import { isDesktop } from '../lib/isDesktop'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
import { isTauri } from '../lib/isTauri'
|
||||||
|
=======
|
||||||
|
import { isTauri } from '../lib/isTauri'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||||
import { Fragment, useMemo } from 'react'
|
import { Fragment, useMemo } from 'react'
|
||||||
import { Logo } from './Logo'
|
import { Logo } from './Logo'
|
||||||
|
@ -15,8 +15,16 @@ import { SettingsFieldInput } from './SettingsFieldInput'
|
|||||||
import { getInitialDefaultDir } from 'lib/desktop'
|
import { getInitialDefaultDir } from 'lib/desktop'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import { APP_VERSION } from 'routes/Settings'
|
import { APP_VERSION } from 'routes/Settings'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
import { createAndOpenNewProject, getSettingsFolderPaths } from 'lib/desktopFS'
|
import { createAndOpenNewProject, getSettingsFolderPaths } from 'lib/desktopFS'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { createAndOpenNewProject, getSettingsFolderPaths } from 'lib/tauriFS'
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
=======
|
||||||
|
import { createAndOpenNewProject, getSettingsFolderPaths } from 'lib/tauriFS'
|
||||||
|
import { PATHS } from 'lib/paths'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { useDotDotSlash } from 'hooks/useDotDotSlash'
|
import { useDotDotSlash } from 'hooks/useDotDotSlash'
|
||||||
import { ForwardedRef, forwardRef, useEffect } from 'react'
|
import { ForwardedRef, forwardRef, useEffect } from 'react'
|
||||||
import { useLspContext } from 'components/LspProvider'
|
import { useLspContext } from 'components/LspProvider'
|
||||||
@ -45,12 +53,20 @@ export const AllSettingsFields = forwardRef(
|
|||||||
location.pathname
|
location.pathname
|
||||||
.replace(PATHS.FILE + '/', '')
|
.replace(PATHS.FILE + '/', '')
|
||||||
.replace(PATHS.SETTINGS, '')
|
.replace(PATHS.SETTINGS, '')
|
||||||
|
<<<<<<< HEAD
|
||||||
.slice(
|
.slice(
|
||||||
0,
|
0,
|
||||||
decodeURI(location.pathname).lastIndexOf(
|
decodeURI(location.pathname).lastIndexOf(
|
||||||
window.electron.path.sep
|
window.electron.path.sep
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
.replace(paths.FILE + '/', '')
|
||||||
|
.replace(paths.SETTINGS, '')
|
||||||
|
.slice(0, decodeURI(location.pathname).lastIndexOf(sep()))
|
||||||
|
=======
|
||||||
|
.slice(0, decodeURI(location.pathname).lastIndexOf(sep()))
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
)
|
)
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
import { useMachine } from '@xstate/react'
|
import { useMachine } from '@xstate/react'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { useNavigate, useRouteLoaderData, useLocation } from 'react-router-dom'
|
import { useNavigate, useRouteLoaderData, useLocation } from 'react-router-dom'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||||
|
import { paths } from 'lib/paths'
|
||||||
|
=======
|
||||||
|
import { useNavigate, useRouteLoaderData } from 'react-router-dom'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { PATHS } from 'lib/paths'
|
import { PATHS } from 'lib/paths'
|
||||||
import { authMachine, TOKEN_PERSIST_KEY } from '../machines/authMachine'
|
import { authMachine, TOKEN_PERSIST_KEY } from '../machines/authMachine'
|
||||||
import withBaseUrl from '../lib/withBaseURL'
|
import withBaseUrl from '../lib/withBaseURL'
|
||||||
@ -302,7 +309,14 @@ export const SettingsAuthProviderBase = ({
|
|||||||
logout()
|
logout()
|
||||||
},
|
},
|
||||||
goToIndexPage: () => {
|
goToIndexPage: () => {
|
||||||
|
<<<<<<< HEAD
|
||||||
if (location.pathname.includes(PATHS.SIGN_IN)) {
|
if (location.pathname.includes(PATHS.SIGN_IN)) {
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
if (window.location.pathname.includes(paths.SIGN_IN)) {
|
||||||
|
navigate(paths.INDEX)
|
||||||
|
=======
|
||||||
|
if (window.location.pathname.includes(PATHS.SIGN_IN)) {
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
navigate(PATHS.INDEX)
|
navigate(PATHS.INDEX)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -256,6 +256,14 @@ const runFilletTest = async (
|
|||||||
return new Error('Path to extrude node not found')
|
return new Error('Path to extrude node not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// const radius = createLiteral(5) as Value
|
||||||
|
|
||||||
|
=======
|
||||||
|
// const radius = createLiteral(5) as Expr
|
||||||
|
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
const result = addFillet(ast, pathToSegmentNode, pathToExtrudeNode, radius)
|
const result = addFillet(ast, pathToSegmentNode, pathToExtrudeNode, radius)
|
||||||
if (err(result)) {
|
if (err(result)) {
|
||||||
return result
|
return result
|
||||||
|
@ -4,7 +4,12 @@ import {
|
|||||||
ObjectExpression,
|
ObjectExpression,
|
||||||
PathToNode,
|
PathToNode,
|
||||||
Program,
|
Program,
|
||||||
|
<<<<<<< HEAD
|
||||||
ProgramMemory,
|
ProgramMemory,
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
Value,
|
||||||
|
=======
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
Expr,
|
Expr,
|
||||||
VariableDeclaration,
|
VariableDeclaration,
|
||||||
VariableDeclarator,
|
VariableDeclarator,
|
||||||
@ -159,7 +164,15 @@ export function addFillet(
|
|||||||
ast: Program,
|
ast: Program,
|
||||||
pathToSegmentNode: PathToNode,
|
pathToSegmentNode: PathToNode,
|
||||||
pathToExtrudeNode: PathToNode,
|
pathToExtrudeNode: PathToNode,
|
||||||
|
<<<<<<< HEAD
|
||||||
radius: Expr = createLiteral(5)
|
radius: Expr = createLiteral(5)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
radius = createLiteral(5) as Value
|
||||||
|
// shouldPipe = false, // TODO: Implement this feature
|
||||||
|
=======
|
||||||
|
radius = createLiteral(5) as Expr
|
||||||
|
// shouldPipe = false, // TODO: Implement this feature
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
): { modifiedAst: Program; pathToFilletNode: PathToNode } | Error {
|
): { modifiedAst: Program; pathToFilletNode: PathToNode } | Error {
|
||||||
// Clone AST to ensure safe mutations
|
// Clone AST to ensure safe mutations
|
||||||
const astClone = structuredClone(ast)
|
const astClone = structuredClone(ast)
|
||||||
|
@ -25,6 +25,7 @@ type OnboardingPaths = {
|
|||||||
|
|
||||||
const SETTINGS = '/settings' as const
|
const SETTINGS = '/settings' as const
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
export type ProjectRoute = {
|
export type ProjectRoute = {
|
||||||
projectName: string | null
|
projectName: string | null
|
||||||
projectPath: string
|
projectPath: string
|
||||||
@ -32,6 +33,10 @@ export type ProjectRoute = {
|
|||||||
currentFilePath: string | null
|
currentFilePath: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
export const paths = {
|
||||||
|
=======
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
export const PATHS = {
|
export const PATHS = {
|
||||||
INDEX: '/',
|
INDEX: '/',
|
||||||
HOME: '/home',
|
HOME: '/home',
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
import { ActionFunction, LoaderFunction, redirect } from 'react-router-dom'
|
import { ActionFunction, LoaderFunction, redirect } from 'react-router-dom'
|
||||||
import { FileLoaderData, HomeLoaderData, IndexLoaderData } from './types'
|
import { FileLoaderData, HomeLoaderData, IndexLoaderData } from './types'
|
||||||
|
<<<<<<< HEAD
|
||||||
import { getProjectMetaByRouteId, PATHS } from './paths'
|
import { getProjectMetaByRouteId, PATHS } from './paths'
|
||||||
import { isDesktop } from './isDesktop'
|
import { isDesktop } from './isDesktop'
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { isTauri } from './isTauri'
|
||||||
|
import { getProjectMetaByRouteId, paths } from './paths'
|
||||||
|
=======
|
||||||
|
import { isTauri } from './isTauri'
|
||||||
|
import { getProjectMetaByRouteId, PATHS } from './paths'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { BROWSER_PATH } from 'lib/paths'
|
import { BROWSER_PATH } from 'lib/paths'
|
||||||
import {
|
import {
|
||||||
BROWSER_FILE_NAME,
|
BROWSER_FILE_NAME,
|
||||||
@ -10,6 +18,15 @@ import {
|
|||||||
} from 'lib/constants'
|
} from 'lib/constants'
|
||||||
import { loadAndValidateSettings } from './settings/settingsUtils'
|
import { loadAndValidateSettings } from './settings/settingsUtils'
|
||||||
import makeUrlPathRelative from './makeUrlPathRelative'
|
import makeUrlPathRelative from './makeUrlPathRelative'
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
import { sep } from '@tauri-apps/api/path'
|
||||||
|
import { readTextFile } from '@tauri-apps/plugin-fs'
|
||||||
|
import { codeManager, kclManager } from 'lib/singletons'
|
||||||
|
=======
|
||||||
|
import { sep } from '@tauri-apps/api/path'
|
||||||
|
import { readTextFile } from '@tauri-apps/plugin-fs'
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
import { codeManager } from 'lib/singletons'
|
import { codeManager } from 'lib/singletons'
|
||||||
import { fileSystemManager } from 'lang/std/fileSystemManager'
|
import { fileSystemManager } from 'lang/std/fileSystemManager'
|
||||||
import {
|
import {
|
||||||
@ -86,6 +103,7 @@ export const fileLoader: LoaderFunction = async (
|
|||||||
const { projectName, projectPath, currentFileName, currentFilePath } =
|
const { projectName, projectPath, currentFileName, currentFilePath } =
|
||||||
projectPathData
|
projectPathData
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const urlObj = new URL(routerData.request.url)
|
const urlObj = new URL(routerData.request.url)
|
||||||
let code = ''
|
let code = ''
|
||||||
|
|
||||||
@ -120,8 +138,50 @@ export const fileLoader: LoaderFunction = async (
|
|||||||
// the file system and not the editor.
|
// the file system and not the editor.
|
||||||
codeManager.updateCurrentFilePath(currentFilePath)
|
codeManager.updateCurrentFilePath(currentFilePath)
|
||||||
codeManager.updateCodeStateEditor(code)
|
codeManager.updateCodeStateEditor(code)
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
if (!current_file_name || !current_file_path || !project_name) {
|
||||||
|
return redirect(
|
||||||
|
`${paths.FILE}/${encodeURIComponent(
|
||||||
|
`${params.id}${isTauri() ? sep() : '/'}${PROJECT_ENTRYPOINT}`
|
||||||
|
)}`
|
||||||
|
)
|
||||||
|
=======
|
||||||
|
if (!current_file_name || !current_file_path || !project_name) {
|
||||||
|
return redirect(
|
||||||
|
`${PATHS.FILE}/${encodeURIComponent(
|
||||||
|
`${params.id}${isTauri() ? sep() : '/'}${PROJECT_ENTRYPOINT}`
|
||||||
|
)}`
|
||||||
|
)
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
// TODO: PROJECT_ENTRYPOINT is hardcoded
|
||||||
|
// until we support setting a project's entrypoint file
|
||||||
|
const code = await readTextFile(current_file_path)
|
||||||
|
|
||||||
|
// Update both the state and the editor's code.
|
||||||
|
// We explicitly do not write to the file here since we are loading from
|
||||||
|
// the file system and not the editor.
|
||||||
|
codeManager.updateCurrentFilePath(current_file_path)
|
||||||
|
codeManager.updateCodeStateEditor(code)
|
||||||
|
|
||||||
|
// We don't want to call await on execute code since we don't want to block the UI
|
||||||
|
kclManager.executeCode(true)
|
||||||
|
|
||||||
|
=======
|
||||||
|
// TODO: PROJECT_ENTRYPOINT is hardcoded
|
||||||
|
// until we support setting a project's entrypoint file
|
||||||
|
const code = await readTextFile(current_file_path)
|
||||||
|
|
||||||
|
// Update both the state and the editor's code.
|
||||||
|
// We explicitly do not write to the file here since we are loading from
|
||||||
|
// the file system and not the editor.
|
||||||
|
codeManager.updateCurrentFilePath(current_file_path)
|
||||||
|
codeManager.updateCodeStateEditor(code)
|
||||||
|
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
// Set the file system manager to the project path
|
// Set the file system manager to the project path
|
||||||
// So that WASM gets an updated path for operations
|
// So that WASM gets an updated path for operations
|
||||||
fileSystemManager.dir = projectPath
|
fileSystemManager.dir = projectPath
|
||||||
@ -181,7 +241,14 @@ export const fileLoader: LoaderFunction = async (
|
|||||||
export const homeLoader: LoaderFunction = async (): Promise<
|
export const homeLoader: LoaderFunction = async (): Promise<
|
||||||
HomeLoaderData | Response
|
HomeLoaderData | Response
|
||||||
> => {
|
> => {
|
||||||
|
<<<<<<< HEAD
|
||||||
if (!isDesktop()) {
|
if (!isDesktop()) {
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
if (!isTauri()) {
|
||||||
|
return redirect(paths.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
||||||
|
=======
|
||||||
|
if (!isTauri()) {
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
return redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
return redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
||||||
}
|
}
|
||||||
const { configuration } = await loadAndValidateSettings()
|
const { configuration } = await loadAndValidateSettings()
|
||||||
|
@ -42,7 +42,12 @@ import { Project } from 'lib/project'
|
|||||||
// This route only opens in the desktop context for now,
|
// This route only opens in the desktop context for now,
|
||||||
// as defined in Router.tsx, so we can use the desktop APIs and types.
|
// as defined in Router.tsx, so we can use the desktop APIs and types.
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
|
<<<<<<< HEAD
|
||||||
const { projects: loadedProjects } = useLoaderData() as HomeLoaderData
|
const { projects: loadedProjects } = useLoaderData() as HomeLoaderData
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
useRefreshSettings(paths.HOME + 'SETTINGS')
|
||||||
|
=======
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
useRefreshSettings(PATHS.HOME + 'SETTINGS')
|
useRefreshSettings(PATHS.HOME + 'SETTINGS')
|
||||||
const { commandBarSend } = useCommandsContext()
|
const { commandBarSend } = useCommandsContext()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -60,7 +65,14 @@ const Home = () => {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
|
<<<<<<< HEAD
|
||||||
isDesktop() ? 'mod+,' : 'shift+mod+,',
|
isDesktop() ? 'mod+,' : 'shift+mod+,',
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
isTauri() ? 'mod+,' : 'shift+mod+,',
|
||||||
|
() => navigate(paths.HOME + paths.SETTINGS),
|
||||||
|
=======
|
||||||
|
isTauri() ? 'mod+,' : 'shift+mod+,',
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
() => navigate(PATHS.HOME + PATHS.SETTINGS),
|
() => navigate(PATHS.HOME + PATHS.SETTINGS),
|
||||||
{
|
{
|
||||||
splitKey: '|',
|
splitKey: '|',
|
||||||
@ -280,8 +292,14 @@ const Home = () => {
|
|||||||
<p className="my-4 text-sm text-chalkboard-80 dark:text-chalkboard-30">
|
<p className="my-4 text-sm text-chalkboard-80 dark:text-chalkboard-30">
|
||||||
Loaded from{' '}
|
Loaded from{' '}
|
||||||
<Link
|
<Link
|
||||||
|
<<<<<<< HEAD
|
||||||
data-testid="project-directory-settings-link"
|
data-testid="project-directory-settings-link"
|
||||||
to={`${PATHS.HOME + PATHS.SETTINGS_USER}#projectDirectory`}
|
to={`${PATHS.HOME + PATHS.SETTINGS_USER}#projectDirectory`}
|
||||||
|
||||||| parent of 1f27643b (Merge main)
|
||||||
|
to="settings?tab=user#projectDirectory"
|
||||||
|
=======
|
||||||
|
to={`${PATHS.SETTINGS_USER}#projectDirectory`}
|
||||||
|
>>>>>>> 1f27643b (Merge main)
|
||||||
className="text-chalkboard-90 dark:text-chalkboard-20 underline underline-offset-2"
|
className="text-chalkboard-90 dark:text-chalkboard-20 underline underline-offset-2"
|
||||||
>
|
>
|
||||||
{settings.app.projectDirectory.current}
|
{settings.app.projectDirectory.current}
|
||||||
|
Reference in New Issue
Block a user