Skip to content

feat(platform): add color toggle to follow button on research page#2205

Closed
NoHara42 wants to merge 5 commits intoONEARMY:masterfrom
NoHara42:feat/follow-button-color-toggle
Closed

feat(platform): add color toggle to follow button on research page#2205
NoHara42 wants to merge 5 commits intoONEARMY:masterfrom
NoHara42:feat/follow-button-color-toggle

Conversation

@NoHara42
Copy link
Copy Markdown
Contributor

@NoHara42 NoHara42 commented Apr 5, 2023

PR Checklist

PR Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Developer experience (improves developer workflows for contributing to the project)

Description

First PR to an open-source project, woop!
Adds the same color as the active notification icon to the thunderbolt inside any research item.

Git Issues

Closes #2200

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes
image
image

@NoHara42 NoHara42 requested a review from a team as a code owner April 5, 2023 15:39
@NoHara42
Copy link
Copy Markdown
Contributor Author

NoHara42 commented Apr 5, 2023

What is the testing philosophy here, do we test extensively?

@davehakkens davehakkens added the Review allow-preview ✅ Has received manual check for malicious code and can be safely built for preview label Apr 5, 2023
@cypress
Copy link
Copy Markdown

cypress bot commented Apr 5, 2023

4 failed tests on run #3177 ↗︎

4 75 3 0 Flakiness 0

Details:

feat(platform): add color toggle to follow button on research page
Project: onearmy-community-platform Commit: aab3a7b3cc
Status: Failed Duration: 04:32 💡
Started: Apr 5, 2023 3:50 PM Ended: Apr 5, 2023 3:54 PM
Failed  map.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
map > [By Admin] > should delete a map pin Output Screenshots
Failed  settings.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
[Settings] > [Focus Machine Builder] > [Edit a new profile] Output Screenshots
Failed  notificationBanner.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
[Notification Banner] > [By Authenticated user with filled profile] > [Notification Banner is visible for user with blank profile] Output Screenshots
Failed  events.spec.ts • 1 failed test • ci-chrome

View Output Video

Test Artifacts
[Events] > [Create an event] > [By Authenticated] Output Screenshots

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2023

Visit the preview URL for this PR (updated for commit 3d39ad2):

https://onearmy-next--pr2205-feat-follow-button-c-qjjwgn3f.web.app

(expires Sat, 27 May 2023 13:38:02 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6d65e4f8fee2f6ab2da0c1c3b85b8797d66afa59

@thisislawatts
Copy link
Copy Markdown
Contributor

Thanks for raising the PR so quickly @NoHara42, we've some documentation on the testing approach here: https://onearmy.github.io/community-platform/Testing/overview, although it looks a little out of date. Recently I have been introducing tests at a lower level using jest and react testing library, primarily to speed up the feedback cycle whilst working.

You could look at extending the existing ResearchArticle test coverage to cover this scenario:
https://github.com/ONEARMY/community-platform/blob/master/src/pages/Research/Content/ResearchArticle.test.tsx

@davehakkens
Copy link
Copy Markdown
Contributor

Are you able to finish this @NoHara42 or need help?

@NoHara42
Copy link
Copy Markdown
Contributor Author

@davehakkens hey Dave, I still intend to finish this up. Sorry the last few days were busier than I thought.
I'll need another couple days before I can have another go at completing the tests I wrote.

@davehakkens davehakkens added the Stage: 🤝 Awaiting author Waiting on action from the author label Apr 17, 2023
@davehakkens
Copy link
Copy Markdown
Contributor

davehakkens commented Apr 23, 2023

let me know if you are able to finish this @NoHara42. If not no worries we will take over.
Want to merge it in so we can use it for season 3 :)

@NoHara42
Copy link
Copy Markdown
Contributor Author

@davehakkens hey Dave, I will take another look right now and will comment again if I'm not able to complete it this session.

Currently working on a farm in the south of Spain so my time is a bit limited. 🐵

@NoHara42
Copy link
Copy Markdown
Contributor Author

NoHara42 commented Apr 24, 2023

Had some issues setting up the Dev environment on my system today, some WSL drama...

I would like to take another crack at it tomorrow, as I have a test written.

