Rework home layout to have a sidebar (#6423)

* chore: saving off skeleton

* fix: saving skeleton

* chore: skeleton for loading projects from project directory path

* chore: cleaning up useless state transition to be an on event direct to action state

* fix: new structure for web vs desktop vs react machine provider code

* chore: saving off skeleton

* fix: skeleton logic for react? going to move it from a string to obj.string

* fix: trying to prevent error element unmount on global react components. This is bricking JS state

* fix: we are so back

* chore: implemented navigating to specfic KCL file

* chore: implementing renaming project

* chore: deleting project

* fix: auto fixes

* fix: old debug/testing file oops

* chore: generic create new file

* chore: skeleton for web create file provide

* chore: basic machine vitest... need to figure out how to get window.electron implemented in vitest?

* chore: save off progress before deleting other project implementation, a few missing features still

* chore: trying a different init skeleton? most likely will migrate

* chore: first attempt of purging projects context provider

* chore: enabling toast for some machine state

* chore: enabling more toast success and error

* chore: writing read write state to the system io based on the project path

* fix: tsc fixes

* fix: use file system watcher, navigate to project after creation via the requestProjectName

* chore: open project command, hooks vs snapshot context helpers

* chore: implemented open and create project for e2e testing. They are hard coded in poor spot for now.

* fix: codespell fixes

* chore: implementing more project commands

* chore: PR improvements for root.tsx

* chore: leaving comment about new Router.tsx layout

* fix: removing debugging code

* fix: rewriting component for readability

* fix: improving web initialization

* chore: implementing import file from url which is not actually that?

* fix: clearing search params on import file from url

* fix: fixed two e2e tests, forgot needsReview when making new command

* fix: fixing some import from url business logic to pass e2e tests

* chore: script for diffing circular deps +/-

* fix: formatting

* fix: massive fix for circular depsga!

* fix: trying to fix some errors and auto fmt

* fix: updating deps

* fix: removing debugging code

* fix: big clean up

* fix: more deletion

* fix: tsc cleanup

* fix: TSC TSC TSC TSC!

* fix: typo fix

* fix: clear query params on web only, desktop not required

* fix: removing unused code

* fmt

* Bring back `trap` removed in merge

* Use explicit types instead of `any`s on arg configs

* Add project commands directly to command palette

* fix: deleting debugging code, from PR review

* fix: this got added back(?)

* fix: using referred type

* fix: more PR clean up

* fix: big block comment for xstate architecture decision

* fix: more pr comment fixes

* fix: saving off logic, need a big cleanup because I hacked it together to get a POC

* fix: extra business?

* fix: merge conflict just added them back why dude

* fix: more PR comments

* fix: big ciruclar deps fix, commandBarActor in appActor

* chore: writing e2e test, still need to fix 3 bugs

* chore: adding more scenarios

* fix: formatting

* fix: fixing tsc errors

* chore: deleting the old text to cad and using the new application level one, almost there

* fix: prompt to edit works

* fix: large push to get 1 text to cad command... the usage is a little buggy with delete and navigate within /file

* fix: settings for highlight edges now works

* chore: adding another e2e test

* fix: cleaning up e2e tests and writing more of them

* fix: tsc type

* chore: more e2e improvements, unique project name  in text to cad

* chore: e2e tests should be good to go

* fix: gotcha comment

* fix: enabled web t2c, codespell fixes

* fix: fixing merge conflcits??

* fix: t2c is back

* Rework home layout to have a sidebar

fmt I think

* Add two links to the bottom of the sidebar

Mostly to visually anchor it

* Tweak some style things

* update test util whose locator needs to change

* tsc and fmt

* Stupid heading change broke the dang E2E tests

* Make that heading locator a part of the home page fixture

* pierremtb/new-snaps-for-frank (#6516)

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

---------

Co-authored-by: Kevin Nadro <kevin@zoo.dev>
Co-authored-by: Kevin Nadro <nadr0@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
This commit is contained in:
Frank Noirot
2025-04-26 11:55:01 -04:00
committed by GitHub
parent 9d893d8f0b
commit 0426967bf7
33 changed files with 318 additions and 188 deletions

View File

@ -786,7 +786,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Stay in home page -> Reject -> should delete single file',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
await mockPageTextToCAD(page)
@ -794,7 +794,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
// Create and navigate to the project then come home
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
await expect(page.getByText('1 file')).toBeVisible()
@ -829,7 +829,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Stay in home page -> Accept -> should navigate to file',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
@ -838,7 +838,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
// Create and navigate to the project then come home
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -880,7 +880,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> New Project -> Navigate to the project -> Reject -> should go to home page',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
await mockPageTextToCAD(page)
@ -919,16 +919,14 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
await page.getByRole('button', { name: 'Reject' }).click()
// Make sure we went back home
await expect(
page.getByText('No Projects found, ready to make your first one?')
).toBeVisible()
await homePage.expectIsCurrentPage()
}
)
test(
'Home Page -> Text To CAD -> New Project -> Navigate to the project -> Accept -> should stay in same file',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
await mockPageTextToCAD(page)
@ -971,7 +969,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Navigate to the project -> Reject -> should load main.kcl',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
@ -980,7 +978,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
// Create and navigate to the project then come home
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -1026,7 +1024,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Navigate to the project -> Accept -> should load 2x2x2-cube.kcl',
{ tag: '@electron' },
async ({ context, page }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const prompt = '2x2x2 cube'
@ -1035,7 +1033,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
// Create and navigate to the project then come home
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -1083,7 +1081,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> New Project -> Navigate to different project -> Reject -> should stay in project',
{ tag: '@electron' },
async ({ context, page, homePage }, testInfo) => {
async ({ homePage, page }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const unrelatedProjectName = 'unrelated-project'
@ -1097,7 +1095,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
returnHome: true,
})
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -1160,7 +1158,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> New Project -> Navigate to different project -> Accept -> should go to new project',
{ tag: '@electron' },
async ({ context, page, homePage }, testInfo) => {
async ({ page, homePage }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const unrelatedProjectName = 'unrelated-project'
@ -1174,7 +1172,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
returnHome: true,
})
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -1233,7 +1231,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Navigate to different project -> Reject -> should stay in same project',
{ tag: '@electron' },
async ({ context, page, homePage }, testInfo) => {
async ({ page, homePage }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const unrelatedProjectName = 'unrelated-project'
@ -1246,10 +1244,10 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
page,
returnHome: true,
})
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()
@ -1308,7 +1306,7 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
test(
'Home Page -> Text To CAD -> Existing Project -> Navigate to different project -> Accept -> should navigate to new project',
{ tag: '@electron' },
async ({ context, page, homePage }, testInfo) => {
async ({ page, homePage }, testInfo) => {
const u = await getUtils(page)
const projectName = 'my-project-name'
const unrelatedProjectName = 'unrelated-project'
@ -1321,10 +1319,10 @@ test.describe('Mocked Text-to-CAD API tests', { tag: ['@skipWin'] }, () => {
page,
returnHome: true,
})
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
await createProject({ name: projectName, page, returnHome: true })
await expect(page.getByText('Your Projects')).toBeVisible()
await homePage.expectIsCurrentPage()
// open commands
await page.getByTestId('command-bar-open-button').click()