-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat/#64 my review
- Loading branch information
Showing
7 changed files
with
277 additions
and
114 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import './reviewBox.css'; | ||
|
||
const KeywordBar = ({ text }) => { | ||
if (text === 'CULTURE') { | ||
text = '😃 "분위기가 좋아요"'; | ||
} else if (text === 'FEE') { | ||
text = '💵 "회비가 적당해요"'; | ||
} else if (text === 'ACTIVITY') { | ||
text = '🕺🏻 "활동 참여가 자유로워요"'; | ||
} else if (text === 'CAREER') { | ||
text = '🏆 "대외활동에 좋아요"'; | ||
} else if (text === 'MANAGE') { | ||
text = '👍🏻 "운영진이 일을 잘해요"'; | ||
} | ||
return <div className="keyword_container">{text}</div>; | ||
}; | ||
|
||
export default KeywordBar; | ||
|
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 |
---|---|---|
@@ -1,60 +1,45 @@ | ||
import "./reviewBox.css"; | ||
import { useState, useEffect } from "react"; | ||
import axios from "axios"; | ||
import { customAxios } from "../../../config/axios-config"; | ||
|
||
const KeywordBar = ({ text }) => { | ||
if (text === "CULTURE") { | ||
text = '😃 "분위기가 좋아요"'; | ||
} else if (text === "FEE") { | ||
text = '💵 "회비가 적당해요"'; | ||
} else if (text === "ACTIVITY") { | ||
text = '🕺🏻 "활동 참여가 자유로워요"'; | ||
} else if (text === "CAREER") { | ||
text = '🏆 "대외활동에 좋아요"'; | ||
} else if (text === "MANAGE") { | ||
text = '👍🏻 "운영진이 일을 잘해요"'; | ||
} | ||
return <div className="keyword_container">{text}</div>; | ||
}; | ||
import './reviewBox.css'; | ||
import KeywordBar from './KeywordBar'; | ||
import { useState, useEffect } from 'react'; | ||
import axios from 'axios'; | ||
|
||
export default function ReviewBox({ clubId }) { | ||
const [reviewData, setReviewData] = useState([]); | ||
const [reviewData, setReviewData] = useState([]); | ||
|
||
useEffect(() => { | ||
const fetchKeywordData = async () => { | ||
try { | ||
const res = await customAxios.get(`/v1/clubs/${clubId}/reviews/v2`); | ||
if (res.data.success) { | ||
setReviewData(res.data.data.reviews); | ||
console.log(reviewData); | ||
} | ||
} catch (error) { | ||
console.error("Error fetching reviews:", error); | ||
} | ||
}; | ||
useEffect(() => { | ||
const fetchKeywordData = async () => { | ||
try { | ||
const res = await axios.get(`http://13.125.141.171:8080/v1/clubs/${clubId}/reviews/v2`); | ||
if (res.data.success) { | ||
setReviewData(res.data.data.reviews); | ||
console.log(reviewData); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching reviews:', error); | ||
} | ||
}; | ||
|
||
fetchKeywordData(); | ||
}, [clubId]); | ||
fetchKeywordData(); | ||
}, [clubId]); | ||
|
||
return ( | ||
<> | ||
{reviewData.map((review) => ( | ||
<div className="review_box_container"> | ||
<div key={review.reviewId} className="review_box"> | ||
<div className="review_box_header"> | ||
<p>익명 {review.reviewId}</p> | ||
<span>{review.dateTime}</span> | ||
</div> | ||
<div className="review_box_contents"> | ||
{review.keywords.map((item, index) => ( | ||
<KeywordBar key={index} text={item} /> | ||
))} | ||
</div> | ||
<p>{review.content}</p> | ||
</div> | ||
</div> | ||
))} | ||
</> | ||
); | ||
return ( | ||
<> | ||
{reviewData.map((review) => ( | ||
<div className="review_box_container"> | ||
<div key={review.reviewId} className="review_box"> | ||
<div className="review_box_header"> | ||
<p>익명 {review.reviewId}</p> | ||
<span>{review.dateTime}</span> | ||
</div> | ||
<div className="review_box_contents"> | ||
{review.keywords.map((item, index) => ( | ||
<KeywordBar key={index} text={item} /> | ||
))} | ||
</div> | ||
<p>{review.content}</p> | ||
</div> | ||
</div> | ||
))} | ||
</> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
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,57 @@ | ||
import './myReview.css'; | ||
import '../../detail/review/reviewBox.css'; | ||
import KeywordBar from '../../detail/review/KeywordBar'; | ||
import axios from 'axios'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export default function MyReview() { | ||
const [myReviewData, setMyReviewData] = useState([]); | ||
const accessToken = localStorage.getItem('accessToken'); | ||
|
||
useEffect(() => { | ||
const getMyReviews = async () => { | ||
try { | ||
const res = await axios.get(`http://13.125.141.171:8080/v1/users/review`, { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}); | ||
console.log(res); | ||
if (res.data.success) { | ||
setMyReviewData(res.data.data.userReviews); | ||
console.log(myReviewData); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching my reviews : ', error); | ||
} | ||
}; | ||
getMyReviews(); | ||
}, []); | ||
|
||
return ( | ||
<div className="my_review_container"> | ||
<h2>내가 쓴 리뷰</h2> | ||
{myReviewData.map((myReview) => ( | ||
<div key={myReview.reviewId} className="my_review_box"> | ||
<div className="review_box_header"> | ||
<p className="club_name">{myReview.clubName}</p> | ||
<span>{myReview.dateTime}</span> | ||
{myReview.approvedStatus === 'APPROVED' ? ( | ||
<div className="review_approved">승인완료</div> | ||
) : myReview.approvedStatus === 'PENDING' ? ( | ||
<div className="review_pending">승인대기</div> | ||
) : myReview.approvedStatus === 'REJECTED' ? ( | ||
<div className="review_rejected">승인거절</div> | ||
) : null} | ||
</div> | ||
<div className="review_box_contents"> | ||
{myReview.keywords.map((item, index) => ( | ||
<KeywordBar key={index} text={item} /> | ||
))} | ||
</div> | ||
<p className="review_comment">{myReview.content}</p> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.