Skip to content

Commit

Permalink
Merge pull request #203 from woowacourse-teams/feat/#202
Browse files Browse the repository at this point in the history
모임 상태 타입 변경, MoimInfo 타입추가, 라우팅 수정
  • Loading branch information
jaeml06 authored Aug 5, 2024
2 parents eb1abad + 6280b9a commit a4d4ff3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 21 deletions.
2 changes: 1 addition & 1 deletion frontend/src/apis/deletes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ApiClient from './apiClient';
import { checkStatus } from './apiconfig';

export const deleteCancelChamyo = async (moimId: number) => {
const response = await ApiClient.deleteWithAuth(`moim/${moimId}/comment`, {
const response = await ApiClient.deleteWithAuth(`chamyo`, {
moimId,
});
await checkStatus(response);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { shapes } from '@_components/Button/Button.style';

interface ButtonProps {
shape: 'circle' | 'bar';
onClick: () => void;
onClick?: () => void;
disabled: boolean;
children: ReactNode;
}
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default function LoginForm() {
e.preventDefault();

const response = await login({ nickname });
console.log(response);
setToken(response.data.accessToken);
navigate(ROUTES.main);
};
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/MoimCardList/MoimCardList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const Default: Story = {
date: '2021-10-30',
time: '19:00',
place: '서울 마포구 독막로 96 1층',
status: 'MOIMING',
comments: [],
maxPeople: 5,
currentPeople: 3,
isZzimed: true,
Expand Down Expand Up @@ -112,6 +114,7 @@ export const Default: Story = {
profile: 'https://avatars.githubusercontent.com/u/78939596?v=4',
role: 'moimee',
},

],
description: '코딩하면서 놀아요',
status: 'MOIMING',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Default: Story = {
moimInfo: {
title: '풋살 할 사람?',
authorNickname: `괘안나`,
status: 'COMPLETE',
status: 'COMPLETED',
},
},
render: (args) => <MoimSummary {...args} />,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/ProfileList/ProfileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface ProfileListProps {
export default function ProfileList(props: ProfileListProps) {
const theme = useTheme();
const { participants } = props;
console.log(participants);
return (
<Fragment>
<div css={theme.typography.s1}>참여자</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export const RecruitingTag: Story = {

export const RecruitingCanceledTag: Story = {
args: {
status: 'CANCEL',
status: 'CANCELED',
},
render: (args) => <Tag {...args} />,
};

export const RecruitingCompletedTag: Story = {
args: {
status: 'COMPLETE',
status: 'COMPLETED',
},
render: (args) => <Tag {...args} />,
};
4 changes: 2 additions & 2 deletions frontend/src/components/Tag/Tag.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { css, Theme } from '@emotion/react';

interface TagBoxProps {
theme: Theme;
status: 'MOIMING' | 'COMPLETE' | 'CANCEL';
status: 'MOIMING' | 'COMPLETED' | 'CANCELED';
}
export const tagBox = (props: TagBoxProps) => {
const { theme, status } = props;
Expand All @@ -17,7 +17,7 @@ export const tagBox = (props: TagBoxProps) => {
color: ${theme.colorPalette.white[100]};
background-color: ${status === 'CANCEL'
background-color: ${status === 'CANCELED'
? theme.colorPalette.red[400]
: status === 'MOIMING'
? theme.colorPalette.green[200]
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { HTMLProps } from 'react';
import { useTheme } from '@emotion/react';

interface TagProps extends HTMLProps<HTMLDivElement> {
status: 'MOIMING' | 'COMPLETE' | 'CANCEL';
status: 'MOIMING' | 'COMPLETED' | 'CANCELED';
}

export default function Tag(props: TagProps) {
const theme = useTheme();
const { status } = props;
return (
<div css={S.tagBox({ theme, status })}>
{status === 'CANCEL'
{status === 'CANCELED'
? '모임 취소'
: status === 'MOIMING'
? '모임중'
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/MoimCreationPage/MoimCreationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useAddMoim from '@_hooks/mutaions/useAddMoim';
import useMoimInfoInput from './MoimCreatePage.hook';
import { useNavigate } from 'react-router-dom';
import { useState } from 'react';
import ROUTES from '@_constants/routes';

export default function MoimCreationPage() {
const navigate = useNavigate();
Expand All @@ -27,7 +28,7 @@ export default function MoimCreationPage() {

return (
<FormLayout>
<FormLayout.Header onBackArrowClick={() => navigate(-1)}>
<FormLayout.Header onBackArrowClick={() => navigate(ROUTES.main)}>
모임등록하기
</FormLayout.Header>

Expand Down
23 changes: 15 additions & 8 deletions frontend/src/pages/MoimDetailPage/MoimDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default function MoimDetailPage() {
const { mutate: ReopenMoim } = useReopenMoim();
const { mutate: completeMoim } = useCompleteMoin();
const { mutate: cancelChamyo } = useCancelChamyo();
console.log(moim, role, participants);

if (
isLoading ||
Expand All @@ -59,7 +58,7 @@ export default function MoimDetailPage() {
<InformationLayout>
<InformationLayout.Header>
<InformationLayout.Header.Left>
<div onClick={() => navigate(-1)}>
<div onClick={() => navigate(ROUTES.main)}>
<BackLogo />
</div>
</InformationLayout.Header.Left>
Expand Down Expand Up @@ -119,7 +118,11 @@ export default function MoimDetailPage() {
모집 완료하기
</Button>
) : (
<Button shape="bar" disabled={false} onClick={() => navigate(-1)}>
<Button
shape="bar"
disabled={false}
onClick={() => navigate(ROUTES.chat)}
>
채팅방 열기(이동하기)
</Button>
)
Expand All @@ -128,21 +131,25 @@ export default function MoimDetailPage() {
<Button shape="bar" disabled={false} onClick={() => mutate(moimId)}>
참여하기
</Button>
) : moim.status === 'COMPLETE' ? (
<Button shape="bar" disabled={true} onClick={() => navigate(-1)}>
) : moim.status === 'COMPLETED' ? (
<Button shape="bar" disabled={true}>
모집이 완료되었어요
</Button>
) : (
<Button shape="bar" disabled={true} onClick={() => navigate(-1)}>
<Button shape="bar" disabled={true}>
취소된 모임이예요
</Button>
)
) : moim.status === 'MOIMING' ? (
<Button shape="bar" disabled={true} onClick={() => navigate(-1)}>
<Button shape="bar" disabled={true}>
기다려 임마
</Button>
) : (
<Button shape="bar" disabled={false} onClick={() => navigate(-1)}>
<Button
shape="bar"
disabled={false}
onClick={() => navigate(ROUTES.chat)}
>
채팅방으로 가기
</Button>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface MoimInfo {
authorNickname: string;
participants: Participation[];
description?: string;
status: 'MOIMING' | 'COMPLETE' | 'CANCEL';
status: 'MOIMING' | 'COMPLETED' | 'CANCELED';
comments: Comment[];
isZzimed: boolean;
}
Expand Down

0 comments on commit a4d4ff3

Please sign in to comment.