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

Frontend - Hookup application #57

Merged
merged 14 commits into from
Jan 10, 2025
Merged

Frontend - Hookup application #57

merged 14 commits into from
Jan 10, 2025

Conversation

SheepTester
Copy link
Member

@SheepTester SheepTester commented Jan 9, 2025

Info

Closes #23

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

Because the backend cannot store partial applications, the application draft is stored locally on the device, and may get lost when e.g. iOS Safari does its daily site data clearing. Each application step will store the user's potentially invalid responses locally (using IndexedDB), then on the review page, clicking "Submit" will actually create an application on the backend. Currently, users cannot edit their applications after submitting.

Changes

  • enabled server actions. Server actions are experimental in NextJS 13 (why are we two major versions behind, i thought this was a new project) but it helps to avoid having to define the API calls twice since NextJS does that client-server intermediary step for you
  • application route is now /apply/[step] instead of /apply/?step=[step] because apparently getting url params is a client-only feature
  • responses are saved locally in IndexedDB (with localforage). when you open the application page it will load these saved responses and populate the form. If we ever decide to save the draft on the backend in the future, it wouldn't be too difficult to change the code
  • question changes:
    • clarified phone number format
    • removed graduation date
  • copied API types from server to client, so they have the same names now
  • /apply/[step] now requires auth (via the middleware)

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: (Fill In)

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

To reset my application, I've been changing getApplication on line 31 of [step]/page.tsx to deleteApplication, then going to /apply/1 a few times.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

Screenshots

image

image

image

image

image

Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hackathon-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 6:12pm

Copy link
Collaborator

@alexzhang1618 alexzhang1618 left a comment

Choose a reason for hiding this comment

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

Looks good, two minor comments 🫡

Interestingly I get the login bug here but only for /dashboard and not /apply, I'll look into what's happening

interests: string[];
major: string;
referrer: string[];
// TODO: upload and save resumes to s3
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: remove this comment

@@ -192,13 +190,13 @@ export const appQuestions: Step[] = [
},
{
type: 'file',
id: 'resume',
id: 'resumeLink',
question: <>Upload your resume in PDF format below (Max: 100MB).</>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

think max is 2MB

also: do we do any client-side validation? Let's tell them it's .pdf, .docx, .doc only and hopefully be able to check on the client for them as well

@SheepTester
Copy link
Member Author

Interestingly I get the login bug here but only for /dashboard and not /apply, I'll look into what's happening

/apply directs to /apply/1. Maybe this redirect allows it to apply the cookie? not sure. Though also, /apply isn't affected by the middleware (i.e. it'll redirect to /apply/1 first before checking if you're logged in)

@SheepTester SheepTester merged commit e61b34f into main Jan 10, 2025
5 checks passed
@SheepTester SheepTester deleted the sean/app branch January 10, 2025 19:08
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.

Frontend - Application and submission
2 participants