|
|
@ -58,101 +58,102 @@ export default function ContributeQuestionForm({
|
|
|
|
setCanSubmit(checked);
|
|
|
|
setCanSubmit(checked);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<form
|
|
|
|
<div className="flex flex-col justify-between gap-4">
|
|
|
|
className="flex flex-1 flex-col items-stretch justify-center gap-y-4"
|
|
|
|
<form
|
|
|
|
onSubmit={handleSubmit(onSubmit)}>
|
|
|
|
className="flex flex-1 flex-col items-stretch justify-center gap-y-4"
|
|
|
|
<div className="min-w-[113px] max-w-[113px] flex-1">
|
|
|
|
onSubmit={handleSubmit(onSubmit)}>
|
|
|
|
<Select
|
|
|
|
<div className="min-w-[113px] max-w-[113px] flex-1">
|
|
|
|
defaultValue="coding"
|
|
|
|
<Select
|
|
|
|
label="Type"
|
|
|
|
defaultValue="coding"
|
|
|
|
options={QUESTION_TYPES}
|
|
|
|
label="Type"
|
|
|
|
required={true}
|
|
|
|
options={QUESTION_TYPES}
|
|
|
|
{...selectRegister('questionType')}
|
|
|
|
required={true}
|
|
|
|
/>
|
|
|
|
{...selectRegister('questionType')}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<TextArea
|
|
|
|
|
|
|
|
label="Question Prompt"
|
|
|
|
|
|
|
|
placeholder="Contribute a question"
|
|
|
|
|
|
|
|
required={true}
|
|
|
|
|
|
|
|
rows={5}
|
|
|
|
|
|
|
|
{...register('questionContent')}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<HorizontalDivider />
|
|
|
|
|
|
|
|
<h2 className="text-md text-primary-800 font-semibold">
|
|
|
|
|
|
|
|
Additional information
|
|
|
|
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
<div className="flex flex-col flex-wrap items-stretch gap-2 sm:flex-row sm:items-end">
|
|
|
|
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
|
|
|
|
<Controller
|
|
|
|
|
|
|
|
control={control}
|
|
|
|
|
|
|
|
name="location"
|
|
|
|
|
|
|
|
render={({ field }) => (
|
|
|
|
|
|
|
|
<LocationTypeahead
|
|
|
|
|
|
|
|
required={true}
|
|
|
|
|
|
|
|
onSelect={(option) => {
|
|
|
|
|
|
|
|
field.onChange(option.value);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
{...field}
|
|
|
|
|
|
|
|
value={LOCATIONS.find(
|
|
|
|
|
|
|
|
(location) => location.value === field.value,
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
<TextArea
|
|
|
|
<Controller
|
|
|
|
label="Question Prompt"
|
|
|
|
control={control}
|
|
|
|
placeholder="Contribute a question"
|
|
|
|
name="date"
|
|
|
|
required={true}
|
|
|
|
render={({ field }) => (
|
|
|
|
rows={5}
|
|
|
|
<MonthYearPicker
|
|
|
|
{...register('questionContent')}
|
|
|
|
monthRequired={true}
|
|
|
|
/>
|
|
|
|
value={{
|
|
|
|
<HorizontalDivider />
|
|
|
|
month: ((field.value.getMonth() as number) + 1) as Month,
|
|
|
|
<h2 className="text-md text-primary-800 font-semibold">
|
|
|
|
year: field.value.getFullYear(),
|
|
|
|
Additional information
|
|
|
|
}}
|
|
|
|
</h2>
|
|
|
|
yearRequired={true}
|
|
|
|
<div className="flex flex-col flex-wrap items-stretch gap-2 sm:flex-row sm:items-end">
|
|
|
|
onChange={({ month, year }) =>
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
field.onChange(startOfMonth(new Date(year, month - 1)))
|
|
|
|
<Controller
|
|
|
|
}
|
|
|
|
control={control}
|
|
|
|
/>
|
|
|
|
name="location"
|
|
|
|
)}
|
|
|
|
render={({ field }) => (
|
|
|
|
/>
|
|
|
|
<LocationTypeahead
|
|
|
|
</div>
|
|
|
|
required={true}
|
|
|
|
</div>
|
|
|
|
onSelect={(option) => {
|
|
|
|
<div className="flex flex-col flex-wrap items-stretch gap-2 sm:flex-row sm:items-end">
|
|
|
|
field.onChange(option.value);
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
}}
|
|
|
|
<Controller
|
|
|
|
{...field}
|
|
|
|
control={control}
|
|
|
|
value={LOCATIONS.find(
|
|
|
|
name="company"
|
|
|
|
(location) => location.value === field.value,
|
|
|
|
render={({ field }) => (
|
|
|
|
)}
|
|
|
|
<CompanyTypeahead
|
|
|
|
/>
|
|
|
|
required={true}
|
|
|
|
)}
|
|
|
|
onSelect={({ id }) => {
|
|
|
|
/>
|
|
|
|
field.onChange(id);
|
|
|
|
</div>
|
|
|
|
}}
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
/>
|
|
|
|
<Controller
|
|
|
|
)}
|
|
|
|
control={control}
|
|
|
|
/>
|
|
|
|
name="date"
|
|
|
|
|
|
|
|
render={({ field }) => (
|
|
|
|
|
|
|
|
<MonthYearPicker
|
|
|
|
|
|
|
|
monthRequired={true}
|
|
|
|
|
|
|
|
value={{
|
|
|
|
|
|
|
|
month: ((field.value.getMonth() as number) + 1) as Month,
|
|
|
|
|
|
|
|
year: field.value.getFullYear(),
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
yearRequired={true}
|
|
|
|
|
|
|
|
onChange={({ month, year }) =>
|
|
|
|
|
|
|
|
field.onChange(startOfMonth(new Date(year, month - 1)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[200px]">
|
|
|
|
<div className="flex flex-col flex-wrap items-stretch gap-2 sm:flex-row sm:items-end">
|
|
|
|
<Controller
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[300px]">
|
|
|
|
control={control}
|
|
|
|
<Controller
|
|
|
|
name="role"
|
|
|
|
control={control}
|
|
|
|
render={({ field }) => (
|
|
|
|
name="company"
|
|
|
|
<RoleTypeahead
|
|
|
|
render={({ field }) => (
|
|
|
|
required={true}
|
|
|
|
<CompanyTypeahead
|
|
|
|
onSelect={(option) => {
|
|
|
|
required={true}
|
|
|
|
field.onChange(option.value);
|
|
|
|
onSelect={({ id }) => {
|
|
|
|
}}
|
|
|
|
field.onChange(id);
|
|
|
|
{...field}
|
|
|
|
}}
|
|
|
|
value={ROLES.find((role) => role.value === field.value)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className="flex-1 sm:min-w-[150px] sm:max-w-[200px]">
|
|
|
|
|
|
|
|
<Controller
|
|
|
|
|
|
|
|
control={control}
|
|
|
|
|
|
|
|
name="role"
|
|
|
|
|
|
|
|
render={({ field }) => (
|
|
|
|
|
|
|
|
<RoleTypeahead
|
|
|
|
|
|
|
|
required={true}
|
|
|
|
|
|
|
|
onSelect={(option) => {
|
|
|
|
|
|
|
|
field.onChange(option.value);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
{...field}
|
|
|
|
|
|
|
|
value={ROLES.find((role) => role.value === field.value)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/* <div className="w-full">
|
|
|
|
{/* <div className="w-full">
|
|
|
|
|
|
|
|
<HorizontalDivider />
|
|
|
|
<HorizontalDivider />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<h1 className="mb-3">
|
|
|
|
<h1 className="mb-3">
|
|
|
@ -171,6 +172,7 @@ export default function ContributeQuestionForm({
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div> */}
|
|
|
|
</div> */}
|
|
|
|
|
|
|
|
</form>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
className="bg-primary-50 flex w-full flex-col gap-y-2 py-3 shadow-[0_0_0_100vmax_theme(colors.primary.50)] sm:flex-row sm:justify-between"
|
|
|
|
className="bg-primary-50 flex w-full flex-col gap-y-2 py-3 shadow-[0_0_0_100vmax_theme(colors.primary.50)] sm:flex-row sm:justify-between"
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
@ -199,6 +201,6 @@ export default function ContributeQuestionForm({
|
|
|
|
variant="primary"></Button>
|
|
|
|
variant="primary"></Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|