Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New title #140

Merged
merged 10 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/AddMatch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe("Test", () => {
render(<AddMatch />);

await fireAntEvent.actAndSetDate(screen.getByTestId("gameDate"), "Now");
await fireAntEvent.actAndInput("제목을 입력해주세요.", "1자리 남음");
await fireAntEvent.actAndInput("경기장을 입력해주세요.", "용산 더베이스");
await fireAntEvent.actAndInput("멤버수를 입력해주세요.", "20");
await fireAntEvent.actAndSelect(screen.getByTestId("genderSelect"), "혼성");
Expand All @@ -43,6 +44,7 @@ describe("Test", () => {
const match = firebase
.firestore()
.collection(CollectionName.matchesCollectionName).add.mock.calls[0][0];
expect(match.title).toBe("1자리 남음"); // 장소가 "1자리 남음"이 맞는지 확인
expect(match.place).toBe("용산 더베이스"); // 장소가 "용산 더베이스"이 맞는지 확인
expect(match.memberCount).toBe(20); // 인원수가 20이 맞는지 확인
expect(match.gender).toBe("혼성"); // 성별이 혼성이 맞는지 확인
Expand All @@ -66,6 +68,7 @@ describe("Test", () => {
dateTime: {
toDate: jest.fn().mockReturnValue(new Date("2021-01-01")),
},
title: "1자리 남음",
place: "용산 더베이스",
memberCount: 15,
gender: "여성",
Expand Down Expand Up @@ -113,6 +116,7 @@ describe("Test", () => {
dateTime: {
toDate: jest.fn().mockReturnValue(new Date("2021-01-01")),
},
title: "1자리 남음",
place: "용산 더베이스",
memberCount: 15,
gender: "여성",
Expand Down
23 changes: 23 additions & 0 deletions src/components/AddMatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const AddMatch = (props: { id: string }): JSX.Element => {
const history = useHistory();

const [gameDate, setGameDate] = useState<Moment | null>(null);
const [title, setTitle] = useState("");
const [place, setPlace] = useState("");
const [memberCount, setMemberCount] = useState(18);
const [gender, setGender] = useState<Gender>("남성");
Expand Down Expand Up @@ -52,6 +53,7 @@ const AddMatch = (props: { id: string }): JSX.Element => {
const match = doc.data();
if (!match) return;
setGameDate(moment(match.dateTime.toDate()));
setTitle(match.title);
setPlace(match.place);
setMemberCount(match.memberCount);
setGender(match.gender);
Expand All @@ -64,6 +66,10 @@ const AddMatch = (props: { id: string }): JSX.Element => {
})();
}, [history, id]);

const changeTitle = (e: React.FormEvent<HTMLInputElement>) => {
jiji14 marked this conversation as resolved.
Show resolved Hide resolved
setTitle(e.currentTarget.value);
};

const changePlace = (e: React.FormEvent<HTMLInputElement>) => {
setPlace(e.currentTarget.value);
};
Expand Down Expand Up @@ -139,13 +145,18 @@ const AddMatch = (props: { id: string }): JSX.Element => {
window.alert("매치 일시를 선택해주세요.");
return null;
}
if (title.length < 1) {
jiji14 marked this conversation as resolved.
Show resolved Hide resolved
window.alert("제목을 입력해주세요.");
return null;
}
if (place.length < 1) {
window.alert("매치 장소를 입력해주세요.");
return null;
}

const match: Match = {
dateTime: gameDate.toDate(),
title,
place,
memberCount,
gender,
Expand Down Expand Up @@ -177,6 +188,18 @@ const AddMatch = (props: { id: string }): JSX.Element => {
/>
</Col>
</Row>
<Row align="middle" className="row">
<Col span={6} className="addMatchSubtitle">
제목
</Col>
<Col span={18}>
<Input
onChange={changeTitle}
value={title}
placeholder="제목을 입력해주세요."
/>
</Col>
</Row>
<Row align="middle" className="row">
<Col span={6} className="addMatchSubtitle">
경기장
Expand Down
4 changes: 3 additions & 1 deletion src/components/MatchList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe("Test", () => {
.fn()
.mockReturnValue(new Date("2021-12-01")),
},
title: "1자리 남음",
place: "용산 더베이스",
memberCount: 15,
gender: "여성",
Expand All @@ -74,7 +75,7 @@ describe("Test", () => {

render(<MatchList recurringClasses={false} />);
await waitFor(async () => {
expect(screen.getByText(/용산 더베이스/i)).toBeInTheDocument();
expect(screen.getByText(/1자리 남음/i)).toBeInTheDocument();
expect(screen.getByText(/여성/i)).toBeInTheDocument();
//jsdom toLocaleDateString issue - https://github.com/jsdom/jsdom/issues/1489
//jest 테스트환경 브라우저에서는 toLocaleDateString(ko-KR) 지원하지 않아서 테스트에서 영어로 확인해야됨.
Expand Down Expand Up @@ -124,6 +125,7 @@ describe("Test", () => {
.fn()
.mockReturnValue(new Date("2021-12-01")),
},
title: "1자리 남음",
place: "신사 누리",
memberCount: 15,
gender: "혼성원팀",
Expand Down
7 changes: 5 additions & 2 deletions src/components/MatchListItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
color: var(--black-color);
font-size: 18px;
}
.place {
.infoTitle {
color: var(--black-color);
font-size: 14px;
margin-bottom: 4px;
Expand All @@ -18,9 +18,12 @@
color: var(--grey-color);
atn832 marked this conversation as resolved.
Show resolved Hide resolved
}
.info {
margin-right: 4px;
margin-right: 8px;
atn832 marked this conversation as resolved.
Show resolved Hide resolved
font-size: 12px;
}
.highlight {
color: var(--orange-color);
}
.alignRight {
display: flex;
justify-content: flex-end;
Expand Down
5 changes: 4 additions & 1 deletion src/components/MatchListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ const MatchListItem = (matchProps: {
</div>
</Col>
<Col span={12}>
<div className="place">{match.place}</div>
<div className="infoTitle">{match.title}</div>
<div className="infoContainer">
<div className="info">{match.gender}</div>
{match.isRecurringClass && (
<div className="info highlight">{match.place}</div>
)}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기획반일때만 장소 보이도록 요청해서 수정했어~ (왜냐면 일반 매치는 제목 = 장소일거라서 한번만 보여주면 될거야!)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이상해. 그럼 경기도 제목 말고 match.place에 보이는게 어때? 똑같은 정보 인데 다른 곳에 보이면 좀 헷갈려. 코치님이랑 다시 확인 할수 있어? 강하게 반대 하면 코치님이 원하는대로 괜찮아.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 UI만 아니라 코드 지저분 해져. 나중에 다른 개발자가 이거 읽으면 왜 UI다르는지 이해 못 할거야.

</div>
</Col>
<Col span={6} className="alignRight">
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type Status = "신청가능" | "예약신청" | "취소신청" | "확정"
export interface Match {
id?: string;
dateTime: Date | null;
title: string;
place: string;
memberCount: number;
gender: Gender;
Expand Down