-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: 리뷰 좋아요, 신고하기 기능 추가 #537
Merged
The head ref may contain hidden characters: "528-feat-\uB9AC\uBDF0-\uC88B\uC544\uC694-\uC2E0\uACE0\uD558\uAE30-\uAE30\uB2A5-\uCD94\uAC00"
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
51031d1
feat: 리뷰 api 수정으로 인한 타입 수정 및 api 요청 코드 추가 (#528)
turtle601 e0fdb5f
feat: 명세 수정으로 인한 목데이터 수정 (#528)
turtle601 8e37964
feat: 리뷰 좋아요 및 신고하기 관련 기능 훅 구현(#528)
turtle601 0947225
refactor: 리뷰 레이아웃에 사용될 아이콘 추가 (#528)
turtle601 e607063
feat: RestaurantItem 컴포넌트 기능 추가 및 구현 (#528)
turtle601 14be6f2
refactor: RestaurantReviewList 컴포넌트 스토리북 오류 및 레이아웃 수정 (#528)
turtle601 1f3ea41
feat: 리뷰 좋아요 시 좋아요 숫자도 동시에 올라가는 기능 구현(#528)
turtle601 d0d2077
feat: 신고하기 관련 모달 폼 구현 및 기능 구현(#528)
turtle601 46047b4
fix: 명세와 다른 키 값 수정 (#528)
turtle601 3c9efef
feat: ReviewModalProvider에 있는 update, create, delete 함수 추상화 (#528)
turtle601 e410b2e
refactor: ReviewForm index 파일 추가 (#528)
turtle601 fe69fc7
refactor: ReviewFormType 생성 (#528)
turtle601 6a210dd
refactor: 중복되는 네이밍(onSuccess)으로 인한 코드 수정 (#528)
turtle601 1028c19
refactor: REVIEW_FORM_TITLE 변수 생성 및 코드 수정 (#528)
turtle601 6ee2702
refactor: ReviewSubmitButtonType 타입 추가 (#528)
turtle601 a76c983
style: import type 위치 제일 하단에 위치하기(#528)
turtle601 a29e72a
refactor: create, update 함수를 submit관련 함수로 통합(#528)
turtle601 16b22f8
refactor: 별표 관련 아이콘 저장 (#539)
turtle601 7dc3bca
feat: Star 컴포넌트 구현(#539)
turtle601 4340b18
feat: StarRating 컴포넌트 구현 (#539)
turtle601 9527fc7
refactor: svg 파일 사이즈 수정 (#539)
turtle601 7fb11c4
feat: 별점 기능 구현 (#539)
turtle601 ee9fde6
feat: ImageForm 컴포넌트 구현 (#539)
turtle601 204188c
feat: ReviewImageForm 컴포넌트 구현 (#539)
turtle601 9e68a48
feat: 업로드한 이미지 취소 기능 추가 (#539)
turtle601 932d027
fix: 잘못된 height 설정으로 인한 콘솔 오류 수정 (#539)
turtle601 f512aef
fix: 잘못된 쿼리 스트링을 가져오는 오류 해결 (#539)
turtle601 d6a3315
feat: 리뷰 등록, 수정 시 이미지를 추가로 넣는 api 인스턴스 생성 및 기능 구현 (#539)
turtle601 df78df7
feat: 리뷰 post, patch 관련 msw 구현 (#539)
turtle601 53c0572
feat: 리뷰 form 스타일 개선 (#539)
turtle601 d624f5e
feat: 이미지 업로드 개수 제한 기능 추가 (#539)
turtle601 194dfaa
fix: 로그인 상태에서 처음 모달을 열었을 경우 로그인이 되지 않은 상태이던 오류 해결 (#539)
turtle601 76280a9
feat: 리뷰 create, update, delete 시 성공, 실패 시 Toast UI를 띄우는 기능 구현 (#539)
turtle601 c1bd8a6
fix: 모바일 hover 관련 에러 해결 (#539)
turtle601 e0c979d
refactor: ReviewModal, ReviewDeleteForm 파일 분리 (#539)
turtle601 197bef5
feat: 별점, 리뷰 관련 disabled 기능 추가 (#539)
turtle601 2c3d765
fix: 리뷰 신고하기 모달 폼에 별점, 사진 등록 기능이 있어 제거 (#539)
turtle601 7bcfc66
refactor: Star, StarRating 컴포넌트 props size 추가 및 Star 컴포넌트 네이밍 수정 (#539)
turtle601 fa2886b
refactor: 동작하지 않은 RestaurantReviewItem 스토리북 제거 (#539)
turtle601 2b58364
fix: 리뷰 아이템에 별점 기능 추가로 인한 목 데이터 수정 (#539)
turtle601 f42d801
feat: RestaurantReviewItem에 별점 ui 추가 (#539)
turtle601 368cc48
feat: Review이미지 타입 데이터 변경으로 인한 코드 수정 (#543)
turtle601 9cb0890
feat: 이미지 업로드 시 파일 압축 (#543)
turtle601 01a59cc
refactor: ReviewModalProvier의 useMemo 디펜던시 수정 (#543)
turtle601 535bc5b
refactor: getImgUrl import 방식 수정 (#543)
turtle601 0bf334c
feat: 이미지 확장자 변환 함수 구현 (#543)
turtle601 e355cbb
refactor: review 관련 msw 코드 수정 (#543)
turtle601 a7448f1
feat: 리뷰 관련 명세 수정으로 인한 코드 수정 (#543)
turtle601 99a2d37
feat: review update 명세 수정으로 인한 코드 수정 + 수정 시 사진 수정 기능 제거 (#543)
turtle601 5462a03
refactor: 불필요한 svg 파일 삭제 (#543)
turtle601 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 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
This file contains 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
This file contains 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,3 @@ | ||
export type ReviewFormType = 'create' | 'update' | 'delete' | 'report' | 'all' | null; | ||
|
||
export type ReviewSubmitButtonType = Exclude<ReviewFormType, 'all' | 'delete' | 'report' | null>; |
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
frontend/src/components/@common/ImageForm/ImageForm.stories.tsx
This file contains 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,15 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import ImageForm from './ImageForm'; | ||
|
||
const meta: Meta<typeof ImageForm> = { | ||
title: 'ImageForm', | ||
component: ImageForm, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ImageForm>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; |
This file contains 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,37 @@ | ||
import { styled } from 'styled-components'; | ||
import { FONT_SIZE } from '~/styles/common'; | ||
|
||
interface ImageFormProps extends React.ComponentPropsWithoutRef<'input'> { | ||
onChange: React.ChangeEventHandler<HTMLInputElement>; | ||
} | ||
|
||
function ImageForm({ onChange, ...restProps }: ImageFormProps) { | ||
return ( | ||
<StyledButton> | ||
+ | ||
<input type="file" onChange={onChange} {...restProps} /> | ||
</StyledButton> | ||
); | ||
} | ||
|
||
export default ImageForm; | ||
|
||
const StyledButton = styled.label` | ||
padding: 4.8rem; | ||
|
||
border: 4px solid #ddd; | ||
border-radius: 20px; | ||
background-color: transparent; | ||
|
||
font-size: ${FONT_SIZE.lg}; | ||
|
||
cursor: pointer; | ||
|
||
&:hover { | ||
background-color: #ddd; | ||
} | ||
|
||
input[type='file'] { | ||
display: none; | ||
} | ||
`; |
This file contains 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,3 @@ | ||
import ImageForm from '~/components/@common/ImageForm/ImageForm'; | ||
|
||
export default ImageForm; |
This file contains 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,18 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import Star from './HalfStar'; | ||
|
||
const meta: Meta<typeof Star> = { | ||
title: 'Star', | ||
component: Star, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Star>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
isLeft: true, | ||
isFilled: false, | ||
}, | ||
}; |
This file contains 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,47 @@ | ||
import { styled } from 'styled-components'; | ||
|
||
import EmptyLeftStarIcon from '~/assets/icons/star/empty-left-star-icon.svg'; | ||
import EmptyRightStarIcon from '~/assets/icons/star/empty-right-star-icon.svg'; | ||
|
||
import type { StarRate } from '~/@types/api.types'; | ||
|
||
interface HalfStarProps { | ||
isLeft: boolean; | ||
isFilled: boolean; | ||
rateNumber: StarRate; | ||
size: `${number}px`; | ||
onRateClick: React.MouseEventHandler<HTMLButtonElement>; | ||
} | ||
|
||
function HalfStar({ isLeft, isFilled, rateNumber, size, onRateClick }: HalfStarProps) { | ||
const halfStarColor = isFilled ? '#FFD601' : '#e8e8e8'; | ||
|
||
if (isLeft) { | ||
return ( | ||
<StyleHalfStarButton type="button" data-rate={rateNumber} size={size} onClick={onRateClick}> | ||
<EmptyLeftStarIcon fill={halfStarColor} /> | ||
</StyleHalfStarButton> | ||
); | ||
} | ||
|
||
return ( | ||
<StyleHalfStarButton type="button" onClick={onRateClick} size={size} data-rate={rateNumber}> | ||
<EmptyRightStarIcon fill={halfStarColor} /> | ||
</StyleHalfStarButton> | ||
); | ||
} | ||
|
||
export default HalfStar; | ||
|
||
const StyleHalfStarButton = styled.button<{ size: `${number}px` }>` | ||
padding: 0; | ||
margin: 0; | ||
|
||
border: none; | ||
background: none; | ||
outline: none; | ||
|
||
& > svg { | ||
width: ${({ size }) => size}; | ||
} | ||
`; |
This file contains 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,3 @@ | ||
import HalfStar from '~/components/@common/Star/HalfStar'; | ||
|
||
export default HalfStar; |
17 changes: 17 additions & 0 deletions
17
frontend/src/components/@common/StarRating/StarRating.stories.tsx
This file contains 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,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import StarRating from './StarRating'; | ||
|
||
const meta: Meta<typeof StarRating> = { | ||
title: 'StarRating', | ||
component: StarRating, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof StarRating>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
rate: 3.5, | ||
}, | ||
}; |
This file contains 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,40 @@ | ||
import { ComponentPropsWithoutRef } from 'react'; | ||
import { styled } from 'styled-components'; | ||
import HalfStar from '~/components/@common/Star/HalfStar'; | ||
|
||
import type { StarRate } from '~/@types/api.types'; | ||
|
||
const starRateList: StarRate[] = [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]; | ||
|
||
interface StarRatingProps extends ComponentPropsWithoutRef<'div'> { | ||
rate: StarRate; | ||
size?: `${number}px`; | ||
onRateClick?: React.MouseEventHandler<HTMLButtonElement>; | ||
} | ||
|
||
function StarRating({ rate, onRateClick, size = '20px', ...restProps }: StarRatingProps) { | ||
return ( | ||
<StyledStarRatingWrapper {...restProps}> | ||
{starRateList.map((starRate, idx) => { | ||
const isLeft = idx % 2 === 0; | ||
const isFilled = starRate <= rate; | ||
|
||
return ( | ||
<HalfStar size={size} isLeft={isLeft} isFilled={isFilled} rateNumber={starRate} onRateClick={onRateClick} /> | ||
); | ||
})} | ||
</StyledStarRatingWrapper> | ||
); | ||
} | ||
|
||
export default StarRating; | ||
|
||
const StyledStarRatingWrapper = styled.div` | ||
display: flex; | ||
|
||
width: max-content; | ||
|
||
button:nth-child(2n) { | ||
margin-right: 1.2rem; | ||
} | ||
`; |
This file contains 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,3 @@ | ||
import StarRating from '~/components/@common/StarRating/StarRating'; | ||
|
||
export default StarRating; |
This file contains 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
2 changes: 1 addition & 1 deletion
2
frontend/src/components/@common/WaterMarkImage/WaterMarkImage.tsx
This file contains 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네이밍에 관한 부분들은 나중에 함께 얘기나눠보면 좋을 것 같네요.