diff --git a/src/components/Schedule/ScheduleTemplate/ScheduleTemplate.component.tsx b/src/components/Schedule/ScheduleTemplate/ScheduleTemplate.component.tsx index 6e7aab81..73550c6d 100644 --- a/src/components/Schedule/ScheduleTemplate/ScheduleTemplate.component.tsx +++ b/src/components/Schedule/ScheduleTemplate/ScheduleTemplate.component.tsx @@ -1,15 +1,22 @@ import React, { useMemo } from 'react'; import { useFieldArray, useFormContext } from 'react-hook-form'; import { useRecoilValue } from 'recoil'; -import { Button, DatePickerField, InputField, RadioButtonField, SelectField } from '@/components'; +import { + Button, + DatePickerField, + InputField, + RadioButtonField, + SelectField, + Textarea, +} from '@/components'; import { InputSize } from '@/components/common/Input/Input.component'; import * as Styled from './ScheduleTemplate.styled'; -import { $generations } from '@/store'; +import { $generations, $profile, $teams } from '@/store'; import { SelectOption } from '@/components/common/Select/Select.component'; import { SessionTemplate } from '../SessionTemplate'; import Plus from '@/assets/svg/plus-20.svg'; import { EventCreateRequest } from '@/types'; -import { LocationType, ScheduleFormValues } from '@/utils'; +import { LocationType, ScheduleFormValues, ScheduleType } from '@/utils'; import { useScript } from '@/hooks'; const DEFAULT_SESSION: EventCreateRequest = { @@ -26,8 +33,11 @@ const ScheduleTemplate = () => { const { register, control, formState, getValues, watch, setValue } = useFormContext(); const generations = useRecoilValue($generations); + const [position] = useRecoilValue($profile); + const teams = useRecoilValue($teams); const locationType = watch('locationType'); + const scheduleType = watch('scheduleType'); const { fields, append, remove } = useFieldArray({ name: 'sessions', @@ -46,6 +56,23 @@ const ScheduleTemplate = () => { const defaultOption = generationOptions.find( (option) => option.value === getValues('generationNumber')?.toString(), ); + + const generationPlatformOptions = teams.map(({ name }) => ({ + value: name.toUpperCase(), + label: name, + })); + + const getTeamSelectOptions = () => { + const myTeamOptionObject = generationPlatformOptions.find(({ value }) => value === position); + return myTeamOptionObject ? [myTeamOptionObject] : generationPlatformOptions; + }; + + const teamSelectOptions = getTeamSelectOptions(); + + const defaultPlatformOption = generationPlatformOptions.find( + (option) => option.value === getValues('schedulePlatformType'), + ); + const handleClickAddressSearch = () => { new window.daum.Postcode({ async oncomplete(data: { address: string }) { @@ -96,6 +123,37 @@ const ScheduleTemplate = () => { isFullWidth {...register('generationNumber', { required: true })} /> +
+ + 구분 + + + + + + + {scheduleType === ScheduleType.PLATFORM && ( + + )} +
{ )} +