Polish: UI theme colors, onboarding dismiss, Export button in sidebar (#270)

* Light mode style fixes

* Fix dismissing onboarding for nested routes

* Refactor: move export button to  user side panel

* Refactor: add project data to modeling page loader

* Add new ProjectSidebarMenu

* Convert AppHeader to use ProjectSidebarMenu

* Move ExportButton to ProjectSidebarMenu

* Fix: hide default dir setting in Web

* Add DownloadAppBanner when in Prod

* Add unit tests to ProjectSidebarMenu

* Tiny CSS rounding tweak to sidebars

* Fix formatting in unit tests

* Update icons and logos to use full-color Kitt

* Fix: dim UI on camera drag, not click
This commit is contained in:
Frank Noirot
2023-08-18 10:27:01 -04:00
committed by GitHub
parent ff08c30ddc
commit aa24b9d6bd
40 changed files with 496 additions and 221 deletions

View File

@ -0,0 +1,82 @@
import { fireEvent, render, screen } from '@testing-library/react'
import { User } from '../useStore'
import { BrowserRouter } from 'react-router-dom'
import ProjectSidebarMenu from './ProjectSidebarMenu'
import { ProjectWithEntryPointMetadata } from '../Router'
const now = new Date()
const projectWellFormed = {
name: 'Simple Box',
path: '/some/path/Simple Box',
children: [
{
name: 'main.kcl',
path: '/some/path/Simple Box/main.kcl',
},
],
entrypoint_metadata: {
accessedAt: now,
blksize: 32,
blocks: 32,
createdAt: now,
dev: 1,
gid: 1,
ino: 1,
isDir: false,
isFile: true,
isSymlink: false,
mode: 1,
modifiedAt: now,
nlink: 1,
permissions: { readonly: false, mode: 1 },
rdev: 1,
size: 32,
uid: 1,
},
} satisfies ProjectWithEntryPointMetadata
describe('ProjectSidebarMenu tests', () => {
test('Renders the project name', () => {
render(
<BrowserRouter>
<ProjectSidebarMenu project={projectWellFormed} />
</BrowserRouter>
)
fireEvent.click(screen.getByTestId('project-sidebar-toggle'))
expect(screen.getByTestId('projectName')).toHaveTextContent(
projectWellFormed.name
)
expect(screen.getByTestId('createdAt')).toHaveTextContent(
`Created ${now.toLocaleDateString()}`
)
})
test('Renders app name if given no project', () => {
render(
<BrowserRouter>
<ProjectSidebarMenu />
</BrowserRouter>
)
fireEvent.click(screen.getByTestId('project-sidebar-toggle'))
expect(screen.getByTestId('projectName')).toHaveTextContent(
'KittyCAD Modeling App'
)
})
test('Renders as a link if set to do so', () => {
render(
<BrowserRouter>
<ProjectSidebarMenu project={projectWellFormed} renderAsLink={true} />
</BrowserRouter>
)
expect(screen.getByTestId('project-sidebar-link')).toBeInTheDocument()
expect(screen.getByTestId('project-sidebar-link-name')).toHaveTextContent(
projectWellFormed.name
)
})
})