Skip to content

feat: upload documents#25

Merged
sergioramos merged 15 commits into
mainfrom
upload-documents
May 24, 2023
Merged

feat: upload documents#25
sergioramos merged 15 commits into
mainfrom
upload-documents

Conversation

@cguedes

@cguedes cguedes commented May 22, 2023

Copy link
Copy Markdown
Collaborator

Sync file-system folder with RefStudio

  • 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

image

sehyod and others added 5 commits May 22, 2023 10:13
- 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
Comment thread src/filesystem.tsx Outdated
Comment on lines +13 to +14
const REF_STUDIO_DIR = '.ref-studio/project-x';
const UPLOADS_DIR = 'uploads';

@gjreda gjreda May 22, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put these paths into environment variables, so they're easily accessible by the sidecar as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow the App Data Dir wasn't working when I tested. Made the change and now is working inside the application's data dir.

image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@sehyod sehyod marked this pull request as ready for review May 23, 2023 13:38
@cguedes cguedes requested a review from sehyod May 23, 2023 13:52
sehyod
sehyod previously approved these changes May 23, 2023
sehyod
sehyod previously approved these changes May 24, 2023
Comment thread src/TipTapEditor/MenuBar.tsx Outdated
import { cx } from '../cx';

export function MenuBar({ editor }: { editor: Editor }) {
const [counter, setCounter] = React.useState(1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sergioramos sergioramos changed the title Upload-documents feat: upload documents May 24, 2023
@sergioramos sergioramos merged commit 0109ee1 into main May 24, 2023
@sergioramos sergioramos deleted the upload-documents branch May 24, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants