Skip to content

Commit

Permalink
Merge branch 'dev' into feat/#127
Browse files Browse the repository at this point in the history
  • Loading branch information
ch9968 committed Dec 3, 2024
2 parents b4cc026 + 3f78c86 commit 7677453
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions bookduck/src/components/BookInfoPage/UserComment.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import starNo from "../../assets/bookinfoPage/star-small-no.svg";
import starYes from "../../assets/bookinfoPage/star-small-yes.svg";
import starHalf from "../../assets/bookinfoPage/star-small-half.svg";
Expand All @@ -8,6 +9,7 @@ import { enrollLike, deleteLike } from "../../api/bookinfo";
import { getUserId } from "../../api/oauth";

const UserComment = ({ data }) => {
const navigate = useNavigate();
//날짜 포맷
const formattedDate = data?.createdTime.split("T")[0].replace(/-/g, ".");
const [isLiked, setIsLiked] = useState(data?.isLiked || false);
Expand All @@ -30,7 +32,9 @@ const UserComment = ({ data }) => {
console.error("좋아요 처리 실패:", error);
}
};

const handleUserClick = (userId) => {
navigate(`/user/${userId}`);
};
return (
<div className="flex flex-col p-4 gap-1.5 text-b2 w-[24.5625rem]">
<div className="flex flex-col gap-3">
Expand All @@ -50,7 +54,10 @@ const UserComment = ({ data }) => {
{userId === data.userId ? (
<span className="text-orange-400">나의 한줄평</span>
) : (
<span className=" underline cursor-pointer">
<span
className=" underline cursor-pointer"
onClick={() => handleUserClick(data?.userId)}
>
{data?.userNickname}
</span>
)}
Expand Down
1 change: 1 addition & 0 deletions bookduck/src/components/SearchPage/SearchUserComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const SearchUserComponent = ({ search }) => {
users.map((user) => (
<FriendListComponent
key={user.userId}
userId={user.userId}
isOfficial={user.isOfficial}
userName={user.nickname}
text={user.isFriend ? "친구" : "none"}
Expand Down
2 changes: 1 addition & 1 deletion bookduck/src/pages/BookInfoPage/UserCommentPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const UserCommentPage = () => {
<div className="flex flex-col gap-1">
{ratingList.length > 0 &&
ratingList.map((oneLine, index) => (
<div className="flex flex-col items-center">
<div key={index} className="flex flex-col items-center">
<UserComment data={oneLine} key={index} />
<Divider2 />
</div>
Expand Down

0 comments on commit 7677453

Please sign in to comment.