Skip to content

Commit

Permalink
fix: feelStatus name feel로 되어 있는 것 field 수정 및 mock data로 확인
Browse files Browse the repository at this point in the history
  • Loading branch information
cindy committed Feb 12, 2023
1 parent 837e180 commit fff49ea
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
8 changes: 8 additions & 0 deletions src/constants/dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ export const MOCK_FLAVORS: IFlavor[] = [
id: 3,
content: '쓴 맛이 나요',
},
{
id: 4,
content: '쓴 맛이 나요',
},
{
id: 5,
content: '쓴 맛이 나요',
},
];

export const MOCK_COUNTRY: ICountry = {
Expand Down
28 changes: 14 additions & 14 deletions src/pages/reviews/create/[beerId].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const CreateReviewPage: NextPage<CreateReviewPageProps> = ({ beer, review }) =>
<StyledUpsertRecordContainer>
<Header leftExtras={<BackButton />} />
<StyledSwiperLayout>
<ReviewFeelStatusContainer beerName={beer.korName} defaultFeelValue={review?.feelStatus} />
<ReviewFlavorsContainer beerName={beer.korName} defaultFlavorValue={review?.flavors} />
<ReviewFeelStatusContainer beerName={beer?.korName} defaultFeelValue={review?.feelStatus} />
<ReviewFlavorsContainer beerName={beer?.korName} defaultFlavorValue={review?.flavors} />
<ReviewDetailContainer beer={beer} review={review} />
</StyledSwiperLayout>
</StyledUpsertRecordContainer>
Expand All @@ -42,18 +42,18 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
const { beerId, reviewId } = context.query;
const id = reviewId || beerId;

if (id && typeof id === 'string' && Number(id)) {
if (reviewId) {
const review = await getReview(Number(id));
const beer = await getBeer(review.beer.id);

return { props: { beer, review } };
}

const beer = await getBeer(Number(id));

return { props: { beer } };
}
// if (id && typeof id === 'string' && Number(id)) {
// if (reviewId) {
// const review = await getReview(Number(id));
// const beer = await getBeer(review.beer.id);
//
// return { props: { beer, review } };
// }
//
// const beer = await getBeer(Number(id));
//
// return { props: { beer } };
// }

return { props: {} };
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ const ReviewDetailContainer: React.FC<RecordThirdStepContainerProps> = ({
{
...reviewForm,
...data,
beerId: beer.id,
beerId: beer?.id,
} as ICreateReviewPayload,
{ onSuccess: (_data) => router.push(`/record/ticket/${_data.id}?type=${NEW_TYPE}`) },
);
},
[createReviewMutation, reviewForm, beer.id, router],
[createReviewMutation, reviewForm, beer?.id, router],
);

// const handleUpdateSubmit = useCallback(
Expand Down Expand Up @@ -111,7 +111,7 @@ const ReviewDetailContainer: React.FC<RecordThirdStepContainerProps> = ({
>
<StyledWrapper>
<h2>{'당신만의 맥주 이야기도 들려주세요'}</h2>
<p className="body-1">{beer.korName}</p>
<p className="body-1">{beer?.korName}</p>
<ImageUploadField
name="imageUrl"
beer={beer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ReviewFeelStatusContainer: React.FC<ReviewFeelStatusContainerProps> = ({
>
<StyledTitle>이번 맥주는 어땠나요?</StyledTitle>
<StyledBeerName>{beerName}</StyledBeerName>
<StyledEmojiRadioField name="feel" />
<StyledEmojiRadioField name="feelStatus" />
<BottomFloatingButtonArea
button={
<FormSubmitButton type="primary" htmlType="submit" width="large" autoDisabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MultiSelectField from '@/components/formFields/MultiSelectField';
import FormSubmitButton from '@/components/FormSubmitButton';
import Icon from '@/components/Icon';
import { SwiperLayoutChildProps } from '@/components/layouts/SwiperLayout';
import { MOCK_FLAVORS as flavors } from '@/constants/dummy';
import $reviewForm from '@/recoil/atoms/reviewForm';
import { IFeelStatus } from '@/types';

Expand All @@ -28,7 +29,8 @@ const ReviewFlavorsContainer: React.FC<RecordSecondStepContainerProps> = ({
onMovePrev,
onMoveNext,
}) => {
const { data: flavors } = useGetFlavors();
// @TODO: API 정상 호출되면 Mock data 제거
// const { data: flavors } = useGetFlavors();
const [{ feelStatus }, setRecordForm] = useRecoilState($reviewForm);

const flavorOptions = useMemo(
Expand Down

0 comments on commit fff49ea

Please sign in to comment.