From 2363434a30457f86bb861ef67e1c01aba66b9ddb Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:45:45 +0900 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EB=AC=B8=EC=9D=98=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=EC=A4=80=EB=B9=84=20?= =?UTF-8?q?=EB=B0=8F=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/adminInquiry/AdminInquiry.styled.ts | 9 ++++- .../admin/adminInquiry/AdminInquiry.tsx | 16 ++++++++- .../adminInquiry/AdminInquiryList.styled.ts | 3 +- .../admin/adminInquiry/AdminInquiryList.tsx | 33 +++++++++++++++++++ .../AdminInquiryListLookup.styled.ts | 5 +++ .../adminInquiry/AdminInquiryListLookup.tsx | 16 +++++++++ 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts create mode 100644 src/components/admin/adminInquiry/AdminInquiryListLookup.tsx diff --git a/src/components/admin/adminInquiry/AdminInquiry.styled.ts b/src/components/admin/adminInquiry/AdminInquiry.styled.ts index 7e9f145f..f45f978b 100644 --- a/src/components/admin/adminInquiry/AdminInquiry.styled.ts +++ b/src/components/admin/adminInquiry/AdminInquiry.styled.ts @@ -19,7 +19,14 @@ export const AdminInquiryCategory = styled.span` font-weight: 500; `; -export const AdminInquiryUser = styled.div``; +export const AdminInquiryUser = styled.button` + width: fit-content; + font-size: 1.1rem; + z-index: 1; + &:hover { + color: ${({ theme }) => theme.color.navy}; + } +`; export const AdminInquiryDate = styled.span` font-size: 0.9rem; diff --git a/src/components/admin/adminInquiry/AdminInquiry.tsx b/src/components/admin/adminInquiry/AdminInquiry.tsx index da9933b5..6c1c2505 100644 --- a/src/components/admin/adminInquiry/AdminInquiry.tsx +++ b/src/components/admin/adminInquiry/AdminInquiry.tsx @@ -8,12 +8,26 @@ interface AdminInquiryProps { } export default function AdminInquiry({ list }: AdminInquiryProps) { + const handleClickLookupUser = (e: React.MouseEvent) => { + e.stopPropagation(); + e.preventDefault(); + + const userId = e.currentTarget.dataset.id; + + console.log(userId); + }; + return ( [{list.category}] {list.title} - {list.user.nickname} + + {list.user.nickname} + {list.createdAt} {list.state ? '답변완료' : '확인중'} diff --git a/src/components/admin/adminInquiry/AdminInquiryList.styled.ts b/src/components/admin/adminInquiry/AdminInquiryList.styled.ts index 152ad450..1185b650 100644 --- a/src/components/admin/adminInquiry/AdminInquiryList.styled.ts +++ b/src/components/admin/adminInquiry/AdminInquiryList.styled.ts @@ -6,7 +6,8 @@ export const SpinnerWrapper = styled(SpinnerWrapperStyled)``; export const AdminInquiryListContainer = styled.section` width: 100%; display: flex; - justify-content: center; + flex-direction: column; + align-items: center; `; export const AdminInquiryListWrapper = styled.div` diff --git a/src/components/admin/adminInquiry/AdminInquiryList.tsx b/src/components/admin/adminInquiry/AdminInquiryList.tsx index 18ae34bc..ec475882 100644 --- a/src/components/admin/adminInquiry/AdminInquiryList.tsx +++ b/src/components/admin/adminInquiry/AdminInquiryList.tsx @@ -1,11 +1,43 @@ +import { useSearchParams } from 'react-router-dom'; import { useGetAllInquiries } from '../../../hooks/admin/useGetAllInquiries'; import Spinner from '../../user/mypage/Spinner'; import AdminInquiry from './AdminInquiry'; import * as S from './AdminInquiryList.styled'; +import AdminInquiryListLookup from './AdminInquiryListLookup'; +import { useEffect, useState } from 'react'; + +export type SearchParamsType = { + userId?: string; + startDate?: string; + endDate?: string; +}; export default function AdminInquiryList() { + const [childSearchParams, setChildSearchParams] = useState({ + userId: '', + startDate: '', + endDate: '', + }); + const [searchParams, setSearchParams] = useSearchParams(); const { allInquiriesData, isLoading } = useGetAllInquiries(); + const handleSearchParamsChange = (newParams: SearchParamsType) => { + setChildSearchParams((prevParams) => ({ + ...prevParams, + ...newParams, + })); + }; + + useEffect(() => { + const newParams = new URLSearchParams(); + + Object.entries(childSearchParams).forEach(([key, value]) => { + return value ? newParams.set(key, value) : newParams.delete(key); + }); + + setSearchParams(newParams); + }, [childSearchParams, searchParams, setSearchParams]); + if (isLoading) { return ( @@ -18,6 +50,7 @@ export default function AdminInquiryList() { return ( + {allInquiriesData.map((list) => ( diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts b/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts new file mode 100644 index 00000000..60117661 --- /dev/null +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts @@ -0,0 +1,5 @@ +import styled from 'styled-components'; + +export const LookupContainer = styled.nav` + width: 90%; +`; diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx new file mode 100644 index 00000000..285818b2 --- /dev/null +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx @@ -0,0 +1,16 @@ +import type { SearchParamsType } from './AdminInquiryList'; +import * as S from './AdminInquiryListLookup.styled'; + +interface AdminInquiryListLookupProps { + onSearchParamsChange: (params: SearchParamsType) => void; +} + +export default function AdminInquiryListLookup({ + onSearchParamsChange, +}: AdminInquiryListLookupProps) { + return ( + +

문의 목록 조회

+
+ ); +} From bfee5c4177934692814a7d5a1391e4df0f5720d5 Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Tue, 24 Jun 2025 18:06:08 +0900 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=EA=B9=83=ED=97=88=EB=B8=8C=20?= =?UTF-8?q?=EB=A7=81=ED=81=AC=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=9B=85=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mypage.api.ts | 12 ++++++++++++ .../editProfile/ProfileGithubSuccess.tsx | 8 ++++++-- src/hooks/user/useMyInfo.ts | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/api/mypage.api.ts b/src/api/mypage.api.ts index ea03a835..27419872 100644 --- a/src/api/mypage.api.ts +++ b/src/api/mypage.api.ts @@ -1,3 +1,4 @@ +import { ApiCommonBasicType } from '../models/apiCommon'; import type { ApiUserInfo, ApiUserInfoImg, @@ -53,6 +54,17 @@ export const patchMyProfileImg = async (file: File) => { } }; +export const patchGithubLink = async (githubUrl: string) => { + try { + await httpClient.patch('/user/github', { + params: { githubUrl }, + }); + } catch (error) { + console.error('프로필 깃허브 업데이트: ', error); + throw error; + } +}; + export const getMyJoinedProjectList = async () => { try { const response = await httpClient.get( diff --git a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx index 05436891..fbdb8eaa 100644 --- a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx +++ b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx @@ -4,17 +4,21 @@ import { ROUTES } from '../../../../../constants/routes'; import { useModal } from '../../../../../hooks/useModal'; import Modal from '../../../../common/modal/Modal'; import { MODAL_MESSAGE } from '../../../../../constants/user/modalMessage'; +import { useGithubLink } from '../../../../../hooks/user/useMyInfo'; export default function ProfileGithubSuccess() { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); + const { patchGithubLinkMutate } = useGithubLink(); useEffect(() => { (async () => { const githubUrl = searchParams.get('githubUrl'); - console.log(githubUrl); + console.log('githubUrl:', githubUrl); + if (githubUrl) { + patchGithubLinkMutate(githubUrl); handleModalOpen(MODAL_MESSAGE.githubProfileSuccess); setTimeout(() => { navigate(`${ROUTES.mypage}/${ROUTES.mypageEdit}`, { @@ -28,7 +32,7 @@ export default function ProfileGithubSuccess() { }, 1000); } })(); - }, [searchParams, handleModalOpen, navigate]); + }, [searchParams, handleModalOpen, navigate, patchGithubLinkMutate]); return ( diff --git a/src/hooks/user/useMyInfo.ts b/src/hooks/user/useMyInfo.ts index 74279aa0..0728670f 100644 --- a/src/hooks/user/useMyInfo.ts +++ b/src/hooks/user/useMyInfo.ts @@ -8,6 +8,7 @@ import { getMyAppliedStatusList, getMyInfo, getMyJoinedProjectList, + patchGithubLink, patchMyProfileImg, putMyInfo, } from '../../api/mypage.api'; @@ -88,6 +89,24 @@ export const useUploadProfileImg = ( return { uploadProfileImg }; }; +export const useGithubLink = () => { + const queryClient = useQueryClient(); + const isLoggedIn = useAuthStore.getState().isLoggedIn; + + const { mutate: patchGithubLinkMutate } = useMutation< + void, + AxiosError, + string + >({ + mutationFn: (githubUrl: string) => patchGithubLink(githubUrl), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: myInfoKey.myProfile }); + }, + }); + + return { patchGithubLinkMutate, isLoggedIn }; +}; + export const useMyJoinedProjectList = () => { const isLoggedIn = useAuthStore.getState().isLoggedIn; From 2d1a6b883ad5c8e5a2d480ea002184ee1484eaf1 Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Fri, 27 Jun 2025 23:46:56 +0900 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EB=AC=B8=EC=9D=98=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EC=84=A0=20=EB=B0=8F=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=ED=95=84=ED=84=B0=EB=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admin/customerService/inquiry.api.ts | 9 +- .../admin/adminInquiry/AdminInquiry.styled.ts | 21 +++- .../admin/adminInquiry/AdminInquiry.tsx | 24 ++-- .../admin/adminInquiry/AdminInquiryList.tsx | 42 ++----- .../AdminInquiryListLookup.styled.ts | 64 +++++++++- .../adminInquiry/AdminInquiryListLookup.tsx | 109 ++++++++++++++++-- .../inquiresPreview/InquiresPreview.tsx | 9 +- src/constants/user/modalMessage.ts | 2 + src/hooks/admin/useGetAllInquiries.ts | 9 +- src/models/inquiry.ts | 6 + 10 files changed, 240 insertions(+), 55 deletions(-) diff --git a/src/api/admin/customerService/inquiry.api.ts b/src/api/admin/customerService/inquiry.api.ts index a6536a9c..c3228c55 100644 --- a/src/api/admin/customerService/inquiry.api.ts +++ b/src/api/admin/customerService/inquiry.api.ts @@ -1,14 +1,19 @@ import type { ApiCommonBasicType } from '../../../models/apiCommon'; import type { + AdminInquiryChangeSearchParams, ApiAdminInquiry, ApiAdminInquiryDetail, InquiryAnswerBody, } from '../../../models/inquiry'; import { httpClient } from '../../http.api'; -export const getAllInquiries = async () => { +export const getAllInquiries = async ( + childSearchParams: AdminInquiryChangeSearchParams +) => { try { - const response = await httpClient.get(`/inquiry`); + const response = await httpClient.get(`/inquiry`, { + params: childSearchParams, + }); return response.data.data; } catch (e) { console.error('전체 문의 조회 에러', e); diff --git a/src/components/admin/adminInquiry/AdminInquiry.styled.ts b/src/components/admin/adminInquiry/AdminInquiry.styled.ts index f45f978b..e0eea5bc 100644 --- a/src/components/admin/adminInquiry/AdminInquiry.styled.ts +++ b/src/components/admin/adminInquiry/AdminInquiry.styled.ts @@ -19,15 +19,34 @@ export const AdminInquiryCategory = styled.span` font-weight: 500; `; +export const AdminInquiryUserWrapper = styled.div` + position: relative; +`; + export const AdminInquiryUser = styled.button` width: fit-content; font-size: 1.1rem; z-index: 1; + transition: color 0.1s ease-in-out; &:hover { - color: ${({ theme }) => theme.color.navy}; + color: ${({ theme }) => theme.color.lightnavy}; } `; +export const AdminInquiryUserCheckDropdown = styled.div` + position: absolute; + top: 0.8rem; + right: 0; + background: ${({ theme }) => theme.color.white}; + border-radius: ${({ theme }) => theme.borderRadius.primary}; + border: 1px solid ${({ theme }) => theme.color.lightgrey}; + padding: 0.3rem 0.5rem; + z-index: 100000; + box-shadow: 3px 2px 19px -6px rgba(0, 0, 0, 0.75); + -webkit-box-shadow: 3px 2px 19px -6px rgba(0, 0, 0, 0.75); + -moz-box-shadow: 3px 2px 19px -6px rgba(0, 0, 0, 0.75); +`; + export const AdminInquiryDate = styled.span` font-size: 0.9rem; color: ${({ theme }) => theme.color.deepGrey}; diff --git a/src/components/admin/adminInquiry/AdminInquiry.tsx b/src/components/admin/adminInquiry/AdminInquiry.tsx index 6c1c2505..61a9edd0 100644 --- a/src/components/admin/adminInquiry/AdminInquiry.tsx +++ b/src/components/admin/adminInquiry/AdminInquiry.tsx @@ -1,3 +1,4 @@ +import { useSearchParams } from 'react-router-dom'; import { ADMIN_ROUTE } from '../../../constants/routes'; import type { AdminInquiry as TAdminInquiry } from '../../../models/inquiry'; import ContentBorder from '../../common/contentBorder/ContentBorder'; @@ -8,13 +9,21 @@ interface AdminInquiryProps { } export default function AdminInquiry({ list }: AdminInquiryProps) { + const [searchParams, setSearchParams] = useSearchParams(); + const handleClickLookupUser = (e: React.MouseEvent) => { e.stopPropagation(); e.preventDefault(); - const userId = e.currentTarget.dataset.id; + const id = String(list.user.id); + const userId = id || ''; + const nickname = list.user.nickname; + + const newParams = new URLSearchParams(searchParams); + newParams.set('userId', userId); + newParams.set('nickname', nickname); - console.log(userId); + setSearchParams(newParams); }; return ( @@ -22,12 +31,11 @@ export default function AdminInquiry({ list }: AdminInquiryProps) { [{list.category}] {list.title} - - {list.user.nickname} - + + + {list.user.nickname} + + {list.createdAt} {list.state ? '답변완료' : '확인중'} diff --git a/src/components/admin/adminInquiry/AdminInquiryList.tsx b/src/components/admin/adminInquiry/AdminInquiryList.tsx index ec475882..8804b253 100644 --- a/src/components/admin/adminInquiry/AdminInquiryList.tsx +++ b/src/components/admin/adminInquiry/AdminInquiryList.tsx @@ -4,39 +4,19 @@ import Spinner from '../../user/mypage/Spinner'; import AdminInquiry from './AdminInquiry'; import * as S from './AdminInquiryList.styled'; import AdminInquiryListLookup from './AdminInquiryListLookup'; -import { useEffect, useState } from 'react'; - -export type SearchParamsType = { - userId?: string; - startDate?: string; - endDate?: string; -}; +import type { AdminInquiryChangeSearchParams } from '../../../models/inquiry'; +export type SearchParamsInquiryKeyType = keyof AdminInquiryChangeSearchParams; export default function AdminInquiryList() { - const [childSearchParams, setChildSearchParams] = useState({ - userId: '', - startDate: '', - endDate: '', - }); const [searchParams, setSearchParams] = useSearchParams(); - const { allInquiriesData, isLoading } = useGetAllInquiries(); - - const handleSearchParamsChange = (newParams: SearchParamsType) => { - setChildSearchParams((prevParams) => ({ - ...prevParams, - ...newParams, - })); - }; - - useEffect(() => { - const newParams = new URLSearchParams(); - - Object.entries(childSearchParams).forEach(([key, value]) => { - return value ? newParams.set(key, value) : newParams.delete(key); - }); - - setSearchParams(newParams); - }, [childSearchParams, searchParams, setSearchParams]); + const userId = searchParams.get('userId') || ''; + const startDate = searchParams.get('startDate') || ''; + const endDate = searchParams.get('endDate') || ''; + const { allInquiriesData, isLoading } = useGetAllInquiries({ + userId, + startDate, + endDate, + }); if (isLoading) { return ( @@ -50,7 +30,7 @@ export default function AdminInquiryList() { return ( - + {allInquiriesData.map((list) => ( diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts b/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts index 60117661..c530d158 100644 --- a/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts @@ -1,5 +1,67 @@ import styled from 'styled-components'; export const LookupContainer = styled.nav` - width: 90%; + width: 80%; + margin-bottom: 1rem; + + input[type='date'] { + position: relative; + padding: 14px; + width: 150px; + height: 30px; + font-size: 14px; + color: ${({ theme }) => theme.color.placeholder}; + border: none; + border-bottom: 1px solid ${({ theme }) => theme.color.grey}; + } + input[type='date']::-webkit-calendar-picker-indicator { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: auto; + height: auto; + color: transparent; + background: transparent; + } +`; + +export const LookupWrapper = styled.form` + display: flex; + justify-content: space-between; +`; + +export const LookupUser = styled.input` + border-bottom: 1px solid ${({ theme }) => theme.color.placeholder}; + width: fit-content; +`; + +export const LookupDateWrapper = styled.div` + display: flex; + gap: 1rem; +`; + +export const LookupStartDate = styled.input``; + +export const LookupJoinDate = styled.span``; + +export const LookupEndDate = styled.input``; + +export const LookupIconWrapper = styled.div` + display: flex; + gap: 2rem; + + svg { + width: 1.5rem; + height: 1.5rem; + } +`; + +export const IconDefault = styled.button` + color: ${({ theme }) => theme.color.deepGrey}; +`; + +export const IconSearch = styled.button` + color: ${({ theme }) => theme.color.deepGrey}; `; diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx index 285818b2..f96ab380 100644 --- a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx @@ -1,16 +1,109 @@ -import type { SearchParamsType } from './AdminInquiryList'; +import React, { useState } from 'react'; +import type { SearchParamsInquiryKeyType } from './AdminInquiryList'; import * as S from './AdminInquiryListLookup.styled'; +import { MagnifyingGlassIcon, XMarkIcon } from '@heroicons/react/24/outline'; +import { useSearchParams } from 'react-router-dom'; +import { AdminInquiryChangeSearchParams } from '../../../models/inquiry'; +import Modal from '../../common/modal/Modal'; +import { useModal } from '../../../hooks/useModal'; +import { MODAL_MESSAGE } from '../../../constants/user/modalMessage'; -interface AdminInquiryListLookupProps { - onSearchParamsChange: (params: SearchParamsType) => void; -} +export default function AdminInquiryListLookup() { + const [searchParams, setSearchParams] = useSearchParams(); + const userId = searchParams.get('userId') || ''; + const startDate = searchParams.get('startDate') || ''; + const endDate = searchParams.get('endDate') || ''; + const nickname = searchParams.get('nickname') || ''; + const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); + const [searchFilters, setSearchFilters] = useState< + Omit + >({ + startDate, + endDate, + }); + + const handleSubmitChangeParams = (e: React.FormEvent) => { + e.preventDefault(); + + const newParams = new URLSearchParams(searchParams); + + Object.entries(searchFilters).forEach(([key, value]) => + value ? newParams.set(key, value) : newParams.delete(key) + ); + + setSearchParams(newParams); + }; + + const handleChangeDate = ( + e: React.ChangeEvent, + key: SearchParamsInquiryKeyType + ) => { + const value = e.currentTarget.value; + + setSearchFilters((prev) => { + switch (key) { + case 'startDate': { + if (prev.endDate !== '' && prev.endDate < value) { + handleModalOpen(MODAL_MESSAGE.startDateInvalid); + return prev; + } + return { ...prev, startDate: value }; + } + case 'endDate': { + if (prev.startDate !== '' && prev.startDate > value) { + handleModalOpen(MODAL_MESSAGE.endDateInvalid); + return prev; + } + return { ...prev, endDate: value }; + } + default: { + return prev; + } + } + }); + }; + + const handleClickInit = () => { + setSearchParams({}); + setSearchFilters({ startDate: '', endDate: '' }); + }; -export default function AdminInquiryListLookup({ - onSearchParamsChange, -}: AdminInquiryListLookupProps) { return ( -

문의 목록 조회

+ + + + handleChangeDate(e, 'startDate')} + /> + ~ + handleChangeDate(e, 'endDate')} + /> + + + {(userId || startDate || endDate) && ( + + + + )} + + + + + + + {message} +
); } diff --git a/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.tsx b/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.tsx index 57cea21c..030a8177 100644 --- a/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.tsx +++ b/src/components/admin/previewComponent/inquiresPreview/InquiresPreview.tsx @@ -4,9 +4,16 @@ import Avatar from '../../../common/avatar/Avatar'; import { ADMIN_ROUTE } from '../../../../constants/routes'; import arrow_right from '../../../../assets/ArrowRight.svg'; import Spinner from '../../../user/mypage/Spinner'; +import { AdminInquiryChangeSearchParams } from '../../../../models/inquiry'; const InquiresPreview = () => { - const { allInquiriesData, isLoading, isFetching } = useGetAllInquiries(); + const childSearchParams: AdminInquiryChangeSearchParams = { + userId: '', + startDate: '', + endDate: '', + }; + const { allInquiriesData, isLoading, isFetching } = + useGetAllInquiries(childSearchParams); if (isLoading || isFetching) { return ( diff --git a/src/constants/user/modalMessage.ts b/src/constants/user/modalMessage.ts index 09d59fe1..eb146fb6 100644 --- a/src/constants/user/modalMessage.ts +++ b/src/constants/user/modalMessage.ts @@ -32,4 +32,6 @@ export const MODAL_MESSAGE = { emptySkillImg: '스킬 이미지를 추가하세요.', githubProfileFail: '깃허브 프로필 등록에 실패했습니다. 다시 시도해주세요.', githubProfileSuccess: '깃허브 프로필이 성공적으로 등록되었습니다!', + startDateInvalid: '시작일은 종료일 이전으로 설정해주세요.', + endDateInvalid: '종료일은 시작일 이후로 설정해주세요.', } as const; diff --git a/src/hooks/admin/useGetAllInquiries.ts b/src/hooks/admin/useGetAllInquiries.ts index 5f7fc046..bcd9b5ef 100644 --- a/src/hooks/admin/useGetAllInquiries.ts +++ b/src/hooks/admin/useGetAllInquiries.ts @@ -1,15 +1,18 @@ import { useQuery } from '@tanstack/react-query'; import { Inquiries } from '../queries/keys'; import { getAllInquiries } from '../../api/admin/customerService/inquiry.api'; +import { AdminInquiryChangeSearchParams } from '../../models/inquiry'; -export const useGetAllInquiries = () => { +export const useGetAllInquiries = ( + childSearchParams: AdminInquiryChangeSearchParams +) => { const { data: allInquiriesData, isLoading, isFetching, } = useQuery({ - queryKey: [Inquiries.allInquiries], - queryFn: () => getAllInquiries(), + queryKey: [Inquiries.allInquiries, childSearchParams], + queryFn: () => getAllInquiries(childSearchParams), }); return { allInquiriesData, isLoading, isFetching }; diff --git a/src/models/inquiry.ts b/src/models/inquiry.ts index 5b2e46e1..6bb4b4fd 100644 --- a/src/models/inquiry.ts +++ b/src/models/inquiry.ts @@ -7,6 +7,12 @@ export interface InquiryFormData { content: string; } +export interface AdminInquiryChangeSearchParams { + userId: string; + startDate: string; + endDate: string; +} + export interface AdminInquiry { id: number; title: string; From 1107d10b9f1cc603fbb3c4e53292c0dafbb7c624 Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Mon, 30 Jun 2025 18:04:54 +0900 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=EB=82=A0=EC=A7=9C=20=ED=95=84?= =?UTF-8?q?=ED=84=B0=EB=A7=81=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminInquiry/AdminInquiryListLookup.tsx | 16 +++++++++++++--- .../editProfile/ProfileGithubSuccess.tsx | 1 - src/constants/user/modalMessage.ts | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx index f96ab380..3d044ca4 100644 --- a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx @@ -25,11 +25,21 @@ export default function AdminInquiryListLookup() { const handleSubmitChangeParams = (e: React.FormEvent) => { e.preventDefault(); + const { startDate, endDate } = searchFilters; + const newParams = new URLSearchParams(searchParams); - Object.entries(searchFilters).forEach(([key, value]) => - value ? newParams.set(key, value) : newParams.delete(key) - ); + if (startDate && !endDate) { + return handleModalOpen(MODAL_MESSAGE.endDateEmpty); + } else if (!startDate && endDate) { + return handleModalOpen(MODAL_MESSAGE.startDateEmpty); + } else if (startDate && endDate) { + newParams.set('startDate', startDate); + newParams.set('endDate', endDate); + } else { + newParams.delete('startDate'); + newParams.delete('endDate'); + } setSearchParams(newParams); }; diff --git a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx index fbdb8eaa..0eb80937 100644 --- a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx +++ b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx @@ -15,7 +15,6 @@ export default function ProfileGithubSuccess() { useEffect(() => { (async () => { const githubUrl = searchParams.get('githubUrl'); - console.log('githubUrl:', githubUrl); if (githubUrl) { patchGithubLinkMutate(githubUrl); diff --git a/src/constants/user/modalMessage.ts b/src/constants/user/modalMessage.ts index eb146fb6..bd355ecc 100644 --- a/src/constants/user/modalMessage.ts +++ b/src/constants/user/modalMessage.ts @@ -32,6 +32,8 @@ export const MODAL_MESSAGE = { emptySkillImg: '스킬 이미지를 추가하세요.', githubProfileFail: '깃허브 프로필 등록에 실패했습니다. 다시 시도해주세요.', githubProfileSuccess: '깃허브 프로필이 성공적으로 등록되었습니다!', + startDateEmpty: '시작일을 선택해주세요.', startDateInvalid: '시작일은 종료일 이전으로 설정해주세요.', + endDateEmpty: '종료일을 선택해주세요.', endDateInvalid: '종료일은 시작일 이후로 설정해주세요.', } as const; From badc4932cce861f7e1eef291e2d47fc43703276c Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:58:46 +0900 Subject: [PATCH 5/7] =?UTF-8?q?refactor:=20=EA=B9=83=ED=97=88=EB=B8=8C=20?= =?UTF-8?q?=EB=A7=81=ED=81=AC=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20API?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=20=EB=AC=B8=EC=9D=98=20=EB=AA=A9=EB=A1=9D=EC=9D=98=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=ED=95=84=ED=84=B0=EB=A7=81=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mypage.api.ts | 4 +--- .../admin/adminInquiry/AdminInquiryListLookup.tsx | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/api/mypage.api.ts b/src/api/mypage.api.ts index 27419872..055a2525 100644 --- a/src/api/mypage.api.ts +++ b/src/api/mypage.api.ts @@ -56,9 +56,7 @@ export const patchMyProfileImg = async (file: File) => { export const patchGithubLink = async (githubUrl: string) => { try { - await httpClient.patch('/user/github', { - params: { githubUrl }, - }); + await httpClient.patch('/user/github', { githubUrl }); } catch (error) { console.error('프로필 깃허브 업데이트: ', error); throw error; diff --git a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx index 3d044ca4..f5984ef9 100644 --- a/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx +++ b/src/components/admin/adminInquiry/AdminInquiryListLookup.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import type { SearchParamsInquiryKeyType } from './AdminInquiryList'; import * as S from './AdminInquiryListLookup.styled'; import { MagnifyingGlassIcon, XMarkIcon } from '@heroicons/react/24/outline'; @@ -22,6 +22,15 @@ export default function AdminInquiryListLookup() { endDate, }); + useEffect(() => { + const startDate = searchParams.get('startDate') || ''; + const endDate = searchParams.get('endDate') || ''; + setSearchFilters({ + startDate, + endDate, + }); + }, [searchParams, setSearchFilters]); + const handleSubmitChangeParams = (e: React.FormEvent) => { e.preventDefault(); From b475e93ba254138ccd28922a1bf6a4c281a12e39 Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Tue, 1 Jul 2025 16:54:08 +0900 Subject: [PATCH 6/7] =?UTF-8?q?refactor:=20useGithubLink=20=ED=9B=85?= =?UTF-8?q?=EC=97=90=20=EB=AA=A8=EB=8B=AC=20=EC=97=B4=EA=B8=B0=20=ED=95=B8?= =?UTF-8?q?=EB=93=A4=EB=9F=AC=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20AdminRout?= =?UTF-8?q?es=EC=97=90=EC=84=9C=20AdminReportDetail=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myProfile/editProfile/ProfileGithubSuccess.tsx | 2 +- src/hooks/user/useMyInfo.ts | 10 +++++++++- src/routes/AdminRoutes.tsx | 14 +++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx index 0eb80937..c7a8cda9 100644 --- a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx +++ b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx @@ -10,7 +10,7 @@ export default function ProfileGithubSuccess() { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const { isOpen, message, handleModalOpen, handleModalClose } = useModal(); - const { patchGithubLinkMutate } = useGithubLink(); + const { patchGithubLinkMutate } = useGithubLink(handleModalOpen); useEffect(() => { (async () => { diff --git a/src/hooks/user/useMyInfo.ts b/src/hooks/user/useMyInfo.ts index 0728670f..9860023f 100644 --- a/src/hooks/user/useMyInfo.ts +++ b/src/hooks/user/useMyInfo.ts @@ -89,8 +89,9 @@ export const useUploadProfileImg = ( return { uploadProfileImg }; }; -export const useGithubLink = () => { +export const useGithubLink = (onModalOpen: (message: string) => void) => { const queryClient = useQueryClient(); + const navigate = useNavigate(); const isLoggedIn = useAuthStore.getState().isLoggedIn; const { mutate: patchGithubLinkMutate } = useMutation< @@ -101,6 +102,13 @@ export const useGithubLink = () => { mutationFn: (githubUrl: string) => patchGithubLink(githubUrl), onSuccess: () => { queryClient.invalidateQueries({ queryKey: myInfoKey.myProfile }); + onModalOpen(MODAL_MESSAGE.githubProfileSuccess); + }, + onError: () => { + onModalOpen(MODAL_MESSAGE.githubProfileFail); + setTimeout(() => { + navigate(`${ROUTES.mypage}/${ROUTES.mypageEdit}`); + }, 1000); }, }); diff --git a/src/routes/AdminRoutes.tsx b/src/routes/AdminRoutes.tsx index 725eb2f0..2ec80a06 100644 --- a/src/routes/AdminRoutes.tsx +++ b/src/routes/AdminRoutes.tsx @@ -18,9 +18,9 @@ const ActivityLog = lazy( const Notifications = lazy( () => import('../components/user/mypage/notifications/Notifications') ); -const AdminReportDetail = lazy( - () => import('../components/admin/adminUserReport/AdminReportDetail') -); +// const AdminReportDetail = lazy( +// () => import('../components/admin/adminUserReport/AdminReportDetail') +// ); const Sidebar = lazy( () => import('../components/common/admin/sidebar/AdminSidebar') ); @@ -225,10 +225,10 @@ export const AdminRoutes = () => { path: ADMIN_ROUTE.reports, element: , }, - { - path: `${ADMIN_ROUTE.reports}/:id`, - element: , - }, + // { + // path: `${ADMIN_ROUTE.reports}/:id`, + // element: , + // }, { path: ADMIN_ROUTE.inquiries, element: , From bbe20ec46f04b61c357a413fc5659796c122c266 Mon Sep 17 00:00:00 2001 From: YouD0313 <102004480+YouD0313@users.noreply.github.com> Date: Tue, 1 Jul 2025 16:59:55 +0900 Subject: [PATCH 7/7] =?UTF-8?q?refactor:=20ApiCommonBasicType=20import=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9D=84=20type=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20ProfileGithubSuccess=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=AA=A8=EB=8B=AC=20=EB=B0=8F=20=EB=82=B4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EB=A1=9C=EC=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mypage.api.ts | 2 +- .../myProfile/editProfile/ProfileGithubSuccess.tsx | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/api/mypage.api.ts b/src/api/mypage.api.ts index 8c1c2a65..e600ac7b 100644 --- a/src/api/mypage.api.ts +++ b/src/api/mypage.api.ts @@ -1,4 +1,4 @@ -import { ApiCommonBasicType } from '../models/apiCommon'; +import type { ApiCommonBasicType } from '../models/apiCommon'; import type { ApiUserInfo, ApiUserInfoImg, diff --git a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx index c7a8cda9..eb856cd0 100644 --- a/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx +++ b/src/components/user/mypage/myProfile/editProfile/ProfileGithubSuccess.tsx @@ -18,17 +18,6 @@ export default function ProfileGithubSuccess() { if (githubUrl) { patchGithubLinkMutate(githubUrl); - handleModalOpen(MODAL_MESSAGE.githubProfileSuccess); - setTimeout(() => { - navigate(`${ROUTES.mypage}/${ROUTES.mypageEdit}`, { - state: { githubUrl }, - }); - }, 1000); - } else { - handleModalOpen(MODAL_MESSAGE.githubProfileFail); - setTimeout(() => { - navigate(`${ROUTES.mypage}/${ROUTES.mypageEdit}`); - }, 1000); } })(); }, [searchParams, handleModalOpen, navigate, patchGithubLinkMutate]);