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:
@@ -4,6 +4,7 @@
|
||||
"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"
|
||||
|
||||
@@ -4,12 +4,17 @@ 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">
|
||||
{me?.root?.connectedFolderPath && (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div>Connected folder: {me.root.connectedFolderPath}</div>
|
||||
<button
|
||||
onClick={async () => {
|
||||
const folderPath = await open({
|
||||
@@ -17,10 +22,40 @@ export default function TauriRoute() {
|
||||
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