Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 담당 파트 수정(혜지) #8

Merged
merged 6 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/api/adminApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,19 @@ export const deleteAdminMethods = async (ids: number[]) => {
};

// 관리자 문의 상세조회 API
export const getAdminInquiryDetail = async (qnaId: number) => {
const response = await axiosInstance.get(`/v1/admin/qna/${qnaId}`);
export const getAdminInquiryDetail = async (
qnaId: number,
closed: string,
searchType: string,
searchText: string
) => {
const response = await axiosInstance.get(`/v1/admin/qna/${qnaId}`, {
params: {
closed,
searchType,
searchText,
},
});

return response.data;
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/StrategyFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const filterContentStyle = css`

.filter-label {
display: block;
width: 80px;
min-width: 80px;
font-weight: ${FONT_WEIGHT.BOLD};
color: ${COLOR.BLACK};
}
Expand Down
11 changes: 8 additions & 3 deletions src/hooks/useAdminApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,15 @@ export const useDeleteInquiryList = () => {
};

// 관리자 문의 상세조회
export const useGetAdminInquiryDetail = (qnaId: number) =>
export const useGetAdminInquiryDetail = (
qnaId: number,
closed: string,
searchType: string,
searchText: string
) =>
useQuery({
queryKey: ['adminInquiryDetail', qnaId],
queryFn: () => getAdminInquiryDetail(qnaId),
queryKey: ['adminInquiryDetail', qnaId, closed, searchType, searchText],
queryFn: () => getAdminInquiryDetail(qnaId, closed, searchType, searchText),
});

// 관리자 문의 특정 삭제 API
Expand Down
10 changes: 6 additions & 4 deletions src/pages/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ const SignIn = () => {
setter('');

const validateEmail = (value: string) => {
setEmail(value);
setEmailError(!emailRegEx.test(value));
const trimmedValue = value.trim();
setEmail(trimmedValue);
setEmailError(!emailRegEx.test(trimmedValue));
};

const validatePassword = (value: string) => {
setPassword(value);
setPasswordError(!passwordRegEx.test(value));
const trimmedValue = value.trim();
setPassword(trimmedValue);
setPasswordError(!passwordRegEx.test(trimmedValue));
};

const handleSignIn = () => {
Expand Down
18 changes: 13 additions & 5 deletions src/pages/StrategyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
import { css } from '@emotion/react';
import SearchOutlinedIcon from '@mui/icons-material/SearchOutlined';
import { useNavigate } from 'react-router-dom';
import dayIcon from '@/assets/images/day-icon.png';
import positionIcon from '@/assets/images/position-icon.png';
import Button from '@/components/Button';
import Modal from '@/components/Modal';
import Pagination from '@/components/Pagination';
Expand Down Expand Up @@ -561,12 +563,18 @@ export const StrategyList = () => {
<div css={tagStyle}>
<div className='tag'>
<Tag src={item?.methodIconPath || ''} alt='tag' />
{item?.stockList?.stockIconPath &&
item?.stockList?.stockIconPath.map(
(stock: string, index: number) => (
<Tag src={item?.cycle === 'D' ? dayIcon : positionIcon} />
{currentTab === 1
? item?.stockIconPath &&
item?.stockIconPath.map((stock: string, index: number) => (
<Tag key={index} src={stock} alt='tag' />
)
)}
))
: item?.stockList?.stockIconPath &&
item.stockList.stockIconPath.map(
(stock: string, index: number) => (
<Tag key={index} src={stock} alt='tag' />
)
)}
</div>
{item.name}
</div>
Expand Down
55 changes: 50 additions & 5 deletions src/pages/TraderStrategyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { css } from '@emotion/react';
import ContentCopyOutlinedIcon from '@mui/icons-material/ContentCopyOutlined';
import FavoriteBorderOutlinedIcon from '@mui/icons-material/FavoriteBorderOutlined';
import { useNavigate } from 'react-router-dom';
import dayIcon from '@/assets/images/day-icon.png';
import positionIcon from '@/assets/images/position-icon.png';
import Button from '@/components/Button';
import Modal from '@/components/Modal';
import Pagination from '@/components/Pagination';
Expand Down Expand Up @@ -372,6 +374,7 @@ const TraderStrategyList = () => {
<div css={tagStyle}>
<div className='tag'>
<Tag src={item?.methodIconPath || ''} alt='tag' />
<Tag src={item?.cycle === 'D' ? dayIcon : positionIcon} />
{item?.stockList?.stockIconPath &&
item?.stockList?.stockIconPath.map(
(stock: string, index: number) => (
Expand Down Expand Up @@ -548,11 +551,15 @@ const TraderStrategyList = () => {
<h5>트레이더 전략정보</h5>
</div>
<Table data={tableData || []} columns={columns} />
<Pagination
totalPage={totalPage}
currentPage={currentPage}
handlePageChange={setCurrentPage}
/>
{tableData?.length > 0 ? (
<Pagination
totalPage={totalPage}
currentPage={currentPage}
handlePageChange={setCurrentPage}
/>
) : (
<span css={emptyContents}>트레이더의 전략 정보가 없습니다.</span>
)}
</section>
</div>
);
Expand Down Expand Up @@ -642,6 +649,37 @@ const tableWrapperStyle = css`
flex-direction: column;
gap: 29px;

table > thead > tr > th {
&:nth-of-type(1) {
width: 80px;
}
&:nth-of-type(2) {
width: 202px;
}
&:nth-of-type(3) {
width: 280px;
}
&:nth-of-type(4) {
width: 120px;
}
&:nth-of-type(5) {
width: 120px;
}
&:nth-of-type(6) {
width: 120px;
}
&:nth-of-type(7) {
width: 120px;
}
}

table > tbody > tr > td {
&:nth-of-type(2) div {
display: flex;
justify-content: center;
}
}

.title-area {
position: relative;
padding: 28px 0;
Expand Down Expand Up @@ -723,4 +761,11 @@ const fontStyle = css`
font-weight: ${FONT_WEIGHT.BOLD};
`;

const emptyContents = css`
padding: 32px;
border-radius: 4px;
background: ${COLOR.GRAY100};
text-align: center;
`;

export default TraderStrategyList;
36 changes: 28 additions & 8 deletions src/pages/admin/AdminQna.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { css } from '@emotion/react';
import { useNavigate } from 'react-router-dom';
import dayIcon from '@/assets/images/day-icon.png';
import positionIcon from '@/assets/images/position-icon.png';
import Button from '@/components/Button';
import Loading from '@/components/Loading';
import Modal from '@/components/Modal';
Expand All @@ -16,7 +18,7 @@ import { PATH } from '@/constants/path';
import { useDeleteInquiryList, useGetInquiryList } from '@/hooks/useAdminApi';
import useModalStore from '@/stores/useModalStore';
import { useTableStore } from '@/stores/useTableStore';
import { extractDate } from '@/utils/dataUtils';
import { formatYearMonthFromDateTime } from '@/utils/dataUtils';

interface AdminQnaDataProps {
ranking?: number;
Expand Down Expand Up @@ -141,7 +143,12 @@ const AdminQna = () => {
data: InquiryListData,
refetch: inquiryListDataRefetch,
isLoading,
} = useGetInquiryList(0, getTabValue(tab), selectiedOption, searchText);
} = useGetInquiryList(
currentPage,
getTabValue(tab),
selectiedOption,
searchText
);

const handleOptionChange = (value: string) => {
setSelectedOption(value);
Expand Down Expand Up @@ -190,6 +197,10 @@ const AdminQna = () => {
setCurrentPage(0);
}, [searchText]);

useEffect(() => {
inquiryListDataRefetch();
}, [currentPage, inquiryListDataRefetch]);

const columns: ColumnProps<AdminQnaDataProps>[] = [
{
key: 'ranking',
Expand All @@ -209,11 +220,14 @@ const AdminQna = () => {
render: (_, item) => (
<div css={tagStyle}>
<div className='tag'>
<Tag src={item?.methodIconPath || ''} />
{item?.methodIconPath && (
<Tag src={item.methodIconPath} alt='methodIcon' />
)}
<Tag src={item?.cycle === 'D' ? dayIcon : positionIcon} />
{item?.stockList?.stockIconPath &&
item?.stockList?.stockIconPath.map(
(stock: string, index: number) => (
<Tag key={index} src={stock || ''} alt='tag' />
<Tag key={index} src={stock || ''} alt='stockIcon' />
)
)}
</div>
Expand All @@ -225,7 +239,7 @@ const AdminQna = () => {
key: 'inquiryRegistrationDate',
header: '문의날짜',
render: (_, item) => (
<span>{extractDate(item.inquiryRegistrationDate)}</span>
<span>{formatYearMonthFromDateTime(item.inquiryRegistrationDate)}</span>
),
},
{
Expand Down Expand Up @@ -253,7 +267,13 @@ const AdminQna = () => {
border={true}
width={80}
handleClick={() =>
navigate(PATH.ADMIN_QNA_DETAIL(String(item.inquiryId)))
navigate(PATH.ADMIN_QNA_DETAIL(String(item.inquiryId)), {
state: {
closed: item.inquiryStatus,
searchType: selectiedOption,
searchText,
},
})
}
/>
),
Expand Down Expand Up @@ -290,7 +310,7 @@ const AdminQna = () => {
value={value}
handleKeyDown={(e) => {
if (e.key === 'Enter') {
setSearchText(value);
setSearchText(value.trim());
}
}}
handleChange={(e) => setValue(e.target.value)}
Expand Down Expand Up @@ -339,7 +359,7 @@ const AdminQna = () => {
<Pagination
totalPage={totalPage}
currentPage={currentPage}
handlePageChange={setCurrentPage}
handlePageChange={(newPage) => setCurrentPage(newPage)}
/>
</div>
) : (
Expand Down
Loading