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

No questions remaining UI #56

Closed
wants to merge 4 commits into from
Closed

No questions remaining UI #56

wants to merge 4 commits into from

Conversation

sumana2001
Copy link
Collaborator

What

  • We should prompt users to contribute more. One of the ways is to redirect our audience from hunger games to the app so that we can get more and more data.
  • When there are no questions remaining, the screen will ask the user to install the app.

Screenshot

Screenshot 2022-07-17 at 6 37 03 PM

Part of

@netlify
Copy link

netlify bot commented Jul 17, 2022

Deploy Preview for warm-cannoli-79bbb2 ready!

Name Link
🔨 Latest commit 3dafa43
🔍 Latest deploy log https://app.netlify.com/sites/warm-cannoli-79bbb2/deploys/62d8ef6370d00d000878b3b6
😎 Deploy Preview https://deploy-preview-56--warm-cannoli-79bbb2.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

src/pages/questions/QuestionDisplay.jsx Outdated Show resolved Hide resolved
Reset filters
</Button>
</Stack>
<h1>OR</h1>
Copy link
Member

Choose a reason for hiding this comment

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

<h1> has a meaning: this is the top title of the page. I assume the top title of this page is not "OR" 😉

Same for h2, h3, ... If you want a big text use CSS, not HTML

On this topic, you can read <Typography/> doc

<Typography variant="h1" component="p">A big text</Typography>

This components hase two important props:

  • variant: defines how the text will look like (here it will look like a top title)
  • componentthe HML compont which will be used (the sementic meaning (here it's a basic text)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh okay, got it. Thank you. I'll make the changes

@@ -18,6 +18,15 @@ export default function Questions() {
useQuestionBuffer(filterState);
const question = buffer[0] ?? null;

const resetFilters = React.useCallback(
Copy link
Collaborator

Choose a reason for hiding this comment

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

useCallback (memoization) may not be needed in this case, maybe go with a normal arrow function?

Copy link
Member

Choose a reason for hiding this comment

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

The setFilterState is not usefull in the array of dependencies, because state setter are guaranteed to stay constant between render

It's not entirely useless, because resetFilters is passed to QuestionDisplay. WIthout that useCallback each render will create a new function, and so <QuestionDisplay/> will rerender too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I guess that the baseline is if the useCallback memoization improves performance. I think that in this case as the QuestionDisplay is a presentational component and doesn't have heavy computations or something really slow, there is not a lot of benefit in memoizing the reset function and makes the code a bit more complex. Also, the memoization is not cost free, it will store in memory and every render needs to compare with dependency array. Besides that, the QuestionDisplay will rerender every time the Questions (index) rerenders, unless QuestionDisplay itself is memoized.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants