+
+
+ {editingProfile && (
+
+ {(field) => {
+ return (
+
+
+
+ field.handleChange(value)
+ }
+ />
+
+
+
+ );
+ }}
+
+ )}
+ {!editingProfile && (
+
+ {student.school
+ ? `${student.school.name} (${
+ student.school.level
+ ? student.school.level
+ .charAt(0)
+ .toUpperCase() +
+ student.school.level.slice(1).toLowerCase()
+ : ""
+ })`
+ : "N/A"}
+
+ )}
+ {/*
*/}
+
+
+
+ {!editingProfile && (
+
+ {student.programs?.length > 0
+ ? student.programs.map((p) => p.name).join(", ")
+ : "None"}
+
+ )}
+ {editingProfile && (
+
+ {(field) => {
+ const selected = (field.state.value ?? []).map(
+ (p) => ({
+ value: p,
+ label:
+ programOptions.find((val) => val.value === p)
+ ?.label ||
+ programLabelCache.current.get(p) ||
+ "",
+ }),
+ );
+ return (
+
+
+
+ field.handleChange(
+ opts.map(
+ (o) => o.value as Id<"programs">,
+ ),
+ )
+ }
+ defaultOptions={programOptions}
+ options={programOptions}
+ placeholder="Select your programs"
+ commandProps={{
+ label: "Select programs",
+ shouldFilter: false,
+ }}
+ inputProps={{
+ onValueChange: (value: string) => {
+ setProgramSearchInput(value);
+ },
+ }}
+ emptyIndicator={
+
+ No programs found
+
+ }
+ />
+
+
+
+ );
+ }}
+
+ )}
+
+ {/*
*/}
+
+
+
+ {editingProfile && (
+
+ {/* startingDate.term */}
+
+ {(field) => (
+
+ )}
+
+ {/* startingDate.year */}
+
+ {(field) => (
+
+ )}
+
+
+ )}
+ {!editingProfile && (
+
+ {student.startingDate
+ ? `${student.startingDate.term.charAt(0).toUpperCase()}${student.startingDate.term.slice(1)} ${student.startingDate.year}`
+ : "N/A"}
+
+ )}
+
+
+
+ {editingProfile && (
+
+ {/* expectedGraduationDate.term */}
+
+ {(field) => (
+
+ )}
+
+ {/* expectedGraduationDate.year */}
+
+ {(field) => (
+
+ )}
+
+
+ )}
+ {!editingProfile && (
+
+ {student.expectedGraduationDate
+ ? `${student.expectedGraduationDate.term.charAt(0).toUpperCase()}${student.expectedGraduationDate.term.slice(1)} ${student.expectedGraduationDate.year}`
+ : "N/A"}
+
+ )}
+
+
+