Skip to content

Conversation

lenhanphung
Copy link
Contributor

Update the create button:

  • Show create button on all folder screens
  • When in virtual folders (Favorites, Recent, etc.), allow creating folders and uploading files to root Files folder
  • Implement NavContext to manage this behavior across different views( Desktop and Mobile)

Copy link

bundlemon bot commented Apr 4, 2025

BundleMon

Files updated (2)
Status Path Size Limits
static/js/main.(hash).js
128.43KB (+1.11KB +0.88%) -
public/static/js/public.(hash).js
99.57KB (+811B +0.8%) -
Unchanged files (19)
Status Path Size Limits
static/js/(chunkId).(hash).js
1.05MB -
static/js/cozy.(hash).js
897.39KB -
public/static/js/(chunkId).(hash).js
851.17KB -
public/static/js/cozy.(hash).js
761.09KB -
(hash).js
337.62KB -
public/(hash).js
337.62KB -
services/qualificationMigration.js
271.6KB -
services/dacc.js
254.54KB -
public/static/js/lib-react.(hash).js
39.37KB -
static/js/lib-react.(hash).js
39.37KB -
public/static/css/cozy.(hash).css
34.63KB -
static/css/cozy.(hash).css
34.63KB -
public/static/js/lib-router.(hash).js
22.05KB -
static/js/lib-router.(hash).js
22.05KB -
static/css/main.(hash).css
16.24KB -
public/static/css/public.(hash).css
5.59KB -
manifest.webapp
1.91KB -
index.html
685B -
assets/manifest.json
185B -

Total files change +1.91KB +0.04%

Groups updated (1)
Status Path Size Limits
**/*.js
6.68MB (+1.98KB +0.03%) -
Unchanged groups (2)
Status Path Size Limits
**/*.{png,svg,ico}
2.19MB -
**/*.css
131.08KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

isSelectionBarVisible={isSelectionBarVisible}
isPublic={false}
refreshFolderContent={(): void => {
// No action needed in virtual folders
Copy link
Contributor

Choose a reason for hiding this comment

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

 refreshFolderContent should not be present though, isn't it? Is it required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're correct that FavoritesView itself, being a virtual folder driven by a query, doesn't require a manual refresh action after creating items.
the refreshFolderContent prop is necessary here because the AddMenuProvider component passes this prop down to its children, specifically ActionMenuContent. ActionMenuContent.
let me know if this makes sense

Copy link
Contributor

@JF-Cozy JF-Cozy Apr 8, 2025

Choose a reason for hiding this comment

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

Ok so having refreshFolderContent undefined will throw an error, where refreshFolderContent={() => {}} will not? If it's the case, I think a proper comment would be empty function needed because this props is required or something like that

@zatteo
Copy link
Member

zatteo commented Apr 7, 2025

Did you try in sharing context? It is a important thing to do regularly when working on layout and core elements in cozy-drive. For example :

  • with sharing link : in Cozy A, create a folder, share it by link with read only permissions, open the in private window
  • with cozy to cozy sharing : in Cozy A, create a folder, share it to Cozy B with read only permissions, in Cozy B check the shared folder

Sometime also to test with read write permissions. I don't say that you need to try every case here but it is an important thing to have in mind.

But looks good overall!

@JF-Cozy
Copy link
Contributor

JF-Cozy commented Apr 8, 2025

@zatteo My review is ✅ , I let you validate when you're ok too.

* @param {object} folder - The folder object (presumably io.cozy.files type).
* @returns {boolean} True if the folder is shared and the user cannot write to it, false otherwise.
*/
export const isReadOnlySharedFolder = folder => {
Copy link
Member

@zatteo zatteo Apr 9, 2025

Choose a reason for hiding this comment

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

You do not use this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. Deleted

The Add button (Create folder, Upload files) now remains visible in the sidebar
when using desktop mode, improving user accessibility to these common actions.

When users perform creation actions from virtual folders (Recent, Sharings)
or Trash, the actions are automatically redirected to the root Files folder.
After successful redirection and completion, the user is navigated to the
Files folder to see their results.

Regular actions within Files or its subfolders continue to work as before.
Update the create button (FAB) on mobile to match desktop behavior:
- Show create button on all folder screens
- When in virtual folders (Favorites, Recent, etc.), allow creating folders and uploading files to root Files folder
- Implement NavContext to manage this behavior across different views

This improves the consistency of user experience between mobile and desktop interfaces.
- Added initialDirId logic to handle invalid displayedFolder
- Removed unnecessary hasWriteAccess check in AddMenuProvider
- Improved code clarity by removing redundant comments
- Fixed navigation with proper lastClicked state updates
- Updated error handling condition for encrypted folder
- Improved folder refresh implementation
- Simplified upload success logic for better readability
Update AddMenu components to properly handle creation actions
when working with shared folders. Improve user experience by
ensuring all creation options behave correctly in shared context.

Also add helper functions to support this functionality.
@lenhanphung lenhanphung force-pushed the fix/add-button-behavior branch from a395d33 to 525a50b Compare April 10, 2025 06:50
@lenhanphung lenhanphung merged commit cdfa858 into master Apr 10, 2025
3 checks passed
@lenhanphung lenhanphung deleted the fix/add-button-behavior branch April 10, 2025 08:59
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.

3 participants