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

[FE] refactor: 리뷰 상세페이지에서 변경된 API를 연동 #297

Merged
merged 14 commits into from
Aug 12, 2024
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
107 changes: 91 additions & 16 deletions frontend/src/mocks/mockData/detailedReviewMockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,101 @@ export const DETAILED_PAGE_MOCK_API_SETTING_VALUES = {
memberId: 2,
};

const ANSWER =
'림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. \n 바람은 여전히 그를 감싸며, 그의 마음 속 깊은 곳에 있는 꿈과 희망을 불러일으켰습니다.\n 림순은 미소 지으며 앞으로 나아갔습니다.림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. 림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. \n 바람은 여전히 그를 감싸며, 그의 마음 속 깊은 곳에 있는 꿈과 희망을 불러일으켰습니다.\n 림순은 미소 지으며 앞으로 나아갔습니다.림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. ';
const revieweeName = 'badahertz52';
Copy link
Contributor

Choose a reason for hiding this comment

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

상수는 UPPER_CASE로 작성해주세요!


export const DETAILED_REVIEW_MOCK_DATA: DetailReviewData = {
id: 123456,
createdAt: new Date('2024-07-16'),
revieweeName: 'badahertz52',
formId: 1,
revieweeName: revieweeName,
projectName: 'review-me',
contents: [
createdAt: '2024-05-05',
sections: [
{
id: 1,
question: '[공개] 동료의 개발 역량 향상을 위해 피드백을 남겨 주세요.',
answer: ANSWER,
sectionId: 1,
header: `💡 ${revieweeName}와 함께 한 기억을 떠올려볼게요.`,
questions: [
{
questionId: 1,
required: true,
questionType: 'CHECKBOX',
content: `프로젝트 기간 동안, ${revieweeName}의 강점이 드러났던 순간을 선택해주세요. (1~2개)`,
Copy link
Contributor

Choose a reason for hiding this comment

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

질문 내용 뒤에 (1~2개) 부분은 추후 제거하거나 하드코딩으로 명시해줘도 좋을 것 같아요.

optionGroup: {
optionGroupId: 1,
minCount: 1,
maxCount: 2,
options: [
{ optionId: 1, content: '🗣️ 커뮤니케이션, 협업 능력', isChecked: true },
{ optionId: 2, content: '💡 문제 해결 능력', isChecked: false },
],
},
},
],
},
{
sectionId: 2,
header: '이제 선택한 순간을 바탕으로 리뷰를 작성해볼게요',
questions: [
{
questionId: 2,
required: true,
questionType: 'CHECKBOX',
content: `${revieweeName}에서 어떤 부분이 인상 깊었는지 선택해주세요. (1개 이상)`,
optionGroup: {
optionGroupId: 1,
minCount: 1,
maxCount: 3,
options: [
{
optionId: 4,
content: '반대 의견을 내더라도 듣는 사람이 기분 나쁘지 않게 이야기해요.',
isChecked: true,
},
{ optionId: 5, content: '팀원들의 의견을 잘 모아서 회의가 매끄럽게 진행되도록 해요.', isChecked: true },
],
},
},
{
questionId: 3,
required: true,
questionType: 'TEXT',
content: '위에서 선택한 사항에 대해 조금 더 자세히 설명해주세요.',
optionGroup: null,
hasGuideline: true,
guideline: `상황을 자세하게 기록할수록 ${revieweeName}에게 도움이 돼요. OO 덕분에 팀이 원활한 소통을 이뤘거나, 함께 일하면서 배울 점이 있었는지 떠올려 보세요.`,
answer: '쑤쑤 쑤퍼노바 인상깊어요',
},
],
},
{
sectionId: 3,
header: '응원의 한마디를 남겨주세요',
questions: [
{
questionId: 4,
required: true,
questionType: 'TEXT',
content: `앞으로의 성장을 위해서 ${revieweeName}이 어떤 목표를 설정하면 좋을까요?`,
optionGroup: null,
hasGuideline: true,
guideline: `어떤 점을 보완하면 좋을지와 함께 '이렇게 해보면 어떨까?'하는 간단한 솔루션을 제안해봐요.`,
answer: '어디까지 성장할려구~?',
},
],
},
{
sectionId: 4,
header: '응원의 한마디를 남겨주세요',
questions: [
{
questionId: 5,
required: false,
questionType: 'TEXT',
content: `${revieweeName}에게 전하고 싶은 다른 리뷰가 있거나 응원의 말이 있다면 적어주세요.`,
optionGroup: null,
hasGuideline: false,
guideline: null,
answer: '응원합니다 화이팅!!',
},
],
},

{ id: 2, question: '[공개] 동료의 소프트 스킬의 성장을 위해 피드백을 남겨 주세요.', answer: ANSWER },
{ id: 3, question: '[비공개] 팀 동료로 근무한다면 같이 일 하고 싶은 개발자인가요?', answer: ANSWER },
],
keywords: [
{ id: 11, content: '친절해요' },
{ id: 22, content: '이야기를 잘 들어줘요.' },
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as S from './styles';
interface DetailedReviewPageContentsProps {
groupAccessCode: string;
}

const DetailedReviewPageContents = ({ groupAccessCode }: DetailedReviewPageContentsProps) => {
const { param: reviewId, queryString: memberId } = useSearchParamAndQuery({
paramKey: 'reviewId',
Expand All @@ -30,10 +31,17 @@ const DetailedReviewPageContents = ({ groupAccessCode }: DetailedReviewPageConte
handleClickToggleButton={() => console.log('click toggle ')}
/>
{/* 시연 때 숨김 <RevieweeComments comment={detailedReview.reviewerGroup.description} /> */}
{detailedReview.contents.map(({ id, question, answer }, index) => (
{/* {detailedReview.contents.map(({ id, question, answer }, index) => (
<ReviewSection key={id} question={question} answer={answer} index={index} />
))}
<KeywordSection keywords={detailedReview.keywords} index={detailedReview.contents.length} />
))} */}
Comment on lines +34 to +36
Copy link
Contributor

Choose a reason for hiding this comment

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

사용하지 않는 부분이라면 코드를 제거해도 좋겠네요.

{detailedReview.sections.map((section) =>
section.questions.map((question, index) => (
<S.ReviewContentContainer key={index}>
<ReviewSection question={question.content} answer={question.answer!} />
{question.questionType === 'CHECKBOX' && <KeywordSection options={question.optionGroup!.options} />}
</S.ReviewContentContainer>
)),
)}
</S.DetailedReviewPageContents>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ import styled from '@emotion/styled';

export const DetailedReviewPageContents = styled.div`
width: ${({ theme }) => theme.formWidth};
border: 0.1rem solid ${({ theme }) => theme.colors.lightPurple};
border-radius: ${({ theme }) => theme.borderRadius.basic};
`;

export const ReviewContentContainer = styled.div`
margin-bottom: 7rem;
padding: 0 4rem;
`;
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { Keyword } from '@/types';
import { Options } from '@/types';

import ReviewSectionHeader from '../ReviewSectionHeader';
// import ReviewSectionHeader from '../ReviewSectionHeader';

import * as S from './styles';

interface KeywordSectionProps {
keywords: Keyword[];
index: number;
options: Options[];
}
const KEY_WORD_HEADER = '키워드';

const KeywordSection = ({ keywords, index }: KeywordSectionProps) => {
const KeywordSection = ({ options }: KeywordSectionProps) => {
return (
<S.KeywordSection>
<ReviewSectionHeader number={index + 1} text={KEY_WORD_HEADER} />
<S.KeywordContainer>
{keywords.map(({ id, content }) => (
<S.KeywordBox key={id}>{content}</S.KeywordBox>
{options.map(({ optionId, content }) => (
<S.KeywordBox key={optionId}>{content}</S.KeywordBox>
))}
</S.KeywordContainer>
</S.KeywordSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import styled from '@emotion/styled';

export const KeywordSection = styled.section`
width: 100%;
margin-top: 3.2rem;
margin-top: 2rem;
`;

export const KeywordContainer = styled.div`
display: flex;
flex-wrap: wrap;
row-gap: 3.2rem;
row-gap: 2.5rem;
column-gap: 2.4rem;
`;

Expand All @@ -21,7 +21,7 @@ export const KeywordBox = styled.div`
height: fit-content;
padding: 0.8rem 2.5rem;
font-size: 1.6rem;
font-size: ${({ theme }) => theme.fontSize.small};
line-height: 2.4rem;
text-align: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ProjectImg, ReviewDate } from '@/components';
import { ProjectImgProps } from '@/components/common/ProjectImg';
import { ReviewDateProps } from '@/components/common/ReviewDate';

import LockToggle from '../LockToggle';
// import LockToggle from '../LockToggle';

import * as S from './styles';

Expand All @@ -19,9 +19,9 @@ const ReviewDescription = ({
thumbnailUrl,
projectName,
revieweeName,
isPublic,
// isPublic,
date,
handleClickToggleButton,
// handleClickToggleButton,
}: ReviewDescriptionProps) => {
return (
<S.Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ export const Description = styled.section`
justify-content: space-between;
width: 100%;
height: 6rem;
height: 9rem;
margin: 0;
padding-left: 0;
padding: 1rem 3rem;
background-color: ${({ theme }) => theme.colors.lightPurple};
border-radius: ${({ theme }) => theme.borderRadius.basic} 0 0;
`;

export const DescriptionSide = styled.div`
display: flex;
width: 100%;
`;

//NOTE: 6rem :깃헙 로고 사이즈
export const ProjectInfoContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -43,6 +49,7 @@ export const RevieweeNameAndDateContainer = styled.div`
export const RevieweeNameWrapper = styled.p`
margin-top: 0;
`;

export const RevieweeName = styled.span`
color: ${({ theme }) => theme.colors.primary};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import ReviewSectionHeader from '../ReviewSectionHeader';

import * as S from './styles';

const INDEX_OFFSET = 1;
// const INDEX_OFFSET = 1;
interface ReviewSectionProps {
question: string;
answer: string;
index: number;
}

const ReviewSection = ({ question, answer, index }: ReviewSectionProps) => {
const ReviewSection = ({ question, answer }: ReviewSectionProps) => {
return (
<S.ReviewSection>
<ReviewSectionHeader number={index + INDEX_OFFSET} text={question} />
<S.Answer>
<MultilineTextViewer text={answer} />
</S.Answer>
<ReviewSectionHeader text={question} />
{answer && (
<S.Answer>
<MultilineTextViewer text={answer} />
</S.Answer>
)}
</S.ReviewSection>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import * as S from './styles';

interface ReviewSectionHeaderProps {
number: number;
text: string;
}

const ReviewSectionHeader = ({ number, text }: ReviewSectionHeaderProps) => {
return (
<S.ReviewSectionHeader>
{number}. {text}
</S.ReviewSectionHeader>
);
const ReviewSectionHeader = ({ text }: ReviewSectionHeaderProps) => {
return <S.ReviewSectionHeader>{text}</S.ReviewSectionHeader>;
};

export default ReviewSectionHeader;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const Layout = styled.div`
display: flex;
flex-direction: column;
gap: 4rem;
width: 80%;
width: ${({ theme }) => theme.formWidth};
`;

export const ReviewSection = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SearchSection = ({ handleChange, options, placeholder }: SearchSectionProp
return (
<S.Container>
<S.SearchBox>
<SearchInput $width="48rem" $height="100%" placeholder={placeholder} />
<SearchInput $width="42rem" $height="100%" placeholder={placeholder} />
<Button styleType="secondary">검색</Button>
</S.SearchBox>
<DropDown onChange={handleChange} options={options} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const Container = styled.div`
height: 4rem;
button {
width: 9rem;
width: 8rem;
color: ${({ theme }) => theme.colors.primary};
}
`;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CSSProperties } from 'react';

import { ThemeProperty } from '../types';

export const formWidth = '65rem';
export const formWidth = '70rem';
export const sidebarWidth: ThemeProperty<string> = {
desktop: '25rem',
mobile: '100vw',
Expand Down
Loading