Skip to content

Commit

Permalink
refactor: reviewerInfo에서 reviewInfo로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
chlwlstlf committed Nov 5, 2024
1 parent 392faf3 commit 29d210b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface ReviewerInfo {
export interface ReviewInfo {
userId: number;
username: string;
link: string;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/apis/reviews.api.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ReviewerInfo } from "../@types/reviewer";
import { ReviewInfo } from "../@types/review";
import apiClient from "./apiClient";
import { API_ENDPOINTS } from "./endpoints";
import MESSAGES from "@/constants/message";

export const getMyReviewers = async (roomId: number): Promise<ReviewerInfo[]> => {
export const getMyReviewers = async (roomId: number): Promise<ReviewInfo[]> => {
const res = await apiClient.get({
endpoint: API_ENDPOINTS.REVIEWERS(roomId),
errorMessage: MESSAGES.ERROR.GET_MY_REVIEWERS,
Expand All @@ -12,7 +12,7 @@ export const getMyReviewers = async (roomId: number): Promise<ReviewerInfo[]> =>
return res.matchResultResponses;
};

export const getMyReviewees = async (roomId: number): Promise<ReviewerInfo[]> => {
export const getMyReviewees = async (roomId: number): Promise<ReviewInfo[]> => {
const res = await apiClient.get({
endpoint: API_ENDPOINTS.REVIEWEES(roomId),
errorMessage: MESSAGES.ERROR.GET_MY_REVIEWEES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Textarea } from "@/components/common/textarea/Textarea";
import EvaluationPointBar from "@/components/feedback/evaluationPointBar/EvaluationPointBar";
import * as S from "@/components/feedback/feedbackCard/FeedbackCard.style";
import { FeedbackCardData } from "@/@types/feedback";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";
import { HoverStyledLink } from "@/styles/common";
import { theme } from "@/styles/theme";

Expand All @@ -29,7 +29,7 @@ const FeedbackCard = ({
return feedbackType === "develop" ? "TO. 나의 리뷰이" : "TO. 나의 리뷰어";
};

const reviewInfo: ReviewerInfo = {
const reviewInfo: ReviewInfo = {
userId: feedbackCardData.receiverId,
username: feedbackCardData.username,
link: feedbackCardData.profile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import Label from "@/components/common/label/Label";
import RevieweeFeedbackForm from "@/components/feedback/feedbackForm/RevieweeFeedbackForm";
import * as S from "@/components/feedback/feedbackLayout/FeedbackLayout.style";
import { RevieweeFeedbackData } from "@/@types/feedback";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";
import { RoomInfo } from "@/@types/roomInfo";
import { theme } from "@/styles/theme";
import { FeedbackPageType } from "@/utils/feedbackUtils";

interface RevieweeFeedbackProps {
feedbackPageType: FeedbackPageType;
roomInfo: Pick<RoomInfo, "id" | "title" | "keywords">;
reviewee?: ReviewerInfo;
reviewee?: ReviewInfo;
feedbackData?: RevieweeFeedbackData;
}

const getInitialFormState = (
reviewee?: ReviewerInfo,
reviewee?: ReviewInfo,
feedbackData?: RevieweeFeedbackData,
): RevieweeFeedbackData => ({
feedbackId: feedbackData?.feedbackId || 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import Label from "@/components/common/label/Label";
import ReviewerFeedbackForm from "@/components/feedback/feedbackForm/ReviewerFeedbackForm";
import * as S from "@/components/feedback/feedbackLayout/FeedbackLayout.style";
import { ReviewerFeedbackData } from "@/@types/feedback";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";
import { RoomInfo } from "@/@types/roomInfo";
import { theme } from "@/styles/theme";
import { FeedbackPageType } from "@/utils/feedbackUtils";

interface ReviewerFeedbackProps {
feedbackPageType: FeedbackPageType;
roomInfo: Pick<RoomInfo, "id" | "title" | "keywords">;
reviewer?: ReviewerInfo;
reviewer?: ReviewInfo;
feedbackData?: ReviewerFeedbackData;
}

const getInitialFormState = (
reviewer?: ReviewerInfo,
reviewer?: ReviewInfo,
feedbackData?: ReviewerFeedbackData,
): ReviewerFeedbackData => ({
feedbackId: feedbackData?.feedbackId || 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useFetchReviewee } from "@/hooks/queries/useFetchReviewee";
import Button from "@/components/common/button/Button";
import Icon from "@/components/common/icon/Icon";
import * as S from "@/components/roomDetailPage/myReviewee/MyReviewee.style";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";
import { RoomInfo } from "@/@types/roomInfo";
import { spinner } from "@/assets";
import MESSAGES from "@/constants/message";
Expand All @@ -23,14 +23,14 @@ const MyReviewee = ({ roomInfo }: MyRevieweeProps) => {
const [loadingButtonId, setLoadingButtonId] = useState<number[]>([]);

// 피드백 페이지 이동 함수
const handleNavigateFeedbackPage = (reviewInfo: ReviewerInfo) => {
const handleNavigateFeedbackPage = (reviewInfo: ReviewInfo) => {
navigate(`/rooms/${roomInfo.id}/feedback/reviewee?username=${reviewInfo.username}`, {
state: { reviewInfo },
});
};

// 코드 리뷰 완료 post 요청 보내는 함수
const handleReviewCompleteClick = (reviewee: ReviewerInfo) => {
const handleReviewCompleteClick = (reviewee: ReviewInfo) => {
setLoadingButtonId((prev) => [...prev, reviewee.userId]);

postReviewCompleteMutation.mutate(
Expand All @@ -46,7 +46,7 @@ const MyReviewee = ({ roomInfo }: MyRevieweeProps) => {
};

// 리뷰 및 피드백 여부 버튼 렌더링 함수
const renderRevieweeButton = (reviewee: ReviewerInfo) => {
const renderRevieweeButton = (reviewee: ReviewInfo) => {
const { buttonText } = getFeedbackPageType({
isReviewed: reviewee.isReviewed ?? true,
isWrited: reviewee.isWrited,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useFetchReviewer } from "@/hooks/queries/useFetchReviewer";
import Button from "@/components/common/button/Button";
import Icon from "@/components/common/icon/Icon";
import * as S from "@/components/roomDetailPage/myReviewer/MyReviewer.style";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";
import { RoomInfo } from "@/@types/roomInfo";
import { thinkingCharacter } from "@/assets";
import MESSAGES from "@/constants/message";
Expand All @@ -19,14 +19,14 @@ const MyReviewer = ({ roomInfo }: MyReviewerProps) => {
const { data: reviewerData } = useFetchReviewer(roomInfo);

// 피드백 페이지 이동 함수
const handleNavigateFeedbackPage = (reviewInfo: ReviewerInfo) => {
const handleNavigateFeedbackPage = (reviewInfo: ReviewInfo) => {
navigate(`/rooms/${roomInfo.id}/feedback/reviewer?username=${reviewInfo.username}`, {
state: { reviewInfo },
});
};

// 피드백 여부 버튼 렌더링 함수
const renderReviewerButton = (reviewer: ReviewerInfo) => {
const renderReviewerButton = (reviewer: ReviewInfo) => {
const { buttonText } = getFeedbackPageType({
isReviewed: reviewer.isReviewed ?? true,
isWrited: reviewer.isWrited,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/feedbackForm/RevieweeFeedbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { useLocation, useParams } from "react-router-dom";
import { useFetchRevieweeFeedback } from "@/hooks/queries/useFetchFeedback";
import { useFetchDetailRoomInfo } from "@/hooks/queries/useFetchRooms";
import RevieweeFeedbackLayout from "@/components/feedback/feedbackLayout/RevieweeFeedbackLayout";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";

const RevieweeFeedbackPage = () => {
const location = useLocation();
const queryParams = new URLSearchParams(location.search);

const roomId = Number(useParams().roomId);
const username = queryParams.get("username") || "";
const reviewee = location.state?.reviewInfo as ReviewerInfo;
const reviewee = location.state?.reviewInfo as ReviewInfo;

const { data: roomInfo } = useFetchDetailRoomInfo(roomId);
const { data: feedbackData } = useFetchRevieweeFeedback({
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/feedbackForm/ReviewerFeedbackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { useLocation, useParams } from "react-router-dom";
import { useFetchReviewerFeedback } from "@/hooks/queries/useFetchFeedback";
import { useFetchDetailRoomInfo } from "@/hooks/queries/useFetchRooms";
import ReviewerFeedbackLayout from "@/components/feedback/feedbackLayout/ReviewerFeedbackLayout";
import { ReviewerInfo } from "@/@types/reviewer";
import { ReviewInfo } from "@/@types/review";

const ReviewerFeedbackPage = () => {
const location = useLocation();
const queryParams = new URLSearchParams(location.search);

const roomId = Number(useParams().roomId);
const username = queryParams.get("username") || "";
const reviewer = location.state?.reviewInfo as ReviewerInfo;
const reviewer = location.state?.reviewInfo as ReviewInfo;

const { data: roomInfo } = useFetchDetailRoomInfo(roomId);
const { data: feedbackData } = useFetchReviewerFeedback({
Expand Down

0 comments on commit 29d210b

Please sign in to comment.