Home page in desktop, separate file support (#252)

* Bugfix: don't toast on every change of defaultDir

* Refactor app to live under /file/:id

* Stub out Tauri-only home page

* home reads and writes blank files to defaultDir

* Fix initial directory creation

* Make file names editable

* Refactor onboarding to use normal fns for load issues

* Feature: load and write files to and from disk

* Feature: Add file deletion, break out FileCard component

* Fix settings close URLs to be relative, button types

* Add filename and link to AppHeader

* Style tweaks: scrollbar, header name, card size

* Style: add header, empty state to Home

* Refactor: load file in route loader

* Move makePathRelative to lib to fix tests

* Fix App test

* Use '$nnn' default name scheme

* Fix type error on ActionButton

* Fix type error on ActionButton

* @adamchalmers review

* Fix merge mistake

* Refactor: rename all things "file" to "project"

* Feature: migrate to <project-name>/main.kcl setup

* Fix tsc test

* @Irev-Dev review part 1: renames and imports

* @Irev-Dev review pt 2: simplify file list refresh

* @Irev-Dev review pt 3: filter out non-projects

* @Irev-review pt 4: folder conventions + home auth

* Add sort functionality to new welcome page (#255)

* Add todo for Sentry
This commit is contained in:
Frank Noirot
2023-08-15 21:56:24 -04:00
committed by GitHub
parent 826ad267b4
commit 19761baba6
29 changed files with 1003 additions and 157 deletions

View File

@ -3,14 +3,17 @@ import { Toolbar } from '../Toolbar'
import { useStore } from '../useStore'
import UserSidebarMenu from './UserSidebarMenu'
import { paths } from '../Router'
import { isTauri } from '../lib/isTauri'
interface AppHeaderProps extends React.PropsWithChildren {
showToolbar?: boolean
filename?: string
className?: string
}
export const AppHeader = ({
showToolbar = true,
filename = '',
children,
className = '',
}: AppHeaderProps) => {
@ -25,13 +28,18 @@ export const AppHeader = ({
className
}
>
<Link to={paths.INDEX}>
<Link
to={isTauri() ? paths.HOME : paths.INDEX}
className="flex items-center gap-4"
>
<img
src="/kitt-arcade-winking.svg"
alt="KittyCAD App"
className="h-9 w-auto"
/>
<span className="sr-only">KittyCAD App</span>
<span className="text-sm text-chalkboard-110 dark:text-chalkboard-20 min-w-max">
{isTauri() && filename ? filename : 'KittyCAD Modeling App'}
</span>
</Link>
{/* Toolbar if the context deems it */}
{showToolbar && (