feat: upload documents#25
Conversation
- App reads file structure on startup
- App adds sample structure on load
- Redesigned FoldersView
- Uploaded files are saved to `/uploads` folder
- Selectede files in the sidebar show on center
- TipTap files show with editor
- other files show a placeholder view
| const REF_STUDIO_DIR = '.ref-studio/project-x'; | ||
| const UPLOADS_DIR = 'uploads'; |
There was a problem hiding this comment.
Should we put these paths into environment variables, so they're easily accessible by the sidecar as well?
There was a problem hiding this comment.
I don't think you would need to access these folders directly, but instead you (sidebar) will given the file path(s) to work with. Or insterad the folder containing uploaded files.
There was a problem hiding this comment.
I think we should consider using macOS' container folders (~/Library/Containers/) and then look for a cross-platform implementation of that. I'm sure there is some module that does that 🤔
There was a problem hiding this comment.
Maybe now, we can get rid of the .ref-studio prefix as we are working in the app data folder. Will change this and keep only the project placeholder (i.e. project-x).
| import { cx } from '../cx'; | ||
|
|
||
| export function MenuBar({ editor }: { editor: Editor }) { | ||
| const [counter, setCounter] = React.useState(1); |
There was a problem hiding this comment.
If I understand correctly, counter is only used to force re-render, since you never use its value. Maybe you could create a useForceUpdate hook that does it, instead of having an unnecessary counter here. This way we could also use the hook in other components.
I also prefer a boolean state toggling between true and false to force re-render, instead of having a counter that could theoretically grow to infinite.
There was a problem hiding this comment.
You are right! I forgot this "hack". Not sure about the useForceUpdate hook. For now will update this to a boolean toggle.
I've had to implement this in order for the menu bar to update when the editor (state) changes.

Sync file-system folder with RefStudio
/uploadsfolder