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] create simple interest form component #25

Merged
merged 11 commits into from
Nov 7, 2023

Conversation

varortz
Copy link
Collaborator

@varortz varortz commented Oct 25, 2023

🎋 Description

  • Converts the interest page into a component, and adds additional form inputs necessary (radio inputs & text input for start date)
  • Implements a Button component in components/Button.tsx
  • Passes in CaseListing objects into both the CaseDetails and InterestForm component to facilitate displaying/using case information for a specific case

🌴 What's new in this PR

🌲 Screenshots

iForm

🌳 How to review

  • Fetch this branch and go on it
  • navigate to the cases page in the url: http://localhost:3000/cases
  • scroll through the cases and click on random ones, make sure that the interest form looks good throughout all the cases being clicked on
  • Click on the radio buttons and use the text inputs. Keep in mind there's currently no validation yet, so just make sure they don't act wonky when being interacted with.
  • Hover over the "Submit Interest" button

Might be good to test all versions of the Button/ErrorButton component

  • Look at components/Button.tsx for documentation on how to use the buttons

🌱 Next steps

  • Update the CaseDetails component to display case information according to David's designs
  • Add validation to the interest form and update the interest submission functionality if necessary (focused more on the frontend aspect in this PR due to schema changes 🙈)
  • Fix scrolling on the cases page to facilitate scrolling to see the case details + interest form

🔗 Relevant Links

ℹ️ Online sources

Guide for creating a custom radio input using styled components (kinda janky implementation, but Jinkang++ helped make edits to it in this PR to improve it):

Styled Components documentation that is useful for understanding the Button component implementation:
https://styled-components.com/docs/basics#adapting-based-on-props

🪴 Related PRs

CC: @pragyakallanagoudar @davidqing6432

@linear
Copy link

linear bot commented Oct 25, 2023

IJP-10 Create simple interest form component.

Routes:

/interest (src/app/interest/page.tsx)

/cases (src/app/cases/page.tsx)

  • Move the existing simple interest form onto the /cases route in order to consolidate the two.

  • Create a simplified version of the case interest form component. You can hardcode all case attributes, and just focus on visuals for right now. You can also leave out the profile match section entirely for simplicity. This will be added in a future sprint.

  • Use the existing query invocation to write an entry to the interests table when the submit button is pressed.

    Screenshot 2023-10-12 at 1.01.49 AM.png

@varortz varortz changed the title Alvaro/ijp 10 create simple interest form component [feat] create simple interest form component Oct 25, 2023
Copy link
Contributor

@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.

Looks rlly good! a couple things to implement:

  • clear out the form responses when clicking on a new case on the scroll bar
  • form validation + updating interests table w/ submission
  • include a warning on the interest form that the form responses are not saved (according to HIFI)
  • make the input text border to 2 pixels (David will also change on figma)
  • hover functionality for the Radio Button

The Button, ErrorButton + their secondary formats look great!

const [rolesInterested, setRolesInterested] = useState<string>('');
const [startDate, setStartDate] = useState<string>('');

const handleInsert = async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious why this function seems to force a re-render of the whole page? Are we explicitly doing this somewhere?

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 have a rough idea of why it might be re-rendering, but I'll also look more into this during the next sprint! I think once I reconnect the form to the backend it'll be easier to debug.

start_date: startDate,
},
};
await insertInterest(newInterest);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this is just on my end, but for me this doesn't seem to be writing an interest to the table? All of this seems fine though, so I'm not sure why this might be 🤔

But also since this sprint is entirely frontend-focused, we can look deeper into this in your next sprint!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, there's a 409 error rn... I'll look more into it during the next sprint to not delay merging the frontend changes in!

Copy link
Contributor

@jinkang-0 jinkang-0 left a comment

Choose a reason for hiding this comment

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

Looks great! I just added some minor details to consider, looking forward to the new changes!

src/app/cases/page.tsx Outdated Show resolved Hide resolved
src/components/Button.tsx Outdated Show resolved Hide resolved
src/components/Button.tsx Outdated Show resolved Hide resolved
src/components/CaseDetails/index.tsx Outdated Show resolved Hide resolved
position: sticky;
top: 4rem;
width: 95%;
border-radius: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we use rem here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

resolved this in slack DMs with sauhard! this is what he said:

i would rec using px
reason is rem depends on root font size and border widths have no relation to font size
and the variance is border width across screen size is pretty limited

Copy link
Collaborator

Choose a reason for hiding this comment

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

so let's keep this as is

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 for border-radius we will still use rem, only px for border-width

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pragyakallanagoudar are you fine with going along with this change? I think it makes sense to change border-radius to rem

src/components/InterestForm/index.tsx Outdated Show resolved Hide resolved
src/components/InterestForm/styles.tsx Outdated Show resolved Hide resolved
src/components/InterestForm/styles.tsx Show resolved Hide resolved
src/components/InterestForm/styles.tsx Outdated Show resolved Hide resolved
src/components/ListingCard/ListingCard.tsx Outdated Show resolved Hide resolved
@@ -13,6 +13,15 @@ export async function fetchProfiles() {
}
}

export async function fetchProfileById(userId: UUID) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jinkang-0 any idea why this might be here? 🤔 I assumed that this was part of the profile context PR which was already merged in...

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually it seems like all the changes from the profile context and global styles are included on here...? i somehow thought this diff would only included changes that were not already present on main after rebasing :o but i might be misremembering!

@@ -0,0 +1,45 @@
import styled from 'styled-components';

/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

AMAZING documentation!! thank you for this alvaro :)))

Copy link
Collaborator

@pragyakallanagoudar pragyakallanagoudar left a comment

Choose a reason for hiding this comment

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

LOOKS AMAZINGGGG THANK YOU FOR ALL YOUR HARD WORK ALVARO!!!

@varortz varortz force-pushed the alvaro/ijp-10-create-simple-interest-form-component branch from de04806 to e3bdd8f Compare November 6, 2023 07:25
@varortz varortz force-pushed the alvaro/ijp-10-create-simple-interest-form-component branch from e3bdd8f to 3078d38 Compare November 6, 2023 07:47
Copy link
Contributor

@jinkang-0 jinkang-0 left a comment

Choose a reason for hiding this comment

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

Gonna drop some unit policing stuff

src/components/Button.tsx Outdated Show resolved Hide resolved
src/components/InterestForm/styles.tsx Outdated Show resolved Hide resolved
src/components/InterestForm/styles.tsx Outdated Show resolved Hide resolved
src/components/TextInput/styles.tsx Outdated Show resolved Hide resolved
src/utils/helpers.ts Outdated Show resolved Hide resolved
@jinkang-0 jinkang-0 merged commit 0d6c848 into main Nov 7, 2023
2 checks passed
@pragyakallanagoudar pragyakallanagoudar deleted the alvaro/ijp-10-create-simple-interest-form-component branch November 9, 2023 09:58
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.

4 participants