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:
+34
-33
@@ -1,35 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "learn-anything",
|
"name": "learn-anything",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun web",
|
"dev": "bun web",
|
||||||
"web": "cd web && bun dev",
|
"web": "cd web && bun dev",
|
||||||
"web:build": "bun run --filter '*' build",
|
"web:build": "bun run --filter '*' build",
|
||||||
"cli": "bun run --watch cli/run.ts",
|
"app": "tauri dev",
|
||||||
"seed": "bun --watch cli/seed.ts",
|
"cli": "bun run --watch cli/run.ts",
|
||||||
"tauri": "tauri"
|
"seed": "bun --watch cli/seed.ts",
|
||||||
},
|
"tauri": "tauri"
|
||||||
"workspaces": [
|
},
|
||||||
"web"
|
"workspaces": [
|
||||||
],
|
"web"
|
||||||
"dependencies": {
|
],
|
||||||
"@tauri-apps/cli": "^2.0.0-rc.6",
|
"dependencies": {
|
||||||
"@tauri-apps/plugin-dialog": "^2.0.0-rc",
|
"@tauri-apps/cli": "^2.0.0-rc.6",
|
||||||
"@tauri-apps/plugin-fs": "^2.0.0-rc.2",
|
"@tauri-apps/plugin-dialog": "^2.0.0-rc",
|
||||||
"jazz-nodejs": "^0.7.34",
|
"@tauri-apps/plugin-fs": "^2.0.0-rc.2",
|
||||||
"react-icons": "^5.3.0"
|
"jazz-nodejs": "^0.7.34",
|
||||||
},
|
"react-icons": "^5.3.0"
|
||||||
"devDependencies": {
|
},
|
||||||
"bun-types": "^1.1.26"
|
"devDependencies": {
|
||||||
},
|
"bun-types": "^1.1.26"
|
||||||
"prettier": {
|
},
|
||||||
"plugins": [
|
"prettier": {
|
||||||
"prettier-plugin-tailwindcss"
|
"plugins": [
|
||||||
],
|
"prettier-plugin-tailwindcss"
|
||||||
"useTabs": true,
|
],
|
||||||
"semi": false,
|
"useTabs": true,
|
||||||
"trailingComma": "none",
|
"semi": false,
|
||||||
"printWidth": 120,
|
"trailingComma": "none",
|
||||||
"arrowParens": "avoid"
|
"printWidth": 120,
|
||||||
},
|
"arrowParens": "avoid"
|
||||||
"license": "MIT"
|
},
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,58 @@ import { useAccount } from "@/lib/providers/jazz-provider"
|
|||||||
import { open } from "@tauri-apps/plugin-dialog"
|
import { open } from "@tauri-apps/plugin-dialog"
|
||||||
|
|
||||||
export default function TauriRoute() {
|
export default function TauriRoute() {
|
||||||
const { me } = useAccount()
|
const { me } = useAccount({
|
||||||
|
root: {}
|
||||||
|
})
|
||||||
// console.log({ pages: me?.root?.personalPages?.toJSON() })
|
// console.log({ pages: me?.root?.personalPages?.toJSON() })
|
||||||
|
|
||||||
|
// TODO: ugly code, just to get folder connecting working
|
||||||
return (
|
return (
|
||||||
<div className="mb-5 flex flex-col">
|
<div className="mb-5 flex flex-col">
|
||||||
<button
|
{me?.root?.connectedFolderPath && (
|
||||||
onClick={async () => {
|
<div className="flex flex-col gap-4">
|
||||||
const folderPath = await open({
|
<div>Connected folder: {me.root.connectedFolderPath}</div>
|
||||||
multiple: false,
|
<button
|
||||||
directory: true
|
onClick={async () => {
|
||||||
})
|
const folderPath = await open({
|
||||||
console.log(folderPath)
|
multiple: false,
|
||||||
}}
|
directory: true
|
||||||
>
|
})
|
||||||
Connect folder
|
console.log(folderPath)
|
||||||
</button>
|
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 */}
|
{/* TODO: loads a lot more data than expected */}
|
||||||
{/* {JSON.stringify(me?.root?.personalPages)} */}
|
{/* {JSON.stringify(me?.root?.personalPages)} */}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ export class UserRoot extends CoMap {
|
|||||||
topicsWantToLearn = co.ref(ListOfTopics)
|
topicsWantToLearn = co.ref(ListOfTopics)
|
||||||
topicsLearning = co.ref(ListOfTopics)
|
topicsLearning = co.ref(ListOfTopics)
|
||||||
topicsLearned = co.ref(ListOfTopics)
|
topicsLearned = co.ref(ListOfTopics)
|
||||||
|
|
||||||
|
// TODO: maybe should be in another place?
|
||||||
|
connectedFolderPath = co.optional.string
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LaAccount extends Account {
|
export class LaAccount extends Account {
|
||||||
@@ -51,6 +54,8 @@ export class LaAccount extends Account {
|
|||||||
bio: "",
|
bio: "",
|
||||||
is_public: false,
|
is_public: false,
|
||||||
|
|
||||||
|
connectedFolderPath: "",
|
||||||
|
|
||||||
personalLinks: PersonalLinkLists.create([], { owner: this }),
|
personalLinks: PersonalLinkLists.create([], { owner: this }),
|
||||||
personalPages: PersonalPageLists.create([], { owner: this }),
|
personalPages: PersonalPageLists.create([], { owner: this }),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user