Skip to content

Commit

Permalink
[Fix/#311] ENDLESS QA (#314)
Browse files Browse the repository at this point in the history
* feat: 공지사항 상세 페이지 렌더링 시 스크롤 맨  위로

* feat: 더보기 아이콘 모바일 크롬에서 안보이는 이슈 일단 확인용 인라인 css

* feat: 필터링 로직에서 필터셀렉트 컴포넌트 항상 보이게 설정

* feat: 게스트 마이 클래스 엠티 뷰 텍스트 수정
  • Loading branch information
ExceptAnyone authored Sep 20, 2024
1 parent a1aed88 commit a9663b6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/apis/domains/moim/useFetchGuestApply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { QUERY_KEY } from '@apis/queryKeys/queryKeys';
import { components } from '@schema';
import { ApiResponseType } from '@types';

type SubmittedMoimByGuestResponse = components['schemas']['SubmittedMoimByGuestResponse'];
export type SubmittedMoimByGuestResponse = components['schemas']['SubmittedMoimByGuestResponse'];

const getGuestApplyMoim = async (
guestId: number,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/class/components/CommentBox/CommentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const CommentBox = ({ comment, noticeId, host }: CommentBoxProps) => {

{canShowIcon && (
<div css={iconWrapper}>
<IcParkMore onClick={handleDeleteOpen} css={iconStyle} />
<IcParkMore onClick={handleDeleteOpen} css={iconStyle} width={24} height={24} />
{isDeleteOpen && (
<DeleteCard handleModalOpen={handleModalOpen} handleDeleteClose={handleDeleteClose} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const HostProfileCard = ({ data: noticeDetail, noticeId, moimId }: HostProfileCa
return (
<>
<span css={iconStyle}>
<IcParkMore onClick={handleDeleteOpen} />
<IcParkMore onClick={handleDeleteOpen} width={24} height={24} />
</span>
{renderDeleteCard()}
{renderModal()}
Expand Down
4 changes: 4 additions & 0 deletions src/pages/class/page/ClassNoticeDetail/ClassNoticeDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const ClassNoticeDetail = () => {
}
}, [commentList]);

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<>
<div css={classNoticeDetailContainer}>
Expand Down
23 changes: 18 additions & 5 deletions src/pages/guest/page/GuestMyClass/GuestMyClass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useAtom } from 'jotai';
import { useEffect, useState } from 'react';

import { useFetchGuestApply, useFetchGuestParticipate } from '@apis/domains/moim';
import { SubmittedMoimByGuestResponse } from '@apis/domains/moim/useFetchGuestApply';

import { FilterSelect, Header, Spinner } from '@components';
import { GuestMyClassEmptyView, MoimCard } from '@pages/guest/components';
Expand Down Expand Up @@ -51,6 +52,18 @@ const GuestMyClass = () => {
setSelectedStatus(status);
};

const currentData = activeTab === '신청한' ? applyData : participateData;

// 각 상태별로 필터링된 데이터 계산
const statusFilteredData: { [key: string]: SubmittedMoimByGuestResponse[] | undefined } = {
전체: currentData ?? [],
'입금 대기': currentData?.filter((data) => data.moimSubmissionState === 'pendingPayment'),
'승인 대기': currentData?.filter((data) => data.moimSubmissionState === 'pendingApproval'),
'승인 완료': currentData?.filter((data) => data.moimSubmissionState === 'approved'),
'승인 거절': currentData?.filter((data) => data.moimSubmissionState === 'rejected'),
'환불 완료': currentData?.filter((data) => data.moimSubmissionState === 'refunded'),
};

if (isApplyLoading || isParticipateLoading) {
return <Spinner />;
}
Expand All @@ -59,8 +72,6 @@ const GuestMyClass = () => {
return <div>Error: {applyError?.message || participateError?.message}</div>;
}

const currentData = activeTab === '신청한' ? applyData : participateData;

return (
<div css={GuestMyClassBackground}>
<Header title="my 클래스 모임" />
Expand All @@ -77,7 +88,8 @@ const GuestMyClass = () => {
</article>

<main css={mainWrapper}>
{activeTab === '신청한' && (currentData?.length ?? 0) > 0 && (
{/* 모든 상태에 데이터가 하나라도 있으면 FilterSelect를 보여줌 */}
{activeTab === '신청한' && (
<article css={filterSelectWrapper}>
<div css={filterSelectStyle}>
<FilterSelect
Expand All @@ -95,17 +107,18 @@ const GuestMyClass = () => {
</article>
)}

{/* 전체 데이터가 없을 때 GuestMyClassEmptyView를 보여줌 */}
{currentData?.length === 0 ? (
<GuestMyClassEmptyView
text={
activeTab === '신청한'
? '아직 신청한 클래스가 없어요'
? `${selectedStatus} 중인 클래스가 없어요`
: '아직 참가한 클래스가 없어요'
}
/>
) : (
<ul css={classCardList}>
{currentData?.map((data) => (
{statusFilteredData[selectedStatus]?.map((data) => (
<li css={guestMyClassCardContainer} key={data.moimId}>
<MoimCard guestMyClassData={data} />
</li>
Expand Down

0 comments on commit a9663b6

Please sign in to comment.