From 217f4f15e3e4596476ab813c6a46928bff9ec139 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 5 Sep 2024 11:40:26 +0300 Subject: [PATCH] connect folder --- package.json | 67 +++++++++++----------- web/components/routes/tauri/TauriRoute.tsx | 61 +++++++++++++++----- web/lib/schema/index.ts | 5 ++ 3 files changed, 87 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index e7ff055a..d275fe78 100644 --- a/package.json +++ b/package.json @@ -1,35 +1,36 @@ { - "name": "learn-anything", - "scripts": { - "dev": "bun web", - "web": "cd web && bun dev", - "web:build": "bun run --filter '*' build", - "cli": "bun run --watch cli/run.ts", - "seed": "bun --watch cli/seed.ts", - "tauri": "tauri" - }, - "workspaces": [ - "web" - ], - "dependencies": { - "@tauri-apps/cli": "^2.0.0-rc.6", - "@tauri-apps/plugin-dialog": "^2.0.0-rc", - "@tauri-apps/plugin-fs": "^2.0.0-rc.2", - "jazz-nodejs": "^0.7.34", - "react-icons": "^5.3.0" - }, - "devDependencies": { - "bun-types": "^1.1.26" - }, - "prettier": { - "plugins": [ - "prettier-plugin-tailwindcss" - ], - "useTabs": true, - "semi": false, - "trailingComma": "none", - "printWidth": 120, - "arrowParens": "avoid" - }, - "license": "MIT" + "name": "learn-anything", + "scripts": { + "dev": "bun web", + "web": "cd web && bun dev", + "web:build": "bun run --filter '*' build", + "app": "tauri dev", + "cli": "bun run --watch cli/run.ts", + "seed": "bun --watch cli/seed.ts", + "tauri": "tauri" + }, + "workspaces": [ + "web" + ], + "dependencies": { + "@tauri-apps/cli": "^2.0.0-rc.6", + "@tauri-apps/plugin-dialog": "^2.0.0-rc", + "@tauri-apps/plugin-fs": "^2.0.0-rc.2", + "jazz-nodejs": "^0.7.34", + "react-icons": "^5.3.0" + }, + "devDependencies": { + "bun-types": "^1.1.26" + }, + "prettier": { + "plugins": [ + "prettier-plugin-tailwindcss" + ], + "useTabs": true, + "semi": false, + "trailingComma": "none", + "printWidth": 120, + "arrowParens": "avoid" + }, + "license": "MIT" } diff --git a/web/components/routes/tauri/TauriRoute.tsx b/web/components/routes/tauri/TauriRoute.tsx index 489b52f8..e35f3ad9 100644 --- a/web/components/routes/tauri/TauriRoute.tsx +++ b/web/components/routes/tauri/TauriRoute.tsx @@ -4,23 +4,58 @@ import { useAccount } from "@/lib/providers/jazz-provider" import { open } from "@tauri-apps/plugin-dialog" export default function TauriRoute() { - const { me } = useAccount() - + const { me } = useAccount({ + root: {} + }) // console.log({ pages: me?.root?.personalPages?.toJSON() }) + // TODO: ugly code, just to get folder connecting working return (
- + {me?.root?.connectedFolderPath && ( +
+
Connected folder: {me.root.connectedFolderPath}
+ + +
+ )} + {!me?.root?.connectedFolderPath && ( + + )} {/* TODO: loads a lot more data than expected */} {/* {JSON.stringify(me?.root?.personalPages)} */}
diff --git a/web/lib/schema/index.ts b/web/lib/schema/index.ts index c0a29f54..a25d35f0 100644 --- a/web/lib/schema/index.ts +++ b/web/lib/schema/index.ts @@ -27,6 +27,9 @@ export class UserRoot extends CoMap { topicsWantToLearn = co.ref(ListOfTopics) topicsLearning = co.ref(ListOfTopics) topicsLearned = co.ref(ListOfTopics) + + // TODO: maybe should be in another place? + connectedFolderPath = co.optional.string } export class LaAccount extends Account { @@ -51,6 +54,8 @@ export class LaAccount extends Account { bio: "", is_public: false, + connectedFolderPath: "", + personalLinks: PersonalLinkLists.create([], { owner: this }), personalPages: PersonalPageLists.create([], { owner: this }),