-
Notifications
You must be signed in to change notification settings - Fork 5
refactor/wineid #75
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
Merged
refactor/wineid #75
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
47a41ff
feat:μ΄λ―Έμ§ ν΄λ°±, 리뷰 μμ λ μ»΄ν¬λνΈ μΆκ°
626-ju 9f77f5b
fix:λ°μμ€λ λ°μ΄ν° νμ
μ λ§κ² μμ
626-ju 54d3f2c
fix:μ΄λ―Έμ§ μΉ΄λ λ체 μ΄λ―Έμ§ λμ€κ² μμ
626-ju ecb9b87
fix&feat: μ΄λ―Έμ§ ν΄λ°± μ²λ¦¬ μμ + μΈλΆ μ΄λ―Έμ§ λ°μμ¬ μ μκ² μ€μ
626-ju a497489
style: λΆ νμν μ£Όμ μ κ±°
626-ju 3fcda4a
feat: μ’μμ μ«μ΄μ λ²νΌ
626-ju 58ef116
feat:μλμκ° κ³μ° μΆκ°
626-ju d368dce
chore: μμ°λ μμ
μ κ±° λ° μ£Όμ μμ
626-ju f69eef2
chore: νΌλΈλ¦ ν΄λμμλ μ μ°λ μ΄λ―Έμ§ μ κ±°
626-ju 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
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,8 @@ | ||
| // import { createSeverApiInstance, RetryRequestConfig } from './apiServer'; | ||
| import { GetWineInfoResponse } from '@/types/WineTypes'; | ||
|
|
||
| import apiClient from './apiClient'; | ||
|
|
||
| export const getWineInfoForClient = (wineid: number): Promise<GetWineInfoResponse> => { | ||
| return apiClient.get(`/${process.env.NEXT_PUBLIC_TEAM}/wines/${wineid}`); | ||
| }; |
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.
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
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
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
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 |
|---|---|---|
| @@ -1,20 +1,41 @@ | ||
| import { useState } from 'react'; | ||
|
|
||
| import apiClient from '@/api/apiClient'; | ||
| import FullLikeIcon from '@/assets/icons/fullLike.svg'; | ||
| import LikeIcon from '@/assets/icons/like.svg'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| async function postLike(reviewId: number) { | ||
| console.log('μ’μμ!'); | ||
| return apiClient.post(`${process.env.NEXT_PUBLIC_TEAM}/reviews/${reviewId}/like`); | ||
| } | ||
|
|
||
| async function deleteLike(reviewId: number) { | ||
| console.log('μ«μ΄μ!'); | ||
| return apiClient.delete(`${process.env.NEXT_PUBLIC_TEAM}/reviews/${reviewId}/like`); | ||
| } | ||
|
|
||
| interface Props { | ||
| isLike?: boolean; | ||
| reviewId: number; | ||
| } | ||
|
|
||
| function LikeButton({ isLike }: Props) { | ||
| function LikeButton({ isLike, reviewId }: Props) { | ||
| const [isClicked, setIsClicked] = useState(isLike); | ||
|
|
||
| function handleToggle() { | ||
| setIsClicked(!isClicked); | ||
| async function handleToggle() { | ||
| setIsClicked((prev) => !prev); //미리 μ λ°μ΄νΈ | ||
| //μ’μμ api μμ² λ³΄λ΄κΈ° | ||
| // /{teamId}/reviews/{id}/like | ||
|
Comment on lines
+28
to
+30
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ¬μ©μ κ³ λ €ν΄μ μ’μμ μ²λ¦¬κ° 미리 λλκ² μ’λ€μ |
||
|
|
||
| try { | ||
| isClicked === true ? await deleteLike(reviewId) : await postLike(reviewId); | ||
| } catch (err) { | ||
| //λͺ¨λ¬ νΈμΆ ν μ§μ΄ λ£κΈ° | ||
|
|
||
| setIsClicked((prev) => !prev); //μ€ν¨νλ©΄ μ λ°μ΄νΈ νλ κ±° μ·¨μ | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
|
|
||
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,28 @@ | ||
| import React from 'react'; | ||
|
|
||
| import NoReviewIcon from '@/assets/icons/noReview.svg'; | ||
|
|
||
| import { Button } from '../ui/button'; | ||
|
|
||
| interface Props { | ||
| className: string; | ||
| } | ||
|
|
||
| function NoReviews({ className }: Props) { | ||
| return ( | ||
| <div className={className}> | ||
| <div className='w-[150px] h-[158px] text-gray-400 mx-auto mb-10 md:mb-12 xl:mt-[152px]'> | ||
| <NoReviewIcon /> | ||
| </div> | ||
| <Button | ||
| variant='purpleDark' | ||
| size='xs' | ||
| className='w-fit md:w-fit block px-5 py-2 mx-auto mb-[139px] md:mb-[426px] xl:mb[252px]' | ||
| > | ||
| 리뷰 λ¨κΈ°κΈ° | ||
| </Button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default NoReviews; |
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,30 @@ | ||
| import React from 'react'; | ||
|
|
||
| import { WineReview } from '@/types/WineTypes'; | ||
|
|
||
| import NoReviews from './NoReviews'; | ||
| import WineReviewCard from './WineReviewCard'; | ||
|
|
||
| interface Props { | ||
| reviews: WineReview[]; | ||
| reviewCount: number; | ||
| } | ||
|
|
||
| function Reviews({ reviews, reviewCount }: Props) { | ||
| return ( | ||
| <ul> | ||
| {/* μΆν 리뷰 νμ λ£κΈ° */} | ||
| {reviewCount > 0 ? ( | ||
| reviews.map((review: WineReview) => ( | ||
| <li key={review.id} className='mb-[16px] md:mb-[24px] xl:mb-[20px]'> | ||
| <WineReviewCard review={review} /> | ||
| </li> | ||
| )) | ||
| ) : ( | ||
| <NoReviews className='w-full xl:w-[1140px] pt-[80px]' /> | ||
| )} | ||
| </ul> | ||
| ); | ||
| } | ||
|
|
||
| export default Reviews; |
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.
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.
ν μ€νΈ μλ£λμλ©΄ μ½μ μμ λΆνλ립λλ€!