261013_02_ENH: 리스트 관리·컨택 진행 화면 모바일 UI 개선
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type ClipboardEvent, type ReactNode } from 'react'
|
||||
import type { PaginationState, SortingState } from '@tanstack/react-table'
|
||||
import { Funnel, PencilLine } from 'lucide-react'
|
||||
import { ChevronDown, Funnel, PencilLine } from 'lucide-react'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover'
|
||||
@@ -13,6 +14,7 @@ import KriDateRangePicker, { type KriDateRange } from '@/components/common/KriDa
|
||||
import ListBatchEditDialog, { type BatchEditPayload, type BatchEditResultCodes, type BatchEditRow, type BatchEditSurveyResultCodes } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog, { operatorLabel } from '@/components/dialog/ListFilterDialog'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useListSearchQuery, useUpdateListMutation } from '@/query/list'
|
||||
import { getListColumns, LIST_IS_USE_LABEL, type ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
import { useAssignTargetRows } from '@/components/assign/AssignTargetList'
|
||||
@@ -72,6 +74,8 @@ export type ListSearchTableProps = {
|
||||
initialSearchState?: ListSearchUiState
|
||||
onSearchStateChange?: (state: ListSearchUiState) => void
|
||||
focusRowId?: string
|
||||
/** 모바일(md 미만)에서 기본 검색 필터를 1열로 쌓고 접기/펼치기 토글을 노출한다. */
|
||||
collapsibleFiltersOnMobile?: boolean
|
||||
}
|
||||
|
||||
const toSidSet = (value: string) =>
|
||||
@@ -197,8 +201,10 @@ export function ListSearchTable({
|
||||
initialSearchState,
|
||||
onSearchStateChange,
|
||||
focusRowId,
|
||||
collapsibleFiltersOnMobile = false,
|
||||
}: ListSearchTableProps) {
|
||||
const { showDialog } = useDialog()
|
||||
const [filtersOpen, setFiltersOpen] = useState(true)
|
||||
const [searchText, setSearchText] = useState(initialSearchState?.searchText ?? '')
|
||||
const [showSidHangulHint, setShowSidHangulHint] = useState(false)
|
||||
const [searchContactResult, setSearchContactResult] = useState<string[]>(initialSearchState?.searchContactResult ?? [])
|
||||
@@ -696,88 +702,132 @@ export function ListSearchTable({
|
||||
resetToFirstPage()
|
||||
}, [externalAssignFilter])
|
||||
|
||||
// md 이상에서는 기존 클래스와 동일하게 렌더링되도록 모바일 전용 값만 분기한다.
|
||||
const filterRowClassName = collapsibleFiltersOnMobile
|
||||
? 'flex flex-col gap-2 md:flex-row md:flex-wrap md:items-center'
|
||||
: 'flex items-center gap-2 flex-wrap'
|
||||
const filterItemClassName = collapsibleFiltersOnMobile
|
||||
? 'w-full md:w-auto md:flex-1 md:min-w-0 md:max-w-xs'
|
||||
: 'flex-1 min-w-0 max-w-xs'
|
||||
const dateFilterClassName = collapsibleFiltersOnMobile
|
||||
? 'w-full md:w-auto md:flex-1 md:min-w-[240px] md:max-w-xs'
|
||||
: 'flex-1 min-w-[240px] max-w-xs'
|
||||
const surveyFilterClassName = collapsibleFiltersOnMobile
|
||||
? 'w-full md:w-auto md:flex-1 md:min-w-[180px] md:max-w-xs'
|
||||
: 'flex-1 min-w-[180px] max-w-xs'
|
||||
|
||||
// 접힌 상태에서도 기본 검색 조건 적용 여부를 알 수 있도록 토글 버튼에 표시한다.
|
||||
const hasActiveFilters =
|
||||
searchText.trim().length > 0 ||
|
||||
searchContactResult.length > 0 ||
|
||||
Boolean(searchContactDateRange.from || searchContactDateRange.to) ||
|
||||
(fieldInterviewEnabled && searchInterviewResult.length > 0) ||
|
||||
Object.values(surveyResultSelections).some((values) => values.length > 0)
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
<Popover open={showSidHangulHint}>
|
||||
<PopoverAnchor asChild>
|
||||
<Input
|
||||
placeholder="SID 검색"
|
||||
className="h-9 bg-white w-full"
|
||||
value={searchText}
|
||||
onChange={(e) => handleSearchTextChange(e.target.value)}
|
||||
onPaste={handleSidPaste}
|
||||
/>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className="w-auto p-2 text-xs text-destructive"
|
||||
onOpenAutoFocus={(e) => e.preventDefault()}
|
||||
>
|
||||
한글은 입력할 수 없습니다. 한/영 전환 후 영문·숫자로 입력해 주세요.
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.CONTACT)}
|
||||
value={searchContactResult}
|
||||
onChange={handleContactResultChange}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="컨택 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<KriDateRangePicker
|
||||
value={searchContactDateRange}
|
||||
onChange={(range) => {
|
||||
setSearchContactDateRange(range)
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}}
|
||||
placeholder="컨택 일자"
|
||||
className="flex-1 min-w-[240px] max-w-xs"
|
||||
/>
|
||||
{fieldInterviewEnabled ? (
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
{collapsibleFiltersOnMobile ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full justify-between md:hidden"
|
||||
aria-expanded={filtersOpen}
|
||||
aria-controls="list-search-filters"
|
||||
onClick={() => setFiltersOpen((prev) => !prev)}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
검색 조건
|
||||
{hasActiveFilters ? <Badge>적용 중</Badge> : null}
|
||||
</span>
|
||||
<ChevronDown className={cn('h-4 w-4 transition-transform', filtersOpen && 'rotate-180')} />
|
||||
</Button>
|
||||
) : null}
|
||||
|
||||
<div
|
||||
id="list-search-filters"
|
||||
className={cn('space-y-2', collapsibleFiltersOnMobile && !filtersOpen && 'hidden md:block')}
|
||||
>
|
||||
<div className={filterRowClassName}>
|
||||
<div className={filterItemClassName}>
|
||||
<Popover open={showSidHangulHint}>
|
||||
<PopoverAnchor asChild>
|
||||
<Input
|
||||
placeholder="SID 검색"
|
||||
className="h-9 bg-white w-full"
|
||||
value={searchText}
|
||||
onChange={(e) => handleSearchTextChange(e.target.value)}
|
||||
onPaste={handleSidPaste}
|
||||
/>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className="w-auto p-2 text-xs text-destructive"
|
||||
onOpenAutoFocus={(e) => e.preventDefault()}
|
||||
>
|
||||
한글은 입력할 수 없습니다. 한/영 전환 후 영문·숫자로 입력해 주세요.
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</div>
|
||||
<div className={filterItemClassName}>
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
|
||||
value={searchInterviewResult}
|
||||
onChange={handleInterviewResultChange}
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.CONTACT)}
|
||||
value={searchContactResult}
|
||||
onChange={handleContactResultChange}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="면접 결과"
|
||||
placeholder="컨택 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<KriDateRangePicker
|
||||
value={searchContactDateRange}
|
||||
onChange={(range) => {
|
||||
setSearchContactDateRange(range)
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}}
|
||||
placeholder="컨택 일자"
|
||||
className={dateFilterClassName}
|
||||
/>
|
||||
{fieldInterviewEnabled ? (
|
||||
<div className={filterItemClassName}>
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
|
||||
value={searchInterviewResult}
|
||||
onChange={handleInterviewResultChange}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="면접 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{surveys.length > 0 ? (
|
||||
<div className={filterRowClassName}>
|
||||
{surveys
|
||||
.filter((survey) => survey.prjctSurveyIdx != null)
|
||||
.map((survey) => (
|
||||
<div key={survey.prjctSurveyIdx} className={surveyFilterClassName}>
|
||||
<KriMultiSelect
|
||||
items={surveyResultCodeOptions}
|
||||
value={surveyResultSelections[survey.prjctSurveyIdx as number] ?? []}
|
||||
onChange={(value) => handleChangeSurveyResult(survey.prjctSurveyIdx as number, value)}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder={`${survey.surveyName} 결과`}
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{surveys.length > 0 ? (
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
{surveys
|
||||
.filter((survey) => survey.prjctSurveyIdx != null)
|
||||
.map((survey) => (
|
||||
<div key={survey.prjctSurveyIdx} className="flex-1 min-w-[180px] max-w-xs">
|
||||
<KriMultiSelect
|
||||
items={surveyResultCodeOptions}
|
||||
value={surveyResultSelections[survey.prjctSurveyIdx as number] ?? []}
|
||||
onChange={(value) => handleChangeSurveyResult(survey.prjctSurveyIdx as number, value)}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder={`${survey.surveyName} 결과`}
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex items-center gap-2 flex-wrap justify-between">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listFilterDialog')}>
|
||||
|
||||
Reference in New Issue
Block a user