Skip to content

Commit

Permalink
Move university dropdown to application form (#70)
Browse files Browse the repository at this point in the history
* Move university dropdown to application form

and fix "Required" error not showing for file upload

* move san diego universities on top, fix register form width
  • Loading branch information
SheepTester authored Jan 14, 2025
1 parent a613424 commit 054c7d1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 44 deletions.
1 change: 1 addition & 0 deletions client/src/app/register/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

.register {
margin: 0 auto;
width: 100%;
max-width: 646px;
}

Expand Down
23 changes: 1 addition & 22 deletions client/src/app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import TextField from '@/components/TextField';
import Dropdown from '@/components/Dropdown';
import Button from '@/components/Button';
import Typography from '@/components/Typography';
import universities from '@/lib/constants/universities';
import { AuthManager } from '@/lib/managers';
import type { UserRegistration } from '@/lib/types/apiRequests';
import type { PrivateProfile } from '@/lib/types/apiResponses';
Expand All @@ -23,7 +22,6 @@ interface RegisterFormValues {
email: string;
password: string;
confirmPassword: string;
university: string;
}

export default function RegisterPage() {
Expand All @@ -33,11 +31,7 @@ export default function RegisterPage() {
handleSubmit,
getValues,
formState: { errors },
} = useForm<RegisterFormValues>({
defaultValues: {
university: '',
},
});
} = useForm<RegisterFormValues>();

const router = useRouter();

Expand Down Expand Up @@ -126,21 +120,6 @@ export default function RegisterPage() {
type="password"
autoComplete="new-password"
/>
<Controller
name="university"
control={control}
render={({ field }) => (
<Dropdown
name="universityOptions"
ariaLabel="Select an university"
options={universities}
value={field.value}
onChange={field.onChange}
className={styles.dropdown}
placeholder="Select"
/>
)}
/>
<Button variant="primary" onClick={handleSubmit(onSubmit)}>
Sign Up
</Button>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ApplicationReview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const ApplicationReview = ({
pronouns: responses.pronouns,
orientation: responses.orientation,
ethnicity: responses.ethnicity,
dietary: responses.dietary,
dietary: ['Will be answered in follow-up form.'],
interests: responses.interests,
major: responses.major,
referrer: responses.referrer,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ApplicationStep/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
gap: 0.5rem;
color: vars.$error;
}
:user-invalid + .error,
:user-invalid ~ .error,
.multipleChoice:has(:user-invalid) .error {
display: flex;
}
Expand Down
28 changes: 14 additions & 14 deletions client/src/components/FileSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ const FileSelect = ({

return (
<>
<input
type="file"
accept={fileTypes.join(',')}
name={name}
id={id}
required={required && !defaultFile}
className="accessible-but-hidden"
disabled={disabled}
onChange={e => {
if (e.currentTarget.files?.[0]) {
setSelected(e.currentTarget.files[0]);
}
}}
/>
<div className={styles.wrapper}>
{selected?.name}
<input
type="file"
accept={fileTypes.join(',')}
name={name}
id={id}
required={required && !defaultFile}
className="accessible-but-hidden"
disabled={disabled}
onChange={e => {
if (e.currentTarget.files?.[0]) {
setSelected(e.currentTarget.files[0]);
}
}}
/>
<Button variant="secondary" for={id}>
Upload New
</Button>
Expand Down
7 changes: 7 additions & 0 deletions client/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FAQQuestion } from './components/FAQAccordion';
import { Deadlines } from './components/Dashboard';
import { Step } from './components/ApplicationStep';
import { countries } from './lib/constants/countries';
import universities from './lib/constants/universities';

export const FAQ_QUESTIONS: FAQQuestion[] = [
{
Expand Down Expand Up @@ -86,6 +87,12 @@ export const appQuestions: Step[] = [
// choices: ['2025', '2026', '2027', '2028'],
// other: true,
// },
{
type: 'dropdown',
id: 'university',
question: <>University</>,
choices: universities,
},
{
type: 'select-one',
id: 'levelOfStudy',
Expand Down
12 changes: 6 additions & 6 deletions client/src/lib/constants/universities.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
const universities = [
'University of California, San Diego',
'San Diego State University',
'University of San Diego',
'California College San Diego',
'California School of Professional Psychology - San Diego',
'Design Institute of San Diego',
'San Diego University for Integrative Studies',
'University of California, Berkeley',
'University of California, Davis',
'University of California, Hastings College of Law',
Expand Down Expand Up @@ -239,7 +245,6 @@ const universities = [
'California College for Health Sciences',
'California College of Arts and Crafts',
'California College of Podiatric Medicine',
'California College San Diego',
'California Institute of Integral Studies',
'California Institute of Technology',
'California Institute of the Arts',
Expand All @@ -249,7 +254,6 @@ const universities = [
'California School of Professional Psychology - Berkley/Alameda',
'California School of Professional Psychology - Fresno',
'California School of Professional Psychology - Los Angels',
'California School of Professional Psychology - San Diego',
'California State Polytechnic University - Pomona',
'California State University, Bakersfield',
'California State University, Channel Islands',
Expand Down Expand Up @@ -471,7 +475,6 @@ const universities = [
'DePaul University',
'DePauw University',
'DeSales University',
'Design Institute of San Diego',
'Detroit College of Business',
'Detroit College of Business - Flint',
'Detroit College of Business - Warren',
Expand Down Expand Up @@ -1357,8 +1360,6 @@ const universities = [
'Samford University',
'Sam Houston State University',
'Samuel Merritt College',
'San Diego State University',
'San Diego University for Integrative Studies',
'Sanford-Brown Institute',
'San Francisco Art Institute',
'San Francisco Conservatory of Music',
Expand Down Expand Up @@ -1842,7 +1843,6 @@ const universities = [
'University of Richmond',
'University of Rio Grande',
'University of Rochester',
'University of San Diego',
'University of San Francisco',
'University of Science and Arts of Oklahoma',
'University of Scranton',
Expand Down

0 comments on commit 054c7d1

Please sign in to comment.