Skip to content

Commit

Permalink
82 add zip code to signup form (#86)
Browse files Browse the repository at this point in the history
* create `ZipCode` input component

* add `zipCode` field to form

* clear state when zipCode is invalid

* automatically set attending location whne only one option exists (virtual or in person)

* prevent defaulting to future message

* Show state text + remove input field

* remove unused code

* cleanup styles

* fix bug preventing selecting attendingLocation
  • Loading branch information
ptbarnum4 authored Jun 9, 2023
1 parent 40d57c2 commit 488b602
Show file tree
Hide file tree
Showing 10 changed files with 360 additions and 143 deletions.
1 change: 1 addition & 0 deletions data/types/infoSession.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ export interface IInfoSessionFormValues {
referencedBy: SelectItem;
sessionDate: SelectItem;
userLocation: SelectItem;
zipCode: string;
attendingLocation: AttendingLocation;
}
4 changes: 4 additions & 0 deletions pages/api/infoSession/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type FormDataSignup = {
firstName: string;
lastName: string;
phone: string;
zipCode: string;
userLocation: SelectItem;
referencedBy: SelectItem;
attendingLocation: AttendingLocation;
Expand All @@ -58,6 +59,7 @@ export interface ISessionSignup {
locationType?: LocationType;
sessionId: string;
token: string;
zipCode: string;
userLocation: string;
attendingLocation: AttendingLocation;
joinCode?: string;
Expand Down Expand Up @@ -90,6 +92,7 @@ function formatPayload(form: FormDataSignup): ISessionSignup {
lastName,
phone,
referencedBy,
zipCode,
userLocation: location,
attendingLocation,
} = form;
Expand All @@ -113,6 +116,7 @@ function formatPayload(form: FormDataSignup): ISessionSignup {
locationType: session?.locationType,
googlePlace: session?.googlePlace,
token: GREENLIGHT_API_TOKEN ?? '',
zipCode,
userLocation: location.additionalInfo || location.value,
attendingLocation,
joinCode: session?.code,
Expand Down
Loading

1 comment on commit 488b602

@vercel
Copy link

@vercel vercel bot commented on 488b602 Jun 9, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.