Merge branch 'fe/develop' into fe/refactor/improve-design

This commit is contained in:
홍창기 2024-10-02 13:23:30 +09:00
commit 946f973cd0
12 changed files with 26 additions and 20 deletions

View File

@ -1,5 +1,5 @@
import api from '@/api/axiosConfig'; import api from '@/api/axiosConfig';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse } from '@/types'; import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus } from '@/types';
// 리뷰 단건 조회 // 리뷰 단건 조회
export async function getReviewDetail(projectId: number, reviewId: number, memberId: number) { export async function getReviewDetail(projectId: number, reviewId: number, memberId: number) {
@ -49,7 +49,7 @@ export async function getReviewByStatus(
projectId: number, projectId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
lastReviewId?: number, lastReviewId?: number,
limitPage: number = 10 limitPage: number = 10
) { ) {

View File

@ -5,6 +5,7 @@ import {
WorkspaceResponse, WorkspaceResponse,
ReviewResponse, ReviewResponse,
WorkspaceMemberResponse, WorkspaceMemberResponse,
ReviewStatus,
} from '@/types'; } from '@/types';
export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) { export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) {
@ -59,7 +60,7 @@ export async function getWorkspaceReviews(
workspaceId: number, workspaceId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
lastReviewId?: number, lastReviewId?: number,
limitPage: number = 10 limitPage: number = 10
) { ) {

View File

@ -4,13 +4,14 @@ import useProjectQuery from '@/queries/projects/useProjectQuery';
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
import formatDateTime from '@/utils/formatDateTime'; import formatDateTime from '@/utils/formatDateTime';
import { ReviewStatus } from '@/types';
interface ReviewItemProps { interface ReviewItemProps {
title: string; title: string;
createdTime: string; createdTime: string;
creatorName: string; creatorName: string;
projectId: number; projectId: number;
status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; status: ReviewStatus;
type?: { text: 'classification' | 'detection' | 'segmentation'; color: string }; type?: { text: 'classification' | 'detection' | 'segmentation'; color: string };
workspaceId: number; workspaceId: number;
reviewId: number; reviewId: number;

View File

@ -1,11 +1,11 @@
import ReviewItem from './ReviewItem'; import ReviewItem from './ReviewItem';
import ReviewSearchInput from './ReviewSearchInput'; import ReviewSearchInput from './ReviewSearchInput';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
interface ReviewListProps { interface ReviewListProps {
reviews: ReviewResponse[]; reviews: ReviewResponse[];
activeTab: 'REQUESTED' | 'APPROVED' | 'REJECTED' | 'ALL'; activeTab: ReviewStatus | 'ALL';
setActiveTab: React.Dispatch<React.SetStateAction<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'ALL'>>; setActiveTab: React.Dispatch<React.SetStateAction<ReviewStatus | 'ALL'>>;
setSearchQuery: React.Dispatch<React.SetStateAction<string>>; setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
sortValue: string; sortValue: string;
setSortValue: React.Dispatch<React.SetStateAction<string>>; setSortValue: React.Dispatch<React.SetStateAction<string>>;

View File

@ -64,7 +64,7 @@ export default function ProjectFileItem({
size={12} size={12}
className="shrink-0 stroke-blue-400" className="shrink-0 stroke-blue-400"
/> />
) : item.status === 'REVIEW_REJECTED' ? ( ) : item.status === 'REVIEW_REJECT' ? (
<CircleSlash <CircleSlash
size={12} size={12}
className="shrink-0 stroke-red-400" className="shrink-0 stroke-red-400"

View File

@ -1,5 +1,5 @@
import { http, HttpResponse } from 'msw'; import { http, HttpResponse } from 'msw';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatusRequest } from '@/types'; import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus, ReviewStatusRequest } from '@/types';
export const reviewHandlers = [ export const reviewHandlers = [
// 리뷰 단건 조회 핸들러 // 리뷰 단건 조회 핸들러
@ -145,7 +145,7 @@ export const reviewHandlers = [
reviewId: index + 1, reviewId: index + 1,
title: `Review ${index + 1}`, title: `Review ${index + 1}`,
content: `Review content ${index + 1}`, content: `Review content ${index + 1}`,
status: (reviewStatus || 'REQUESTED') as 'REQUESTED' | 'APPROVED' | 'REJECTED', status: (reviewStatus || 'REQUESTED') as ReviewStatus,
createAt: new Date().toISOString(), createAt: new Date().toISOString(),
updateAt: new Date().toISOString(), updateAt: new Date().toISOString(),
author: { id: 1, nickname: 'Author', profileImage: '', email: 'author@example.com' }, author: { id: 1, nickname: 'Author', profileImage: '', email: 'author@example.com' },

View File

@ -4,13 +4,14 @@ import useReviewByStatusQuery from '@/queries/reviews/useReviewByStatusQuery';
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList'; import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function ProjectReviewList() { export default function ProjectReviewList() {
const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>(); const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>();
const profile = useAuthStore((state) => state.profile); const profile = useAuthStore((state) => state.profile);
const memberId = profile?.id || 0; const memberId = profile?.id || 0;
const [activeTab, setActiveTab] = useState<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'ALL'>('REQUESTED'); const [activeTab, setActiveTab] = useState<ReviewStatus | 'ALL'>('REQUESTED');
const [, setSearchQuery] = useState(''); const [, setSearchQuery] = useState('');
const [sortValue, setSortValue] = useState('latest'); const [sortValue, setSortValue] = useState('latest');

View File

@ -4,13 +4,14 @@ import useWorkspaceReviewsQuery from '@/queries/workspaces/useWorkspaceReviewsQu
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList'; import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function WorkspaceReviewList() { export default function WorkspaceReviewList() {
const { workspaceId } = useParams<{ workspaceId: string }>(); const { workspaceId } = useParams<{ workspaceId: string }>();
const profile = useAuthStore((state) => state.profile); const profile = useAuthStore((state) => state.profile);
const memberId = profile?.id || 0; const memberId = profile?.id || 0;
const [activeTab, setActiveTab] = useState<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'ALL'>('REQUESTED'); const [activeTab, setActiveTab] = useState<ReviewStatus | 'ALL'>('REQUESTED');
const [, setSearchQuery] = useState(''); const [, setSearchQuery] = useState('');
const [sortValue, setSortValue] = useState('latest'); const [sortValue, setSortValue] = useState('latest');

View File

@ -1,11 +1,11 @@
import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { getReviewByStatus } from '@/api/reviewApi'; import { getReviewByStatus } from '@/api/reviewApi';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
export default function useReviewByStatusQuery( export default function useReviewByStatusQuery(
projectId: number, projectId: number,
memberId: number, memberId: number,
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED' | undefined, reviewStatus: ReviewStatus | undefined,
sortDirection: number sortDirection: number
) { ) {
return useSuspenseInfiniteQuery<ReviewResponse[]>({ return useSuspenseInfiniteQuery<ReviewResponse[]>({

View File

@ -1,12 +1,12 @@
import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { getWorkspaceReviews } from '@/api/workspaceApi'; import { getWorkspaceReviews } from '@/api/workspaceApi';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
export default function useWorkspaceReviewsQuery( export default function useWorkspaceReviewsQuery(
workspaceId: number, workspaceId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
limitPage: number = 10 limitPage: number = 10
) { ) {
return useSuspenseInfiniteQuery<ReviewResponse[]>({ return useSuspenseInfiniteQuery<ReviewResponse[]>({

View File

@ -1,4 +1,4 @@
export type ImageStatus = 'PENDING' | 'IN_PROGRESS' | 'SAVE' | 'REVIEW_REQUEST' | 'REVIEW_REJECTED' | 'COMPLETED'; export type ImageStatus = 'PENDING' | 'IN_PROGRESS' | 'SAVE' | 'REVIEW_REQUEST' | 'REVIEW_REJECT' | 'COMPLETED';
export interface ImageResponse { export interface ImageResponse {
id: number; id: number;

View File

@ -1,6 +1,8 @@
import { ImageStatus } from './imageTypes'; import { ImageStatus } from './imageTypes';
import { MemberResponse } from './memberTypes'; import { MemberResponse } from './memberTypes';
export type ReviewStatus = 'REQUESTED' | 'APPROVED' | 'REJECTED';
// 리뷰 관련 DTO // 리뷰 관련 DTO
export interface ReviewRequest { export interface ReviewRequest {
title: string; title: string;
@ -13,14 +15,14 @@ export interface ReviewResponse {
projectId: number; projectId: number;
title: string; title: string;
content: string; content: string;
status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; status: ReviewStatus;
author: MemberResponse; author: MemberResponse;
createAt: string; createAt: string;
updateAt: string; updateAt: string;
} }
export interface ReviewStatusRequest { export interface ReviewStatusRequest {
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; reviewStatus: ReviewStatus;
} }
export interface ReviewImageResponse { export interface ReviewImageResponse {
@ -35,7 +37,7 @@ export interface ReviewDetailResponse {
reviewId: number; reviewId: number;
title: string; title: string;
content: string; content: string;
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; reviewStatus: ReviewStatus;
images: ReviewImageResponse[]; images: ReviewImageResponse[];
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;