From 5ab91d269061c859ed9972b4fa454ed175273e16 Mon Sep 17 00:00:00 2001 From: Mayne Date: Mon, 21 Oct 2024 10:40:31 +0800 Subject: [PATCH] Improve UX (#179) * fix: more tips for activation * fix: improve UX of renaming a node * chore: update shadcn/ui * feat: new sidebar * fix: constrain DocListView height to prevent page shift * fix(desktop): static file hosting * fix(desktop): correct display of created-by and updated-by fields * fix: sidebar layout * fix: improve week calculation for local time in getDaysByYearWeek * Update to version 0.7.9 * fix(pwa): layout * feat(desktop): open folder * feat: shortcut for settings * fix: tailwind override * feat(table): add maximize button to redirect to full page view * feat(table): range cell --- .npmrc | 1 + apps/desktop/[database]/layout.tsx | 37 +- apps/desktop/layout.tsx | 10 +- .../desktop/settings/storage/storage-form.tsx | 11 + apps/publish/layout.tsx | 5 +- apps/web-app/[database]/base-layout.tsx | 41 +- apps/web-app/[database]/base-pwa-layout.tsx | 116 +-- apps/web-app/layout.tsx | 5 +- components.json | 20 + components/keyboard-shortcuts/const.ts | 4 + components/landing/activation.tsx | 101 +-- components/landing/index.tsx | 2 +- components/nav/index.tsx | 52 +- components/shortcuts.tsx | 7 +- components/sidebar/index.tsx | 203 ++--- components/sidebar/tree/node-menu.tsx | 14 +- components/table/index.tsx | 4 +- components/table/view-toolbar.tsx | 17 +- components/table/views/grid/cells/index.ts | 2 + .../table/views/grid/cells/range-cell.tsx | 163 ++++ .../grid/fields/field-property-editor.tsx | 2 + .../number/number-property-editor.tsx | 258 ++++++ components/table/views/grid/index.tsx | 7 +- components/ui/button.tsx | 15 +- components/ui/input.tsx | 2 +- components/ui/separator.tsx | 2 - components/ui/sheet.tsx | 135 +--- components/ui/sidebar.tsx | 762 ++++++++++++++++++ components/ui/sub-page-dialog.tsx | 145 ++++ components/ui/tooltip.tsx | 2 - electron/electron-env.d.ts | 1 + electron/file-system/space.ts | 9 +- electron/main.ts | 22 +- electron/preload.ts | 1 + electron/server/server.ts | 17 +- hooks/use-mobile.tsx | 19 + lib/env.ts | 2 +- lib/fields/number.ts | 50 +- lib/fields/select.ts | 5 + lib/rpc.ts | 2 + lib/store/app-store.ts | 26 +- lib/utils.ts | 27 +- package.json | 3 +- styles/globals.css | 105 ++- tailwind.config.js | 80 +- vite.config.ts | 10 +- 46 files changed, 1983 insertions(+), 541 deletions(-) create mode 100644 components.json create mode 100644 components/table/views/grid/cells/range-cell.tsx create mode 100644 components/table/views/grid/fields/property/number/number-property-editor.tsx create mode 100644 components/ui/sidebar.tsx create mode 100644 components/ui/sub-page-dialog.tsx create mode 100644 hooks/use-mobile.tsx diff --git a/.npmrc b/.npmrc index 15d87e48..a35a2d83 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ engine-strict=true # electron_mirror=https://npmmirror.com/mirrors/electron/ +ignore-workspace-root-check=true \ No newline at end of file diff --git a/apps/desktop/[database]/layout.tsx b/apps/desktop/[database]/layout.tsx index 459bd2ca..1a8a8575 100644 --- a/apps/desktop/[database]/layout.tsx +++ b/apps/desktop/[database]/layout.tsx @@ -6,7 +6,6 @@ import { EidosDataEventChannelName } from "@/lib/const" import { useAppStore } from "@/lib/store/app-store" import { useAppRuntimeStore } from "@/lib/store/runtime-store" import { cn } from "@/lib/utils" -import { isMac } from "@/lib/web/helper" import { useActivation } from "@/hooks/use-activation" import { useEidosFileSystemManager } from "@/hooks/use-fs" import { useSqlite } from "@/hooks/use-sqlite" @@ -44,16 +43,10 @@ export function DesktopSpaceLayout() { useLayoutInit() const { efsManager } = useEidosFileSystemManager() - const [sidebarSize, setSidebarSize] = useLocalStorageState( - "sidebarSize", - { - defaultValue: 20, - } - ) const [mainPanelSize, setMainPanelSize] = useLocalStorageState( "mainPanelSize", { - defaultValue: 60, + defaultValue: 80, } ) const [rightPanelSize, setRightPanelSize] = useLocalStorageState( @@ -104,31 +97,11 @@ export function DesktopSpaceLayout() { )} -
+ +
setSidebarSize(size)} - > -
- -
-
- -
@@ -170,7 +143,7 @@ export function DesktopSpaceLayout() { )} -
+
) diff --git a/apps/desktop/layout.tsx b/apps/desktop/layout.tsx index 0d6e07ee..27d3d1bc 100644 --- a/apps/desktop/layout.tsx +++ b/apps/desktop/layout.tsx @@ -3,6 +3,7 @@ import { useEffect } from "react" import { Outlet } from "react-router-dom" import { useWorker } from "@/hooks/use-worker" +import { SidebarProvider } from "@/components/ui/sidebar" import { Toaster } from "@/components/ui/toaster" import { BlockUIDialog } from "@/components/block-ui-dialog" import { CommandDialogDemo } from "@/components/cmdk" @@ -22,16 +23,19 @@ export default function RootLayout() { return ( - <> + {/* Transparent titlebar for dragging */} -
+
{/* APP MODEL, a sidebar and main */}
- +
diff --git a/apps/desktop/settings/storage/storage-form.tsx b/apps/desktop/settings/storage/storage-form.tsx index 134becfb..5408dc83 100644 --- a/apps/desktop/settings/storage/storage-form.tsx +++ b/apps/desktop/settings/storage/storage-form.tsx @@ -51,6 +51,12 @@ export function StorageForm() { } } + const handleOpenDataFolder = () => { + if (dataFolder) { + window.eidos.openFolder(dataFolder) + } + } + async function onSubmit() { const data = form.getValues() @@ -90,6 +96,11 @@ export function StorageForm() { + {dataFolder && ( + + )} The folder where your data will be stored. diff --git a/apps/publish/layout.tsx b/apps/publish/layout.tsx index 55eb85b4..1dc38d39 100644 --- a/apps/publish/layout.tsx +++ b/apps/publish/layout.tsx @@ -1,6 +1,7 @@ import "@/styles/globals.css" import { Outlet } from "react-router-dom" +import { SidebarProvider } from "@/components/ui/sidebar" import { Toaster } from "@/components/ui/toaster" import { BlockUIDialog } from "@/components/block-ui-dialog" import { ScriptList } from "@/components/cmdk/script" @@ -12,7 +13,7 @@ import { ThemeUpdater } from "@/components/theme-updater" export default function RootLayout() { return ( - <> + {/* APP MODEL, a sidebar and main */}
@@ -22,7 +23,7 @@ export default function RootLayout() { {/* */} - + diff --git a/apps/web-app/[database]/base-layout.tsx b/apps/web-app/[database]/base-layout.tsx index de39f4fa..de78e653 100644 --- a/apps/web-app/[database]/base-layout.tsx +++ b/apps/web-app/[database]/base-layout.tsx @@ -1,20 +1,19 @@ -import { motion } from "framer-motion" import { Suspense, lazy } from "react" -import { FileManager } from "@/components/file-manager" -import { Loading } from "@/components/loading" -import { ScriptContainer } from "@/components/script-container" -import { SideBar } from "@/components/sidebar" +import { useAppStore } from "@/lib/store/app-store" +import { useAppRuntimeStore } from "@/lib/store/runtime-store" +import { cn } from "@/lib/utils" +import { useEidosFileSystemManager } from "@/hooks/use-fs" +import { useSqlite } from "@/hooks/use-sqlite" import { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from "@/components/ui/resizable" -import { useEidosFileSystemManager } from "@/hooks/use-fs" -import { useSqlite } from "@/hooks/use-sqlite" -import { useAppStore } from "@/lib/store/app-store" -import { useAppRuntimeStore } from "@/lib/store/runtime-store" -import { cn } from "@/lib/utils" +import { FileManager } from "@/components/file-manager" +import { Loading } from "@/components/loading" +import { ScriptContainer } from "@/components/script-container" +import { SideBar } from "@/components/sidebar" import { Nav } from "../../../components/nav" import { useSpaceAppStore } from "./store" @@ -42,10 +41,6 @@ export function DatabaseLayoutBase({
) } - const sidebarVariants = { - open: { x: 0 }, - closed: { x: "-100%", width: 0 }, - } return (
@@ -55,28 +50,18 @@ export function DatabaseLayoutBase({ src={efsManager.getFileUrlByPath(currentPreviewFile.path)} > )} - -
-
+
+ +