Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studio: Improve offline mode for Sync tab #666

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from

Conversation

katinthehatsite
Copy link
Contributor

@katinthehatsite katinthehatsite commented Nov 15, 2024

Related issues

Closes https://github.com/Automattic/dotcom-forge/issues/9808

Proposed Changes

This PR handles offline mode for the Sync tab.

On the modal: if the connection goes out when the user has the modal open:

Screenshot 2024-11-15 at 3 21 37 PM

On the Sync tab itself:

Screenshot 2024-11-15 at 3 21 53 PM Screenshot 2024-11-15 at 3 22 00 PM

Testing Instructions

  • Pull the changes from this branch
  • Start Studio app with STUDIO_SITE_SYNC=true npm start
  • Navigate to the Sync tab that has some sites connected
  • Disable your internet connection (in my case, it was enough to disconnect from WiFi)
  • Confirm that the buttons to Create a new site and Connect site are disabled
  • Confirm that when you hover over Pull or Push buttons, they are disabled and you can see a tooltip with information
  • Enable your internet connection
  • Click on Connect site to open a modal
  • Disable your internet connection
  • Observe that you see the notice that lays over the content and does not allow select or connect sites
  • Repeat the same steps on a Studio site that has no WP.com sites connected to it and confirm the buttons to connect a site or create a new site are disabled

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@katinthehatsite katinthehatsite self-assigned this Nov 15, 2024
@katinthehatsite
Copy link
Contributor Author

katinthehatsite commented Nov 15, 2024

Since we do not have the exact design for this, I have some open questions that I felt as comments on the PR. Feel free to make any suggestions!

cc @matt-west @wojtekn

onSelectSite={ setSelectedSiteId }
/>
{ isOffline && (
<div className="absolute inset-0 bg-white/80 z-10 flex items-center justify-center">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this needs more or less transparency. I tried with something like bg-white/90 and it seems like it is not transparent enough to me. Happy to adjust this though

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good to me. 👍

{ __( 'Push' ) }
</Button>
</div>
<Tooltip
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added one tooltip for these two buttons as they are too close too each other and are too small and making two tooltips seemed too crowded and excessive. Happy to change this though

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense. Good call @katinthehatsite

</Button>
</Tooltip>
</>
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to extract these two buttons in the common component as we are using them in two places and the code is quite repetitive

@katinthehatsite katinthehatsite requested a review from a team November 18, 2024 09:48
Copy link
Contributor

@matt-west matt-west left a comment

Choose a reason for hiding this comment

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

Looks good to me @katinthehatsite. Thanks!

I spotted an unrelated issue with the alignment of the offline icon in the header bar. Logged here: #668

@ivan-ottinger
Copy link
Contributor

ivan-ottinger commented Nov 18, 2024

I spotted an unrelated issue with the alignment of the offline icon in the header bar. Logged here: #668

Thanks for catching this, Matt.

Turns out this is a regression introduced in #648. I will remove the Toggle sidebar tooltip until we have a better solution for tooltips in https://github.com/Automattic/dotcom-forge/issues/9841.

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