mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
connect folder
This commit is contained in:
67
package.json
67
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"
|
||||
}
|
||||
|
||||
@@ -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 (
|
||||
<div className="mb-5 flex flex-col">
|
||||
<button
|
||||
onClick={async () => {
|
||||
const folderPath = await open({
|
||||
multiple: false,
|
||||
directory: true
|
||||
})
|
||||
console.log(folderPath)
|
||||
}}
|
||||
>
|
||||
Connect folder
|
||||
</button>
|
||||
{me?.root?.connectedFolderPath && (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div>Connected folder: {me.root.connectedFolderPath}</div>
|
||||
<button
|
||||
onClick={async () => {
|
||||
const folderPath = await open({
|
||||
multiple: false,
|
||||
directory: true
|
||||
})
|
||||
console.log(folderPath)
|
||||
if (folderPath && me?.root) {
|
||||
me.root.connectedFolderPath = folderPath
|
||||
}
|
||||
}}
|
||||
>
|
||||
Change folder
|
||||
</button>
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (me?.root) {
|
||||
me.root.connectedFolderPath = ""
|
||||
}
|
||||
}}
|
||||
>
|
||||
Disconnect folder
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{!me?.root?.connectedFolderPath && (
|
||||
<button
|
||||
onClick={async () => {
|
||||
const folderPath = await open({
|
||||
multiple: false,
|
||||
directory: true
|
||||
})
|
||||
console.log(folderPath)
|
||||
if (folderPath && me?.root) {
|
||||
me.root.connectedFolderPath = folderPath
|
||||
}
|
||||
}}
|
||||
>
|
||||
Connect folder
|
||||
</button>
|
||||
)}
|
||||
{/* TODO: loads a lot more data than expected */}
|
||||
{/* {JSON.stringify(me?.root?.personalPages)} */}
|
||||
</div>
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user