-
Notifications
You must be signed in to change notification settings - Fork 0
관리자 문의 조회 기능 구현 ( #issue 346 ) #352
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2363434
feat: 관리자 문의 목록 조회 기능 추가준비 및 스타일 수정
YouD0313 bfee5c4
feat: 깃허브 링크 업데이트 기능 추가 및 관련 훅 구현
YouD0313 2d1a6b8
feat: 관리자 문의 목록 조회 기능 개선 및 날짜 필터링 추가
YouD0313 1107d10
feat: 날짜 필터링 유효성 검사 추가 및 모달 메시지 개선
YouD0313 badc493
refactor: 깃허브 링크 업데이트 API 수정 및 관리자 문의 목록의 날짜 필터링 로직 개선
YouD0313 607c620
Merge remote-tracking branch 'origin' into feat/#346
YouD0313 b475e93
refactor: useGithubLink 훅에 모달 열기 핸들러 추가 및 AdminRoutes에서 AdminReportDe…
YouD0313 bbe20ec
refactor: ApiCommonBasicType import 방식을 type으로 변경 및 ProfileGithubSucc…
YouD0313 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/components/admin/adminInquiry/AdminInquiryListLookup.styled.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const LookupContainer = styled.nav` | ||
| 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}; | ||
| `; |
128 changes: 128 additions & 0 deletions
128
src/components/admin/adminInquiry/AdminInquiryListLookup.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| 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'; | ||
| 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'; | ||
|
|
||
| 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<AdminInquiryChangeSearchParams, 'userId'> | ||
| >({ | ||
| startDate, | ||
| endDate, | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| const startDate = searchParams.get('startDate') || ''; | ||
| const endDate = searchParams.get('endDate') || ''; | ||
| setSearchFilters({ | ||
| startDate, | ||
| endDate, | ||
| }); | ||
| }, [searchParams, setSearchFilters]); | ||
|
|
||
| const handleSubmitChangeParams = (e: React.FormEvent<HTMLFormElement>) => { | ||
| e.preventDefault(); | ||
|
|
||
| const { startDate, endDate } = searchFilters; | ||
|
|
||
| const newParams = new URLSearchParams(searchParams); | ||
|
|
||
| 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'); | ||
| } | ||
YouD0313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| setSearchParams(newParams); | ||
| }; | ||
|
|
||
| const handleChangeDate = ( | ||
| e: React.ChangeEvent<HTMLInputElement>, | ||
| 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: '' }); | ||
| }; | ||
|
|
||
| return ( | ||
| <S.LookupContainer> | ||
| <S.LookupWrapper onSubmit={handleSubmitChangeParams}> | ||
| <S.LookupUser | ||
| type='text' | ||
| value={nickname} | ||
| placeholder='닉네임을 클릭하세요.' | ||
| readOnly | ||
| /> | ||
| <S.LookupDateWrapper> | ||
| <S.LookupStartDate | ||
| type='date' | ||
| value={searchFilters.startDate} | ||
| onChange={(e) => handleChangeDate(e, 'startDate')} | ||
| /> | ||
| <S.LookupJoinDate> ~ </S.LookupJoinDate> | ||
| <S.LookupEndDate | ||
| type='date' | ||
| value={searchFilters.endDate} | ||
| onChange={(e) => handleChangeDate(e, 'endDate')} | ||
| /> | ||
| </S.LookupDateWrapper> | ||
| <S.LookupIconWrapper> | ||
| {(userId || startDate || endDate) && ( | ||
| <S.IconDefault type='button' onClick={handleClickInit}> | ||
| <XMarkIcon /> | ||
| </S.IconDefault> | ||
| )} | ||
YouD0313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <S.IconSearch type='submit'> | ||
| <MagnifyingGlassIcon /> | ||
| </S.IconSearch> | ||
| </S.LookupIconWrapper> | ||
| </S.LookupWrapper> | ||
| <Modal isOpen={isOpen} onClose={handleModalClose}> | ||
| {message} | ||
| </Modal> | ||
| </S.LookupContainer> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.