Skip to content

Commit

Permalink
임시 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
kikiyeom committed Mar 6, 2024
1 parent ed91558 commit 3567974
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,23 @@ const ScheduleTemplate = () => {
/>
</Styled.RadioButtonGroup>
{locationType === LocationType.OFFLINE && (
<Styled.InputWithButton>
<Styled.LocationWrapper>
<Styled.InputWithButton>
<InputField
$size="md"
placeholder="장소"
{...register('placeName', { required: locationType === LocationType.OFFLINE })}
/>
<Button shape="primaryLine" $size="md" onClick={handleClickAddressSearch}>
주소 검색
</Button>
</Styled.InputWithButton>
<InputField
$size="md"
placeholder="장소"
{...register('placeName', { required: locationType === LocationType.OFFLINE })}
placeholder="상세 주소를 입력해 주세요 (ex. 동, 호, 층 등)"
{...register('detailAddress')}
/>
<Button shape="primaryLine" $size="md" onClick={handleClickAddressSearch}>
주소 검색
</Button>
</Styled.InputWithButton>
</Styled.LocationWrapper>
)}
</div>
</Styled.ScheduleContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,16 @@ export const RequiredDot = styled.span`
export const RadioButtonGroup = styled.div`
display: flex;
gap: 2rem;
margin-bottom: 1rem;
margin-bottom: 0.6rem;
`;

export const InputWithButton = styled.div`
display: flex;
gap: 1rem;
`;

export const LocationWrapper = styled.div`
display: flex;
flex-direction: column;
gap: 0.6rem;
`;
1 change: 1 addition & 0 deletions src/pages/UpdateSchedule/UpdateSchedule.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const UpdateSchedule = () => {
const handleSubmitForm: SubmitHandler<ScheduleFormValues> = useRecoilCallback(
({ set }) =>
async (data) => {
console.log('updateScheduleRequest');
const updateScheduleRequest = parseFormValuesToScheduleRequest(data);

if (!scheduleId) {
Expand Down
7 changes: 5 additions & 2 deletions src/utils/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface ScheduleFormValues {
longitude: string;
placeName: string;
};
detailAddress?: string;
}

export const getScheduleStatusText = (status: ValueOf<typeof ScheduleStatus>) => {
Expand Down Expand Up @@ -73,8 +74,10 @@ export const parseScheduleResponseToFormValues = (
export const parseFormValuesToScheduleRequest = (
formValues: ScheduleFormValues,
): ScheduleCreateRequest | ScheduleUpdateRequest => {
const { generationNumber, date, sessions, name, locationType, locationInfo } = formValues;
const { generationNumber, date, sessions, name, locationType, locationInfo, detailAddress } =
formValues;

console.log(locationType, 'detailAddress', detailAddress, locationInfo);
const formattedDate = date.format('YYYY-MM-DD');

const eventsCreateRequests: EventCreateRequest[] = sessions.map((session) => ({
Expand All @@ -99,7 +102,7 @@ export const parseFormValuesToScheduleRequest = (
};

if (locationType === LocationType.OFFLINE && locationInfo) {
scheduleRequest.address = locationInfo.address;
scheduleRequest.address = `${locationInfo.address}${detailAddress ? `(${detailAddress})` : ''}`;
scheduleRequest.latitude = Number(locationInfo.latitude);
scheduleRequest.longitude = Number(locationInfo.longitude);
scheduleRequest.placeName = locationInfo.placeName;
Expand Down

0 comments on commit 3567974

Please sign in to comment.