-
Notifications
You must be signed in to change notification settings - Fork 0
평가하기 페이지 구현 (issue #263) #285
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
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ac7708a
feat : 평가하기 페이지 구현
layout-SY a568c95
feat : 스타일 수정 및 로직 변경
layout-SY 9155aeb
Merge branch 'develop' of https://github.com/devpalsPlus/frontend int…
layout-SY ee21c37
style: 스크롤 스타일 수정
layout-SY d42e966
feat : 평가하기 키 추가
layout-SY 6c33416
Merge branch 'develop' of https://github.com/devpalsPlus/frontend int…
layout-SY ab6862e
feat : 평가하기 조회 API 연결
layout-SY 9fb44d2
feat : 회원 평가하기 구현
layout-SY 5ea7829
Merge branch 'develop' of https://github.com/devpalsPlus/frontend int…
layout-SY 7744276
feat : API에 프로젝트 이름 추가
layout-SY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { apiEvaluatedUser } from '../models/evaluation'; | ||
| import { httpClient } from './http.api'; | ||
|
|
||
| export const postEvaluation = async (userEvaluation: apiEvaluatedUser) => { | ||
| try { | ||
| const response = await httpClient.post(`/evaluations`, userEvaluation); | ||
| return response.status; | ||
| } catch (e) { | ||
| console.error(e); | ||
| throw e; | ||
| } | ||
| }; | ||
|
|
||
| export const getEvaluation = async (projectId: number) => { | ||
| try { | ||
| const response = await httpClient.get(`/evaluations/${projectId}/members`); | ||
| return response.data.data; | ||
| } catch (e) { | ||
| console.error(e); | ||
| throw e; | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| import styled from 'styled-components'; | ||
| import Button from '../common/Button/Button'; | ||
|
|
||
| export const Container = styled.div` | ||
| display: flex; | ||
| width: 100%; | ||
| height: 100vh; | ||
| `; | ||
|
|
||
| export const SidebarLeft = styled.div` | ||
| width: 240px; | ||
| background-color: #fff; | ||
| border-right: 1px solid #e0e0e0; | ||
| padding: 20px; | ||
|
|
||
| @media (max-width: 1100px) { | ||
| width: 190px; | ||
| } | ||
| `; | ||
|
|
||
| export const ProjectName = styled.h2` | ||
| font-size: 20px; | ||
| margin-bottom: 20px; | ||
| `; | ||
|
|
||
| export const ParticipantButton = styled.button<{ $active?: boolean }>` | ||
| width: 100%; | ||
| padding: 10px; | ||
| margin-bottom: 10px; | ||
| background-color: ${({ $active }) => ($active ? '#2a3f5f' : '#3e5c7c')}; | ||
| color: ${({ theme }) => theme.color.white}; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| `; | ||
|
|
||
| export const MainContent = styled.div` | ||
| flex: 1; | ||
| display: flex; | ||
| flex-direction: column; | ||
| padding: 20px 40px 40px 40px; | ||
| `; | ||
|
|
||
| export const Header = styled.div` | ||
| @media (min-width: 1100px) { | ||
| display: flex; | ||
| align-items: center; | ||
| margin-bottom: 3px; | ||
| } | ||
|
|
||
| @media (max-width: 1100px) { | ||
| margin-bottom: 3px; | ||
| } | ||
| `; | ||
|
|
||
| export const Title = styled.h1` | ||
| flex: 1; | ||
| font-size: 24px; | ||
| margin: 0; | ||
| `; | ||
|
|
||
| export const MessageContainer = styled.div` | ||
| @media (min-width: 1100px) { | ||
| display: flex; | ||
| justify-content: right; | ||
| margin-bottom: 30px; | ||
| } | ||
|
|
||
| @media (max-width: 1100px) { | ||
| margin-bottom: 30px; | ||
| } | ||
| `; | ||
|
|
||
| export const ErrorMessage = styled.p` | ||
| font-size: 11px; | ||
| margin: 0 10px 0 0; | ||
| color: ${({ theme }) => theme.color.red}; | ||
| `; | ||
|
|
||
| export const SubmitButton = styled(Button)` | ||
| padding: 8px 16px; | ||
| font-size: 13px; | ||
| color: #fff; | ||
| cursor: pointer; | ||
| `; | ||
|
|
||
| export const ScrollArea = styled.div` | ||
| flex: 1; | ||
| overflow-y: auto; | ||
| padding-right: 16px; | ||
| padding-bottom: 70px; | ||
|
|
||
| &::-webkit-scrollbar { | ||
| width: 6px; | ||
| } | ||
| &::-webkit-scrollbar-track { | ||
| background: transparent; | ||
| } | ||
| &::-webkit-scrollbar-thumb { | ||
| background-color: rgba(0, 0, 0, 0.2); | ||
| border-radius: 4px; | ||
| } | ||
| `; | ||
|
|
||
| export const QuestionBlock = styled.div` | ||
| margin-bottom: 40px; | ||
| `; | ||
|
|
||
| export const QuestionHeader = styled.div` | ||
| background-color: #f0f0f0; | ||
| padding: 12px; | ||
| border-radius: 4px; | ||
| font-weight: 500; | ||
| margin-bottom: 16px; | ||
| `; | ||
|
|
||
| export const Options = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
| flex-wrap: wrap; | ||
| `; | ||
|
|
||
| export const Option = styled.label` | ||
| display: flex; | ||
| align-items: center; | ||
| margin-right: 24px; | ||
| margin-bottom: 6px; | ||
| `; | ||
|
|
||
| export const Radio = styled.input` | ||
| display: none; | ||
|
|
||
| &:checked + span { | ||
| background-color: #3e5c7c; | ||
| color: #fff; | ||
| } | ||
| `; | ||
|
|
||
| export const RadioLabel = styled.span` | ||
| display: inline-flex; | ||
| width: 32px; | ||
| height: 32px; | ||
| align-items: center; | ||
| justify-content: center; | ||
| border-radius: 50%; | ||
| background-color: #ddd; | ||
| margin-right: 8px; | ||
| cursor: pointer; | ||
| `; | ||
|
|
||
| export const OptionLabel = styled.span` | ||
| font-size: 14px; | ||
| color: #333; | ||
| `; | ||
|
|
||
| export const SidebarRight = styled.div` | ||
| width: 200px; | ||
| border-left: 1px solid #e0e0e0; | ||
| padding: 20px; | ||
| background-color: #fff; | ||
|
|
||
| @media (max-width: 1100px) { | ||
| width: 190px; | ||
| } | ||
| `; | ||
|
|
||
| export const CompletedTitle = styled.h3` | ||
| font-size: 18px; | ||
| margin-bottom: 20px; | ||
| `; | ||
|
|
||
| export const CompletedButton = styled.button<{ $active?: boolean }>` | ||
| width: 100%; | ||
| padding: 10px; | ||
| margin-bottom: 10px; | ||
| background-color: ${({ $active }) => ($active ? '#3e5c7c' : '#f0f0f0')}; | ||
| color: ${({ $active }) => ($active ? '#fff' : '#999')}; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: ${({ $active }) => ($active ? 'pointer' : 'default')}; | ||
| transition: background-color 0.2s; | ||
|
|
||
| &:hover { | ||
| background-color: ${({ $active }) => ($active ? '#2f4a6b' : '#e0e0e0')}; | ||
| } | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| import * as S from './EvaluationContent.styled'; | ||
| import ScrollPreventor from '../common/modal/ScrollPreventor'; | ||
| import useEvaluationStep from '../../hooks/evaluationHooks/useEvaluationStep'; | ||
| import { apiMemberList } from '../../models/evaluation'; | ||
| import { optionLabels, questions } from '../../constants/evaluation'; | ||
|
|
||
| interface EvaluationContentProps { | ||
| projectId: number; | ||
| memberList: apiMemberList[]; | ||
| } | ||
|
|
||
| const EvaluationContent = ({ | ||
| projectId, | ||
| memberList, | ||
| }: EvaluationContentProps) => { | ||
| const { | ||
| step, | ||
| notDone, | ||
| handleClickLeftUser, | ||
| handleClickOption, | ||
| handleNextStep, | ||
| currentScores, | ||
| isNotFill, | ||
| } = useEvaluationStep({ projectId, memberList }); | ||
|
|
||
| return ( | ||
| <ScrollPreventor> | ||
| <S.Container> | ||
| <S.SidebarLeft> | ||
| <S.ProjectName>프로젝트 이름</S.ProjectName> | ||
| {notDone.map((name, idx) => ( | ||
| <S.ParticipantButton | ||
| key={name.userId} | ||
| $active={step === idx} | ||
| onClick={() => handleClickLeftUser(idx)} | ||
| > | ||
| {name.nickname} | ||
| </S.ParticipantButton> | ||
| ))} | ||
| </S.SidebarLeft> | ||
|
|
||
| <S.MainContent> | ||
| <S.Header> | ||
| <S.Title>{notDone[step]?.nickname}님 평가하기</S.Title> | ||
| <S.SubmitButton | ||
| size='primary' | ||
| schema='primary' | ||
| radius='primary' | ||
| onClick={handleNextStep} | ||
| > | ||
| 제출하기 | ||
| </S.SubmitButton> | ||
| </S.Header> | ||
| <S.MessageContainer> | ||
| {isNotFill && ( | ||
| <S.ErrorMessage>모든 질문에 답변해주세요.</S.ErrorMessage> | ||
| )} | ||
| </S.MessageContainer> | ||
|
|
||
| <S.ScrollArea> | ||
| {questions.map((q, questionNumber) => ( | ||
| <S.QuestionBlock key={questionNumber}> | ||
| <S.QuestionHeader> | ||
| {questionNumber + 1}. {q} | ||
| </S.QuestionHeader> | ||
| <S.Options> | ||
| {optionLabels.map((label, optionValue) => ( | ||
| <S.Option key={optionValue}> | ||
| <S.Radio | ||
| type='radio' | ||
| name={`q${questionNumber}`} | ||
| id={`q${questionNumber}_o${optionValue}`} | ||
| checked={ | ||
| currentScores[questionNumber] === optionValue + 1 | ||
| } | ||
| onChange={() => | ||
| handleClickOption(questionNumber, optionValue) | ||
| } | ||
| value={optionValue + 1} | ||
| /> | ||
| <S.RadioLabel>{optionValue + 1}</S.RadioLabel> | ||
| <S.OptionLabel>{label}</S.OptionLabel> | ||
| </S.Option> | ||
| ))} | ||
| </S.Options> | ||
| </S.QuestionBlock> | ||
| ))} | ||
| </S.ScrollArea> | ||
| </S.MainContent> | ||
|
|
||
| <S.SidebarRight> | ||
| <S.CompletedTitle>평가완료</S.CompletedTitle> | ||
| {memberList | ||
| .filter((memberData) => memberData.evaluated) | ||
| .map((memberData) => ( | ||
| <S.CompletedButton>{memberData.nickname}</S.CompletedButton> | ||
| ))} | ||
| </S.SidebarRight> | ||
| </S.Container> | ||
| </ScrollPreventor> | ||
| ); | ||
| }; | ||
|
|
||
| export default EvaluationContent; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export const questions = [ | ||
| '다른 팀원에 비해 비상한 아이디어가 있었나요?', | ||
| '맡은 파트를 책임감 있게 한다고 생각하시나요', | ||
| '기술력이 좋다고 생각 하시나요?', | ||
| '다른 팀원들과의 협업이 잘 이루어졌다 생각 하시나요?', | ||
| '문제에 직면 했을 때 끈기 있게 해결 하려고 하나요?', | ||
| '참여자가 프로젝트에 성실히 임했다 생각 하시나요?', | ||
| ] as const; | ||
|
|
||
| export const optionLabels = [ | ||
| '매우그렇다', | ||
| '그렇다', | ||
| '보통이다', | ||
| '그렇지않다', | ||
| '매우그렇지않다', | ||
| ] as const; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.