@davehakkens do you (or perhaps @thisislawatts) have some time in the evenings to reassure me that the tests I'm writing are valid and my Dev environment is setup correctly?

I am getting a bunch of errors when I run all the projects unit tests.

I have run yarn and have built all the project files.

@AlfonsoGhislieri
Copy link
Copy Markdown
Contributor

Hi @NoHara42 what tests are you running? The yarn test:unit should be for unit tests which is what I assume you have been writing? If its a component test then should be with yarn test:components

I don't think these should be failing.. Let me know

@NoHara42
Copy link
Copy Markdown
Contributor Author

NoHara42 commented Apr 25, 2023

Hi @NoHara42 what tests are you running? The yarn test:unit should be for unit tests which is what I assume you have been writing? If its a component test then should be with yarn test:components

@AlfonsoGhislieri I am running unit tests, I realised the "errors" I had are just warnings:
Warning: An update to observerComponent inside a test was not wrapped in act(...).

But the suggestion this warning suggests isn't upheld in the codebase, I'll ignore it for now.

@davehakkens I've added 2 unit tests for both the "Follow" and "Following" states of the button.
Should be ready for review.

)
? 'orange'
: 'black'
}
Copy link
Copy Markdown
Contributor

@AlfonsoGhislieri AlfonsoGhislieri Apr 25, 2023

Choose a reason for hiding this comment

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

Issue: Would be a lot cleaner to not have these colors hardcoded, would be nicer to add them to the theme/use the theme instead (eg: subscribed: 'orange', not-subscribed: 'black'). You can find the theme files in packages/themes/src.

Let me know if you have any questions or need any help for this. BUT, if this is too much extra work and you don't have time I'm happy to approve this and add it to my TODO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

<Icon glyph={props.icon} />
<Icon glyph={props.icon} color={props.iconColor} />
</Flex>
)}
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.

Suggestion following issue above: here you should use sx to so that you can access the theme colors directly. Eg: <Icon glyph={props.icon} sx={{ color: props.iconColor }} />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to add sx to the IconWrapper Component directly, as it uses styled components, which didn't seem to work well with the theming I had defined.

@AlfonsoGhislieri
Copy link
Copy Markdown
Contributor

AlfonsoGhislieri commented Apr 25, 2023

Thanks for this @NoHara42, great to also have the tests in here! Just a small issue regarding the hardcoded colors. Would be good to add these to the themes instead eg: subscribed: 'orange' so this can be accessed more easily. But I can fix this up if you don't have the time so just let me know.

Also the commits are not passing the linting check (needs to adhere to https://www.conventionalcommits.org), you can use git rebase -i to change these. In the future you can also use yarn commit to help with making the commits through an interactive prompt

NoHara42 added a commit to NoHara42/community-platform that referenced this pull request Apr 26, 2023
@NoHara42 NoHara42 force-pushed the feat/follow-button-color-toggle branch from d54efe5 to be91da7 Compare April 26, 2023 17:45
@NoHara42 NoHara42 force-pushed the feat/follow-button-color-toggle branch from be91da7 to cfed652 Compare April 26, 2023 17:50
@NoHara42
Copy link
Copy Markdown
Contributor Author

@AlfonsoGhislieri Should be done with your suggestions, also refactored some repeated theme colors while I was at it.

Sorry about the force pushes, I'm not the subtlest of git history cleaners. 🥲

@AlfonsoGhislieri
Copy link
Copy Markdown
Contributor

AlfonsoGhislieri commented Apr 26, 2023

Thanks for this @NoHara42! Really appreciate the extra work refactoring the themeing! I just raised #2251 to fix the unit tests that were failing and made some minor changes (sorry for hijacking), just removed some uncessary themeing and the use of hyphens. Your commits are still there in the history so your hard work is not unaccounted for! 🙃

@onearmy-bot
Copy link
Copy Markdown
Collaborator

🎉 This issue has been resolved in version 1.49.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Research 🧪 Review allow-preview ✅ Has received manual check for malicious code and can be safely built for preview Stage: 🤝 Awaiting author Waiting on action from the author

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[feature request] Change icon color when following

5 participants