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

Preview Sites: Add Clear button for expired sites with related styling #913

Merged
merged 8 commits into from
Feb 11, 2025

Conversation

ivan-ottinger
Copy link
Contributor

@ivan-ottinger ivan-ottinger commented Feb 10, 2025

Related issues

Proposed Changes

  • add Clear button for expired sites with related styling
  • strike-through site name and address when it is expired
  • sort the preview sites by the last updated timestamp
  • add tests

Markup on 2025-02-11 at 12:56:24

Testing Instructions

  1. Check out the PR branch and build the app with STUDIO_QUICK_DEPLOYS=true npm start.
  2. If you don't have any expired preview site:
  • create a new one
  • back up the /Library/Application Support/Studio/appdata-v1.json file (this is just to get back the preview site record after you finish testing)
  • temporarily change the date timestamp to "pretend" the site is already expired:

Markup on 2025-02-10 at 16:01:42

I used 1639191025952 in my tests.

  1. Head over to the Preview tab and review the rendering of the expired site. The last updated sites should be at the top, expired sites at the bottom of the list.
  2. Click the Clear button / link. It should remove the preview site from the list.
  3. Restore your backed-up appdata-v1.json file.
  4. Running npm test src/modules/preview-site/components/tests/preview-site-row.test.tsx should pass.

Pre-merge Checklist

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

@ivan-ottinger ivan-ottinger self-assigned this Feb 10, 2025
<Button
variant="link"
onClick={ () => removeSnapshot( snapshot ) }
className={ '!text-a8c-gray-70 hover:!text-a8c-red-50' }
Copy link
Contributor Author

@ivan-ottinger ivan-ottinger Feb 10, 2025

Choose a reason for hiding this comment

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

This is the same styling as we use for the Disconnect button on the Sync tab:

Markup on 2025-02-10 at 16:14:53

(including red color on hover)

We can, of course, change this: e.g. use blue or red link color and adjust the hover as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the end I changed the color of the Clear button to text-a8c-blueberry (83a21d0) - to match it with the design in Figma.

I have also kept the red color on hover.

@ivan-ottinger ivan-ottinger requested a review from a team February 10, 2025 15:56
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Great work!
I confirm the UI is very similar to the Figma design and I can clear the expired site.

Ivan, could we display the expired sites at the bottom? Maybe sorting the rows by updated is a good solution.

<div
className={ cx(
'text-[13px] leading-5 line-clamp-1 break-all',
isExpired && 'line-through'
Copy link
Member

Choose a reason for hiding this comment

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

Let's make it text-a8c-gray-70 when expired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the design (RToz6tIuQ7nlZrikBte4GU-fi-6541_2932), it is using text-[#757575] color when expired:

Markup on 2025-02-11 at 12:32:35

→ Made the change in f4f7d88:

Markup on 2025-02-11 at 12:31:53

But if you like, we can still make it text-a8c-gray-70 instead. 🙂

@ivan-ottinger
Copy link
Contributor Author

Great work! I confirm the UI is very similar to the Figma design and I can clear the expired site.

Ivan, could we display the expired sites at the bottom? Maybe sorting the rows by updated is a good solution.

Thank you, Antonio! I think sorting by the updated field is a good idea indeed. I have added it in 710737e.

@ivan-ottinger ivan-ottinger requested a review from sejas February 11, 2025 11:57
Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

I've confirmed the expired sites appear at the bottom and with the correct design.

Screenshot 2025-02-11 at 14 04 36

<div
className={ cx(
'text-[13px] leading-5 line-clamp-1 break-all',
isExpired && 'line-through text-[#757575]'
Copy link
Member

Choose a reason for hiding this comment

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

I've investigated if we have the color text-a8c-gray-700 - #757575 , but it seems we don't have it. I've tried updating automattic/color-studio but the new version 4.1.0 doesn't include it either.
I think it's ok to leave it as it is, since we are using that color in the rest of the app, but we could consider adding a new variable in tailwind config.

Something like:

a8cToTailwindColors[ ${ PREFIX }-gray-700 ] = '#757575'; // Gray 700

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great idea! Thanks! I have added the variable and replaced all occurrences of #757575 in the latest commit: 323002b.

src/components/content-tab-previews.tsx Show resolved Hide resolved
@ivan-ottinger ivan-ottinger merged commit 0428c01 into trunk Feb 11, 2025
8 checks passed
@ivan-ottinger ivan-ottinger deleted the add/clear-expired-preview-site-button branch February 11, 2025 16:52
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.

2 participants