Skip to content

Commit

Permalink
fix: Sharing banner blinks
Browse files Browse the repository at this point in the history
When sharing with Cozy and already Added,
the share banner should never appear.

Before this fix, it could blink on loading.
  • Loading branch information
Merkur39 committed Dec 4, 2024
1 parent 7854188 commit e7aa506
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/modules/views/Public/PublicFolderView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,15 @@ const PublicFolderView = () => {
!showNewBreadcrumbFlag || showNewBreadcrumbFlag !== true

// Check if the sharing shortcut has already been created (but not synced)
const isShareAlreadyAdded =
!sharingInfos.loading && sharingInfos.isSharingShortcutCreated
const isShareNotAdded =
!sharingInfos.loading && !sharingInfos.isSharingShortcutCreated
// Check if you are sharing Cozy to Cozy (Link sharing is on the `/public` route)
const isPreview = window.location.pathname === '/preview'
// Show the sharing banner plugin only on shared links view and cozy to cozy sharing view(not added)
const isSharingBannerPluginDisplayed =
!isShareAlreadyAdded || (isOnSharedFolder && !isPreview)
isShareNotAdded || (isOnSharedFolder && !isPreview)

const isAddToMyCozyFabDisplayed =
isMobile && isPreview && !isShareAlreadyAdded
const isAddToMyCozyFabDisplayed = isMobile && isPreview && isShareNotAdded

return (
<Main isPublic={true}>
Expand Down

0 comments on commit e7aa506

Please sign in to comment.