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

[feat] finalize onboarding styling #64

Conversation

ccatherinetan
Copy link
Collaborator

@ccatherinetan ccatherinetan commented Dec 8, 2024

What's new in this PR 🧑‍🌾

Description

  • Styled Onboarding Pages
    • Created ProgressBar
    • Consolidated styling in SelectionScreen
    • Moved Onboarding DropdownOptions to utils/helpers
  • Removed hasPlot/setHasPlot from ProfileContext
  • Refactored components
    • RadioGroup: ensure that no value is selected only if defaultValue is null (false should appear)
    • CustomSelect: use placeholder and label props
    • DateInput: add label prop
    • Buttons: styling / fonts
  • Modified View Plants
    • Style Clear Filters Button
    • Remove hasPlot from screen selection
  • Modified Add Details Flow
    • Used updated CustomSelect, DateInput in PlantDetails
    • Refactored insertUserPlant query to insert userPlant array in 1 go.

Screenshots

Onboarding:
Screen Shot 2024-12-23 at 10 33 37 AM
Screen Shot 2024-12-23 at 10 33 42 AM
Onboarding3
Onboarding4

Add Details
AddDetails1
AddDetails_SelectOpen
AddDetails_Review

View Plants (see Clear Filters Button)
Screen Shot 2024-12-23 at 11 31 05 AM

How to review

Next steps

  • garden set up guide
  • Planting timeline (key and month label) for plant pages
  • https://www.developerway.com/posts/react-re-renders-guide
    • TODO: We don’t need to memoize the filtering?
      • View Plants: filteredPlantList, filteredUserPlantList
      • Seasonal Planting Guide
  • TODO: use CONFIG throughout the app
  • Consolidate Button styles
    • BigButton: P2 (14px)
    • SmallButton: P3 (12px)
  • Refactor CustomSelect to take in value:DropdownOption rather than just T
    • Need to change onboarding to take all DropdownOption as states…
    • Refactor DropdownOption to type Record<T, string>, i.e. use the values as keys.
  • Separate out PlantContext
    • we should prob separate setPlantsToAdd and plantsToAdd out into a separate context. otherwise, updating setPlantsToAdd would trigger a re-render of the entire app

Relevant links

Online sources

https://www.developerway.com/posts/react-re-renders-guide: on how to mitigate re-rendering

Related PRs

CC: @ccatherinetan

@ccatherinetan ccatherinetan linked an issue Dec 8, 2024 that may be closed by this pull request
@ccatherinetan ccatherinetan force-pushed the 48-finalize-onboarding-styles-+-create-onboarding-progress-bar-2 branch from b5a63e7 to 4a9d70e Compare December 8, 2024 08:36
Copy link
Collaborator Author

@ccatherinetan ccatherinetan left a comment

Choose a reason for hiding this comment

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

looking amazing so far! I rebased + added some styling changes to OnboardingContainer, since I was assuming that we'd move OnboardingContainer out of the individual questions and into the OnboardingFlow component.

However, that resulted in the Review page being messed up. You can revert to your original style for OnboardingContainer if you'd like, but i think it's worth considering ways to simplify + reudce redundancy.

Also, after rebasing, there were some issues with the style of the Progress bar against the Header, which we should address

Comment on lines 73 to 76
<ProgressBar progress={2.6} />
<P3 $color={COLORS.shrub} style={{ marginTop: '2.5rem' }}>
QUESTION 1 OF 3
</P3>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

since the progress bar and the question number are shared between multiple pages, we should move it outside of these individual components and into the OnboardingFlow component to reduce redundancy

If we end up making onboarding a multi-page flow next sem, these would be good candidates of things to include in the layout.tsx

So the individual question components can primarily just be the Question Title + the RadioOptions

we might even consider creating a general component OnboardingQuestion that can be used for all 3 questions

Comment on lines 86 to 94
<ButtonDiv>
<Button
onClick={onNext}
disabled={!selectedState}
$primaryColor={COLORS.shrub}
>
Next
</Button>
</ButtonDiv>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think it'd make sense to move the next/back buttons to OnboardingFlow as well

@ccatherinetan ccatherinetan force-pushed the 48-finalize-onboarding-styles-+-create-onboarding-progress-bar-2 branch from c8b45a4 to accda5c Compare December 13, 2024 19:51
@ccatherinetan ccatherinetan marked this pull request as ready for review December 13, 2024 19:52
</BigButton>
</ReviewContainer>
</PageContainer>
<LabeledCustomSelect
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

note: instead of creating a new component, we want to just add a new prop to CustomSelect

Comment on lines 268 to 270
<BigButton color={COLORS.shrub} onClick={handleSubmit}>
Let&apos;s Start Growing!
</BigButton>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there should be both a "Back" and a "Let's Grow!" (Submit) button here.
We can copy over the button styles from the other screens here.

@ccatherinetan ccatherinetan force-pushed the 48-finalize-onboarding-styles-+-create-onboarding-progress-bar-2 branch from accda5c to 057b35d Compare December 23, 2024 08:39
min-height: 100vh;
background-color: ${COLORS.seed};
export const OnboardingContainer = styled.div`
min-height: calc(100vh - 60px); // 60px is the hardcoded height of Header
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we should probably change this to use Flex full-screen so that there's a single source of truth in terms of the screen height


export const BackgroundDiv = styled.div`
width: 100%;
height: 0.375rem;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this should be px

onClick={isContainerClickable ? () => setIsOpen(!isOpen) : undefined}
>
<P2 $color={COLORS.midgray}>
{options.find(option => option.value === value)?.label || placeholder}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we may want to refactor DropdownOption<T> to Record<T, string>, i.e. use the values as keys, to mitigate needing to search through options for the corresponding label.

<OptionsContainer>
{options.map(option => (
<Option
key={String(option.value)}
Copy link
Collaborator Author

@ccatherinetan ccatherinetan Dec 23, 2024

Choose a reason for hiding this comment

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

the key can just be an index since the options list is static, but maybe if we foresee ever passing in dynamic options, this might be a good idea

plantsToAdd: Plant[];
setProfile: (completeProfile: Profile) => Promise<void>; // Now expects full Profile
loadProfile: () => Promise<void>;
setHasPlot: (plotValue: boolean | null) => void;
setPlantsToAdd: (plants: Plant[]) => void;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we should prob separate setPlantsToAdd and plantsToAdd out into a separate context. otherwise, updating setPlantsToAdd would trigger a re-render of the entire app

@ccatherinetan ccatherinetan merged commit b754ad7 into main Dec 23, 2024
2 checks passed
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.

Finalize Onboarding Styles + Create Onboarding Progress Bar
2 participants