Files
modeling-app/src/components/ProjectSidebarMenu.tsx

246 lines
8.1 KiB
TypeScript
Raw Normal View History

import { Popover, Transition } from '@headlessui/react'
import { ActionButton, ActionButtonProps } from './ActionButton'
Client sketch scene (#1271) * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happ * better error msg * fix control point issue * basic code gen working for tangentialArc * partical fix for move with arcs * tangential arc move * fix * make eslint rules less annoying * inital refactor of some xstate stuff * more old tangential arc clean up stuff * more tweaks * add testing * tweak xstate inspect * temp remove test * update formating for less conflicts * fix state machine layout after merge * shrug, something weird with xstate typegen * renaming some xstate events * tweak numbers to make CI playwright happ * CI hacks * more CI hacks * more CI hacks * new hack strategy * run tests agian * make cmd bar less flaky * ci hacks * CI hacks * CI hacks * CI hacks * clean up * fix * still have constraint stuff to deal with * progress on move rules * update source ranges after no execute code-mod * typo * mvp working * hide show sketch overlay * match scaling * update arrow head style * animate line tool * bypass xstate for animations, much smoother * add new segment working with refactor needed for setup paper sketch * refactor setup paper sketch * tangantialArcTo drag animations working * tangential arc polish * cargo fmt * clippy * more clippy * mock canvas * last of clippy? * typo * more clippy stuff * move util function so they are shareable with typescript * migrate a bunch to rust and only rust * add arc center point for draft tangential ac * clippy tweak * delete uneeded test * Rough start to scaling arrow heads. The tangent arrow heads are basically nuked and replaced while the straight line sections are just rotated and repositioned, this means they miss out on updating scaling number after a screen size changes. Needs fixing * fix bug with tool tips * fix draft line start position Having drag the end of teh path before selecting a tooltip would result in the draft line starting where the path used to end, stale data * some progress with pan maybe * fmt * inital camera sync working For perspective camera at least * change three.js to use z-up * add grid * orthographic camera working with polish items TODO * fix zoom level when swapping camera * fix up camera/orbit changing on cam change (pan wasn't being respected) * tidy up * use orbit target instead of assuming scene center * dynamic fov working * animate orthographic to perspective and reverse * fix import * temp fix for batch commands * initial client side scene sketch working * remove hover log * FOV adjust fix * fix comment * tear down sketch and small tweaks * some progress with camera tweening * combine dollyZoom engine commands see https://github.com/KittyCAD/modeling-api/compare/kurt-perspective-settings?expand=1 and https://github.com/KittyCAD/engine/compare/kurt-perspective-settings?expand=1 * make tests happy (mocks) * fix tween to vertical/camera-up bug * tween to each axis with hacky solutions in there * fix startSketchOn planes * tidy startSketchOn * tweening okay for now I think * get sketching on default planes working * allow editing on all default planes * clean up enter and exit sketch logic * tidy * tidy * remove more default plane stuff * start of draft line * remove some annoying parts of the paper.js implementation * fix drag than equip line bug * comment * don't animate on skech tear down since it's used for draft line * remove more default plane shit * style draft line * refine dashed line * draft line set up and tear down mostly happy * add on click logic ready for draft lines * sketch mode with drag and draft mode working solidly now, straight segments only * default planes match colors, hover and select still TODO * hover and click logic working for default planes Now just need the code mode to fire to 'startSketchOn(...)' * select default planes * remove some logs * fix update infinite loop * start of orbitControls port to Franks control guards * hiding scenes at different times * scene hide on camera move should be respected by scroll zoom * basic hover working * Hook up user camera settings to ClientSideScene (#1334) * Refactor to not import utilities from Router.tsx * Stop tracking changes or formatting *.typegen.ts * Hook up cameraControls to ClientSideScene * Remove camera controls toggle from temp debug panel --------- Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch> * add select segment moves cursor * highlight segments yellow on hover * cursor ranges effect 2d line colors * fix constrainst i.e. make sure the sketch is rejiged * selecting nothing should remove selections * remove hardcoded strings * update get_tangential_arc_to_info rust util * initial drawing of tangential arcs in client scene * fix tangentialArc arrow head direction * correct userData types for tangential arcs * get tangential arc updates working Doesn't include draging the head of the tangential arc itself yet * spot of clean up * make selections work with tangential arcs * get draft tangential segment animated * fix initial click weirdness for adding new tangential line * couple tweaks * add grace pixels /threshold to raycast * redo arc dashes so that they spawn from the ccenter of the arc * fix multi drag bug * fmt * add temp solution for close * add default axis hover colors, still needs select logic * selection of axis works, just with out selection color * get axis selection colors working * fix outdate source ranges after drag problem * update moreNodePathFromSourceRange * fix ts-rs issue/workaround * fix default plane weirdness * fix tangential arc rounding issue * review clean up part 1 * review clean up part 2 Big state-diagram cull * clippy * typo * clippy * fix xstate types with typegen * fix types * clippy * catch error * fix test import issue Not sure exactly what was happening but guessing circular import that vite didn't like * add axis/plane info to sketch group tests * case changes because of rs-ts bug, can probably revert this later * start of playwright test fixes * reduce geo complexity for straight segments * fix cam adjust tests * Revert "Clean up vite build warnings (#1332)" This reverts commit c1f661ab5254458c3e9fdb396a31860a22c790f1. * selection e2e test fixed< * remove camToggle to allow playwright tests to pass * remove drag test too brittle and needs to be redone from the ground up anyway * trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fix last test * clean up part 3 * clean up part 4 * clean up part 5 * clean up sketch enter exit logic * fix engine side selections * default plane should not be selected form 'onDragEnd' i.e. rotating the camera should not mean the user acidently selects a plane * clean up state diagram around animating to sketch mode Embracing that the animation is async and puting the interdiate steps in the state diagram clean up some logic and solved some bugs at the same time * add test for multiple sketches * typo * make highlight more robust * type tweak * scale segmenst with distance from camera so they have a consistent pixel size/ screenspace size * Jess's advice * tsc and fmt * clean up part 6 remove integer from xstate names * clean up part 7 * integrate sequency in to camera moves * fix tests * update snapshot e2e * small snapshot change * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * trigger ci * Fix HomeLoaderData types * update std stuff * update kittycad rs client lib --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-11 12:59:00 +11:00
import { type IndexLoaderData } from 'lib/types'
import { paths } from 'lib/paths'
import { isTauri } from '../lib/isTauri'
import { Link, useLocation, useNavigate } from 'react-router-dom'
import { Fragment, useMemo } from 'react'
import { sep } from '@tauri-apps/api/path'
import { Logo } from './Logo'
import { APP_NAME } from 'lib/constants'
import { useCommandsContext } from 'hooks/useCommandsContext'
import { CustomIcon } from './CustomIcon'
2024-03-11 17:50:31 -07:00
import { useLspContext } from './LspProvider'
import { engineCommandManager } from 'lib/singletons'
import usePlatform from 'hooks/usePlatform'
import { useAbsoluteFilePath } from 'hooks/useAbsoluteFilePath'
import Tooltip from './Tooltip'
const ProjectSidebarMenu = ({
project,
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
file,
enableMenu = false,
}: {
enableMenu?: boolean
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
project?: IndexLoaderData['project']
file?: IndexLoaderData['file']
}) => {
return (
<div className="!no-underline h-full mr-auto max-h-min min-h-12 min-w-max flex items-center gap-2">
<AppLogoLink project={project} file={file} />
{enableMenu ? (
<ProjectMenuPopover project={project} file={file} />
) : (
<span
className="hidden select-none cursor-default text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block"
data-testid="project-name"
>
{project?.name ? project.name : APP_NAME}
</span>
)}
</div>
)
}
function AppLogoLink({
project,
file,
}: {
project?: IndexLoaderData['project']
file?: IndexLoaderData['file']
}) {
const { onProjectClose } = useLspContext()
const wrapperClassName =
"relative h-full grid place-content-center group p-1.5 before:block before:content-[''] before:absolute before:inset-0 before:bottom-2.5 before:z-[-1] before:bg-primary before:rounded-b-sm"
const logoClassName = 'w-auto h-4 text-chalkboard-10'
return isTauri() ? (
<Link
data-testid="app-logo"
onClick={() => {
onProjectClose(file || null, project?.path || null, false)
// Clear the scene and end the session.
engineCommandManager.endSession()
}}
to={paths.HOME}
className={wrapperClassName + ' hover:before:brightness-110'}
>
<Logo className={logoClassName} />
<span className="sr-only">{APP_NAME}</span>
</Link>
) : (
<div className={wrapperClassName} data-testid="app-logo">
<Logo className={logoClassName} />
<span className="sr-only">{APP_NAME}</span>
</div>
)
}
function ProjectMenuPopover({
project,
file,
}: {
project?: IndexLoaderData['project']
file?: IndexLoaderData['file']
}) {
const platform = usePlatform()
const location = useLocation()
const navigate = useNavigate()
const filePath = useAbsoluteFilePath()
const { commandBarState, commandBarSend } = useCommandsContext()
2024-03-11 17:50:31 -07:00
const { onProjectClose } = useLspContext()
const exportCommandInfo = { name: 'Export', groupId: 'modeling' }
const findCommand = (obj: { name: string; groupId: string }) =>
Boolean(
commandBarState.context.commands.find(
(c) => c.name === obj.name && c.groupId === obj.groupId
)
)
// We filter this memoized list so that no orphan "break" elements are rendered.
const projectMenuItems = useMemo<(ActionButtonProps | 'break')[]>(
() =>
[
{
id: 'settings',
Element: 'button',
children: (
<>
<span className="flex-1">Project settings</span>
<kbd className="hotkey">{`${platform === 'macos' ? '⌘' : 'Ctrl'}${
isTauri() ? '' : '⬆'
},`}</kbd>
</>
),
onClick: () => {
const targetPath = location.pathname.includes(paths.FILE)
? filePath + paths.SETTINGS
: paths.HOME + paths.SETTINGS
navigate(targetPath + '?tab=project')
},
},
'break',
{
id: 'export',
Element: 'button',
children: (
<>
<span>Export current part</span>
{!findCommand(exportCommandInfo) && (
<Tooltip
position="right"
wrapperClassName="!max-w-none min-w-fit"
>
Awaiting engine connection
</Tooltip>
)}
</>
),
disabled: !findCommand(exportCommandInfo),
onClick: () =>
commandBarSend({
type: 'Find and select command',
data: exportCommandInfo,
}),
},
'break',
{
id: 'go-home',
Element: 'button',
children: 'Go to Home',
className: !isTauri() ? 'hidden' : '',
onClick: () => {
onProjectClose(file || null, project?.path || null, true)
// Clear the scene and end the session.
engineCommandManager.endSession()
},
},
].filter(
(props) =>
props === 'break' ||
(typeof props !== 'string' && !props.className?.includes('hidden'))
) as (ActionButtonProps | 'break')[],
[
platform,
findCommand,
commandBarSend,
engineCommandManager,
onProjectClose,
isTauri,
]
)
return (
<Popover className="relative">
<Popover.Button
className="gap-1 rounded-sm h-9 mr-auto max-h-min min-w-max border-0 py-1 px-2 flex items-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary dark:hover:bg-chalkboard-90"
data-testid="project-sidebar-toggle"
>
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
<div className="flex flex-col items-start py-0.5">
<span className="hidden text-sm text-chalkboard-110 dark:text-chalkboard-20 whitespace-nowrap lg:block">
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
{isTauri() && file?.name
Migrate to tauri v2 (#1400) * Fix vite build (tauri build still broken) * Fix yarn builds with a couple of shortcuts * Fix file creation * Fix documentDir behavior * Got stream with default file * Clean up * Clean up * Use 'unstable'; fix devtools callsite The API changed a bit here, which forces us to use the unstable crate feature. The call to open devtools is also new; it's now on the webview not window. Signed-off-by: Paul R. Tagliamonte <paul@kittycad.io> * Bring back read_dir_recursive from v1 * Fix dates * More fixes, incl. conf files * cargo fmt * Add Updater plugin * Fix types * Fix isTauri detection and updater bootup * Schemas * Clean up * Disable devtools * Attempt at fixing builds * WIP Ubuntu dep * WIP Ubuntu dep * WIP keys in debug * Enable updater only on release builds * Reenable webtools on debug * No linux bundles * Typo * Attemp at fixing --bundles none * Manual tauri debug build * Empty commit to trigger the CI * Fix settings * Empty commit to trigger the CI * Merge branch 'main' into pierremtb/issue1349 * Add allow-create perm * tauri-driver no cap * Empty commit to trigger the CI * Clean up * Clean up * Migrate to tauri v2 Fixes #1349 * Fix fmt * Merge branch 'main' into pierremtb/issue1349 * Force BUILD_RELEASE: true * Bump tauri to new beta * Merge branch 'main' into pierremtb/issue1349 * Fix linux tests * Fix types * Add --verbose to tauri-action * Move --verbose to front * Back to tauri-driver@0.1.3 and single \ for win * Back to latest driver, and windows wip * Disable release conf temporarily * Rollback to 2.0.0-beta.2 * Rollback to 2.0.0-beta.1 * Move bundle to root for src-tauri/tauri.release.conf.json * All packages to latest (add http and shell to package.json) * Testing latest commit for tauri-action * Remove tauri action * Add cat * WIP * Update ci.yml * Disable release conf * Disable rust cache * Add tauri-action back for release builds * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Update .codespellrc * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Fix type * Clean up * More clean up * Fix path concatenation with join * Attempt at fixing linux tests * Config clean up * Downgrade to tauri-driver@0.1.3 * Looks like tauri v2 is actually doing better with linux package names ah! * Change Linux apt packages * Increase wdio connectionRetryTimeout * Revert connectionRetryTimeout and bump tauri packages * Back to latest tauri-driver * Disable linux e2e tests * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Trigger CI * Clean up * Update snapshots * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Trigger CI * Remove @sentry/react * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Rename migrated.json to desktop.json * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * Trigger CI * Change wasm url to http on Windows --------- Signed-off-by: Paul R. Tagliamonte <paul@kittycad.io> Co-authored-by: Paul R. Tagliamonte <paul@kittycad.io> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
2024-04-09 08:04:36 -04:00
? file.name.slice(file.name.lastIndexOf(sep()) + 1)
: APP_NAME}
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
</span>
{isTauri() && project?.name && (
<span className="hidden text-xs text-chalkboard-70 dark:text-chalkboard-40 whitespace-nowrap lg:block">
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
{project.name}
</span>
)}
</div>
<CustomIcon
name="caretDown"
className="w-4 h-4 text-chalkboard-70 dark:text-chalkboard-40 ui-open:rotate-180"
/>
</Popover.Button>
<Transition
enter="duration-100 ease-out"
enterFrom="opacity-0 -translate-y-2"
enterTo="opacity-100 translate-y-0"
as={Fragment}
>
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
<Popover.Panel
className={`z-10 absolute top-full left-0 mt-1 pb-1 w-48 bg-chalkboard-10 dark:bg-chalkboard-90
border border-solid border-chalkboard-20 dark:border-chalkboard-90 rounded
shadow-lg`}
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
>
{({ close }) => (
<ul className="relative flex flex-col items-stretch content-stretch p-0.5">
{projectMenuItems.map((props, index) => {
if (props === 'break') {
return index !== projectMenuItems.length - 1 ? (
<li key={`break-${index}`} className="contents">
<hr className="border-chalkboard-20 dark:border-chalkboard-80" />
</li>
) : null
}
const { id, className, children, ...rest } = props
return (
<li key={id} className="contents">
<ActionButton
{...rest}
className={
'relative !font-sans flex items-center gap-2 rounded-sm py-1.5 px-2 cursor-pointer hover:bg-chalkboard-20 dark:hover:bg-chalkboard-80 border-none text-left ' +
className
}
onMouseUp={() => {
close()
}}
>
{children}
</ActionButton>
</li>
)
})}
</ul>
Franknoirot/multi file (#844) * Fix unrelated bug, settings button in the home sidebar doesn't go to the home settings after my previous fixes to routes * Turn on "Replay Onboarding" button in home settings * Add icons * Add Tooltip component * Rough-in of sidebar styling and add initial File Tree * Polish basic styling * Show nested files and directories * Add tests * use camelCase for entrypointMetadata * Add ability to switch files via links * Revert "Improve Prop Typings for Modals. Remove instances of `any`. (… (#813) Revert "Improve Prop Typings for Modals. Remove instances of `any`. (#792)" This reverts commit 629f326f4cdf13d83a62f471b4b9a40d3c3a2a88. * ffmpeg instructions (#814) * Formatting * Remove folder names from display in app header * Highlight current file, open folders it's within * Navigate on double click, delete on Cmd + Esc + highlight focused folders * Migrate to an XState machine, add create new file * Add ability to create folders (with naive names) + remove command bar stuff for now * Use route loader data to instantiate the kcl code * Clean up some unused things * Add ability to rename files * Add ability to rename folders * Add keyboard shortcuts for creating files/folders * Tooltip style tweaks * Polish + re-execute when switching files with a connection * Reset code before navigating via file tree * Don't invoke `readProject` if you're in a browser * Show files and folders for projects on home page * Don't highlight folders further down the file tree * @jgomez720 and @jessfraz feedback: + indentation markers + proper file icon + bump down font size + touch up colors * Tune down spacing, allow scroll overflow * Fix formatting * Update src/lib/tauriFS.ts * Add a confirmation dialog when deleting Signed-off-by: Frank Noirot <frank@kittycad.io> --------- Signed-off-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
2023-10-16 13:28:41 -04:00
)}
</Popover.Panel>
</Transition>
</Popover>
)
}
export default ProjectSidebarMenu