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

Add Hero widget #1077

Merged
merged 25 commits into from Sep 19, 2019
Merged

Add Hero widget #1077

merged 25 commits into from Sep 19, 2019

Conversation

rogerhutchings
Copy link
Contributor

@rogerhutchings rogerhutchings commented Aug 14, 2019

Closes #1018
Closes #49 🎉

  • Set default screen size to 'small'
  • Update React version to match other apps
  • Add Hero component
    • Add background
    • Add about link and intro
    • Add workflow loader (with translated strings!)

Mobile

Screenshot 2019-08-14 16 41 44

Desktop

Screenshot 2019-08-14 16 41 34

Review Checklist

General

  • Are the tests passing locally and on Travis?
  • Is the documentation up to date?
  • Is the changelog updated?

Apps

  • Does it work in all major browsers: Firefox, Chrome, Edge, Safari?
  • Does it work on mobile?
  • Can you rm -rf node_modules/ && yarn bootstrap and app works as expected?
  • Can you run a production build of the app?

@rogerhutchings rogerhutchings added the enhancement New feature or request label Aug 14, 2019
@rogerhutchings rogerhutchings requested a review from a team August 14, 2019 15:46
@rogerhutchings rogerhutchings added this to To do in Project app via automation Aug 14, 2019
Copy link
Contributor

@srallen srallen left a comment

Choose a reason for hiding this comment

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

I have a few minor comments on initial pass


const as = workflow.default
? `${router.asPath}/classify`
: `${router.asPath}/classify/workflow/${workflow.id}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Woohoo! This is going to make building out workflow selection easier I think having a project home page to actually use for manual testing.

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'm actually thinking that all workflows should be routed to /classify/workflow/${workflow.id}, and that /classify simply does a redirect.

  • /project/[owner]/[project]/classify/workflow/[workflow_id] becomes our new classify page
  • No ambiguity in what resource lives at the classify url
  • No duplicated content at different urls

Thoughts / feelings?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm fine with /classify redirecting to /classify/workflow/:workflow_id each time, but this should be in an ADR (if it's not already).

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me but /classify should redirect to the stored workflow ID from project preferences for logged-in volunteers, rather than just redirecting to the default workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the same ordering of selection would exist: user stored UPP workflow id --> project set workflow id in UPP --> project default --> random active selection. Any one of those would result in the id that gets redirected to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also #1107

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also - for the purposes of this PR, I propose leaving as is for now

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can get rid of the ternary here and always route to the workflow ID when linking to a specific workflow (assuming these links are the same as the 'Choose a workflow' links on the current home page.)

@rogerhutchings
Copy link
Contributor Author

rogerhutchings commented Aug 16, 2019

On propTypes, MST's author recommends using optional props; it appears as though components get instantiated before some props can be injected. Otherwise, we set a bunch of default falsey defaults ¯\(ツ)

@rogerhutchings
Copy link
Contributor Author

@srallen would you mind taking another look?

Copy link
Contributor

@srallen srallen left a comment

Choose a reason for hiding this comment

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

I have a few more comments. Thanks!


const as = workflow.default
? `${router.asPath}/classify`
: `${router.asPath}/classify/workflow/${workflow.id}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm fine with /classify redirecting to /classify/workflow/:workflow_id each time, but this should be in an ADR (if it's not already).

packages/lib-grommet-theme/src/index.js Show resolved Hide resolved
- Set default screen size to 'small'
- Update React to match other apps
- Add Hero component
  - Add background
  - Add about link and intro
  - Add workflow loader
- Filter workflows response to only include requested fields
- Filter workflows response to only include incomplete workflows
- Move translations request to work in series, as `activeWorkflows` may
  include redundant translations and these can get big
- Create a map of display names, rather than do an array search
  for performance
rogerhutchings and others added 5 commits September 12, 2019 10:01
* Make Hero widget responsive with SSR

- Install @artsy/fresnel
- Move grommet theme merger to its own helper
- Add fresnel helper components
- Add media queries to Hero widget
- Update tests

* Update packages/app-project/src/helpers/theme/README.md

Co-Authored-By: Jim O'Donnell <jim@zooniverse.org>

* Add per-layout tests
@rogerhutchings
Copy link
Contributor Author

okay, i've added the final set of tests - thanks to @srallen and @eatyourgreens for the help

@rogerhutchings
Copy link
Contributor Author

With #1107 merging, this is going to need to change (specifically the default /classify route behaviour), but that can go in a separate PR.

@beckyrother
Copy link

@rogerhutchings the > is quite large, any way to adjust so it's the same height as the 'learn more' text? Other than that design looks great

Copy link
Contributor

@srallen srallen left a comment

Choose a reason for hiding this comment

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

LGTM. I have one non-blocking inline comment for the error state test. Additionally, I'm wondering about the Img component used to render the background. I had written the Media component in the shared components library to use the thumbnail service because we found that some projects were upload massively sized media. I think we have limits in place in the lab now, but for consistency in practice with keeping file sizes small, I think we will want to consider using Media for the purposes of leveraging the thumbnail service. This is non-blocking because I know the Media component needs some work. Let's add an issue to keep track of this and discuss it further?

scope = nock('https://panoptes-staging.zooniverse.org/api')
.get('/translations')
.query(true)
.reply(200, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking, but if returning an error, just for consistency in mocking, this probably shouldn't be a 200 status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only the workflows endpoint is returning an error in this test, but both requests need to be successful in order to show the content (as currently written)

@srallen
Copy link
Contributor

srallen commented Sep 18, 2019

@beckyrother this will be ready for a design review when this merges and deploys to our staging instance (branch deployments are still WIP)

@beckyrother
Copy link

Sorry. Please tag me when it's ready.

@srallen
Copy link
Contributor

srallen commented Sep 18, 2019

@beckyrother no worries! I thought you might want to check it out as an actual app and not just screenshots.

@srallen
Copy link
Contributor

srallen commented Sep 18, 2019

I've opened #1133 to discuss the Media component use.

@eatyourgreens eatyourgreens merged commit 175010f into master Sep 19, 2019
Project app automation moved this from To do to Done Sep 19, 2019
@eatyourgreens eatyourgreens deleted the add-hero branch September 19, 2019 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Project app
  
Done
Development

Successfully merging this pull request may close these issues.

Add project landing page hero component Add project home page
4 participants