260702_01_ENH: 리스트 작업 도중 공용 ui를 적용하기 위한 중간 커밋

This commit is contained in:
2026-07-02 17:02:17 +09:00
parent 6944064377
commit a8ce35f5bf
111 changed files with 2833 additions and 2557 deletions

View File

@@ -50,8 +50,8 @@ export function KriMultiSelect<T = unknown>({
placeholder = 'Select options',
widthClassName,
heightClassName,
spanClassName = "content-text-lg",
badgeClassName = "content-text-lg",
spanClassName = "text-lg",
badgeClassName = "text-lg",
className,
getValue,
getLabel,
@@ -89,7 +89,7 @@ export function KriMultiSelect<T = unknown>({
onInfoChange={onItemsChange}
maxSelected={maxSelected}
placeholder={placeholder}
className={cn("bg-white content-text-lg", className)}
className={cn("bg-white text-lg", className)}
spanClassName={spanClassName}
badgeClassName={badgeClassName}
searchable={searchable}
@@ -133,8 +133,8 @@ export function KriSingleSelect<T = unknown>({
placeholder = 'Select an option',
heightClassName,
widthClassName,
spanClassName = "content-text-lg",
badgeClassName = "content-text-lg",
spanClassName = "text-lg",
badgeClassName = "text-lg",
className,
getValue,
getLabel,
@@ -216,7 +216,7 @@ export function KriSingleSelect<T = unknown>({
maxCount={1}
maxSelected={1}
placeholder={placeholder}
className={cn("bg-white content-text-lg", className)}
className={cn("bg-white text-lg", className)}
spanClassName={spanClassName}
badgeClassName={badgeClassName}
searchable={searchable}

View File

@@ -0,0 +1,120 @@
'use client'
import { useRef } from 'react'
import { CalendarDays, X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
export type KriDateRange = {
from: string
to: string
}
type KriDateRangePickerProps = {
value: KriDateRange
onChange: (value: KriDateRange) => void
placeholder?: string
className?: string
triggerClassName?: string
contentClassName?: string
disabled?: boolean
}
export function KriDateRangePicker({
value,
onChange,
placeholder = '조회 기간 선택',
className,
triggerClassName,
contentClassName,
disabled = false,
}: KriDateRangePickerProps) {
const toInputRef = useRef<HTMLInputElement | null>(null)
const displayText = value.from && value.to
? `${value.from} ~ ${value.to}`
: value.from
? `${value.from} ~`
: value.to
? `~ ${value.to}`
: placeholder
const hasValue = value.from.length > 0 || value.to.length > 0
const invalidRange = value.from.length > 0 && value.to.length > 0 && value.from > value.to
const focusAndOpenToDate = () => {
const input = toInputRef.current
if (!input) return
input.focus()
const inputWithPicker = input as HTMLInputElement & { showPicker?: () => void }
inputWithPicker.showPicker?.()
if (!inputWithPicker.showPicker) {
input.click()
}
}
return (
<div className={cn('flex items-center gap-2', className)}>
<Popover>
<PopoverTrigger asChild>
<Button
type="button"
variant="outline"
disabled={disabled}
className={cn('justify-start min-w-[260px] font-normal', triggerClassName)}
>
<CalendarDays className="w-4 h-4" />
<span className="truncate">{displayText}</span>
</Button>
</PopoverTrigger>
<PopoverContent align="start" className={cn('w-[360px] space-y-3', contentClassName)}>
<Label className="font-semibold">조회 기간</Label>
<div className="flex items-center gap-2">
<Input
type="date"
value={value.from}
onChange={(e) => {
const nextFrom = e.target.value
onChange({ ...value, from: nextFrom })
if (nextFrom) {
requestAnimationFrame(() => {
focusAndOpenToDate()
})
}
}}
/>
<span className="text-sm text-muted-foreground">~</span>
<Input
ref={toInputRef}
type="date"
value={value.to}
onChange={(e) => onChange({ ...value, to: e.target.value })}
/>
</div>
{invalidRange && (
<p className="text-xs text-red-600">조회 시작일은 종료일보다 이후일 수 없습니다.</p>
)}
</PopoverContent>
</Popover>
<Button
type="button"
variant="ghost"
size="icon-sm"
onClick={() => onChange({ from: '', to: '' })}
disabled={disabled || !hasValue}
aria-label="조회 기간 초기화"
>
<X className="w-4 h-4" />
</Button>
</div>
)
}
export default KriDateRangePicker

View File

@@ -1,5 +1,6 @@
'use client'
import type { CSSProperties } from 'react'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { cn } from '@/lib/utils'
@@ -9,78 +10,86 @@ export type KriSelectItem = {
}
type KriSelectProps<T> = {
/** options 배열: string[] 혹은 T[] */
items: T[]
/** 현재 선택 값 */
value: string
/** 값 변경 시 호출 */
onChange?: (value: string) => void
/** 옵션 변경시 호출 */
onChangeOption?: (option: T) => void
/** placeholder 텍스트 */
placeholder?: string
/** 기타 클래스 (예: 'w-40') */
className?: string
/** value를 어떻게 뽑을지 (없으면 String(item)) */
heightClassName?: string
triggerTextClassName?: string
contentClassName?: string
itemClassName?: string
getValue?: (item: T) => string
/** label을 어떻게 뽑을지 (없으면 String(item)) */
getLabel?: (item: T) => string
/** 전체 사용 여부 */
useAll?: boolean
}
const HEIGHT_CLASS_VALUE: Record<string, CSSProperties['height']> = {
'h-6': '1.5rem',
'h-7': '1.75rem',
'h-8': '2rem',
'h-9': '2.25rem',
'h-10': '2.5rem',
}
export function KriSelect<T>({
items,
value,
onChange,
onChangeOption,
placeholder,
className,
getValue,
getLabel,
useAll = true,
}: KriSelectProps<T>) {
const extractValue = (item: T) =>
getValue ? getValue(item) : String(item);
const extractLabel = (item: T) =>
getLabel ? getLabel(item) : String(item);
items,
value,
onChange,
onChangeOption,
placeholder,
className,
heightClassName,
triggerTextClassName = 'text-lg',
contentClassName,
itemClassName,
getValue,
getLabel,
useAll = true,
}: KriSelectProps<T>) {
const extractValue = (item: T) => (getValue ? getValue(item) : String(item))
const extractLabel = (item: T) => (getLabel ? getLabel(item) : String(item))
const triggerStyle: CSSProperties | undefined = heightClassName
? { height: HEIGHT_CLASS_VALUE[heightClassName] ?? undefined }
: undefined
return (
<Select
value={value}
onValueChange={(v) => {
onChange?.(v);
<Select
value={value}
onValueChange={(v) => {
onChange?.(v)
const selected = items.find((item) => extractValue(item) === v);
if(selected) {
onChangeOption?.(selected);
}
}}
const selected = items.find((item) => extractValue(item) === v)
if (selected) {
onChangeOption?.(selected)
}
}}
>
<SelectTrigger
className={cn('w-fit whitespace-nowrap bg-white', triggerTextClassName, heightClassName, className)}
style={triggerStyle}
aria-label={placeholder ?? 'select'}
>
<SelectTrigger
className={cn(
'w-fit whitespace-nowrap bg-white content-text-lg', // 폰트 사이즈
className
)}
aria-label={placeholder ?? 'select'}
>
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{ useAll? <SelectItem key="ALL" value="ALL">전체</SelectItem> :null }
{items.map((item, idx) => {
const v = extractValue(item);
const label = extractLabel(item);
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent className={contentClassName}>
{useAll ? (
<SelectItem key="ALL" value="ALL" className={itemClassName}>
전체
</SelectItem>
) : null}
{items.map((item, idx) => {
const v = extractValue(item)
const label = extractLabel(item)
return (
<SelectItem key={v ?? idx} value={v}>
{label}
</SelectItem>
)
})}
</SelectContent>
</Select>
return (
<SelectItem key={v ?? idx} value={v} className={itemClassName}>
{label}
</SelectItem>
)
})}
</SelectContent>
</Select>
)
}

View File

@@ -48,7 +48,7 @@ export function DataTable<TData>({
defaultPageSize = 10,
pageSizeOptions = [5, 10, 25, 50],
paginationItemsToDisplay = 5
}: DataTableProps<TData>) {
}: Readonly<DataTableProps<TData>>) {
// Pagination state
const [pagination, setPagination] = useState<PaginationState>({
pageIndex: 0,
@@ -199,7 +199,7 @@ export function DataTable<TData>({
<TableHead
key={header.id}
className={cn(
'content-text-lg font-semibold text-gray-900',
'text-lg font-semibold text-gray-900',
column.id === 'actions' && 'w-[140px] text-center'
)}
style={{ width: header.getSize() !== 150 ? header.getSize() : undefined }}
@@ -208,7 +208,7 @@ export function DataTable<TData>({
<Button
type='button'
variant='ghost'
className='px-0 font-semibold content-text-lg flex items-center gap-1'
className='px-0 font-semibold text-lg flex items-center gap-1'
onClick={column.getToggleSortingHandler()}
>
<span>{headerContent}</span>
@@ -239,7 +239,7 @@ export function DataTable<TData>({
onPointerCancel={drag.onPointerCancel}
onClick={drag.wrapClick(() => handleRowClick(row))}
className={cn(
'content-text-base',
'text-base',
'[&>td]:py-0 [&>td]:px-2',
selectMode !== 'none' && 'cursor-pointer',
'data-[state=selected]:bg-slate-100 data-[state=selected]:font-semibold',

View File

@@ -124,7 +124,7 @@ const ListBatchEditDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[900px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">일괄 수정</DialogTitle>
<DialogTitle className="text-2xl font-bold">일괄 수정</DialogTitle>
</DialogHeader>
<div className="space-y-4">

View File

@@ -0,0 +1,39 @@
'use client'
import {Label} from "@/components/ui/label";
import {RadioGroup, RadioGroupItem} from "@/components/ui/radio-group";
import type { ListFilterTarget } from "@/types/list";
export type ApplyFilterOptionValue = ListFilterTarget
type ApplyFilterGroupProps = {
value: ApplyFilterOptionValue
onValueChange: (value: ApplyFilterOptionValue) => void
idPrefix: string
}
const ApplyFilterOption = ({ value, onValueChange, idPrefix }: ApplyFilterGroupProps) => {
return (
<RadioGroup
value={value}
onValueChange={(next) => onValueChange(next as ApplyFilterOptionValue)}
className="flex items-center gap-6 flex-wrap"
>
<div className="flex items-center gap-2">
<RadioGroupItem value="selected" id={`${idPrefix}-selected`} />
<Label htmlFor={`${idPrefix}-selected`}>선택 항목만</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="filtered" id={`${idPrefix}-filtered`} />
<Label htmlFor={`${idPrefix}-filtered`}>필터 적용 대상만</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="all" id={`${idPrefix}-all`} />
<Label htmlFor={`${idPrefix}-all`}>전체 대상</Label>
</div>
</RadioGroup>
)
}
export default ApplyFilterOption

View File

@@ -8,15 +8,16 @@ import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
import { useDialog } from '@/hooks/useDialog'
import type { DialogId } from '@/store/jotai/dialog'
export type ListDownloadMode = 'list' | 'contact-history' | 'list-change-history' | 'upload-file'
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
import KriDateRangePicker from '@/components/common/KriDateRangePicker'
import type { ContactHistoryDownloadType, ListDownloadMode, ListDownloadPayload, ListFilterTarget } from '@/types/list'
export type ListDownloadDialogProps = {
dialogId?: DialogId
open?: boolean
onOpenChange?: (open: boolean) => void
mode: ListDownloadMode
onDownload: (payload: { mode: ListDownloadMode; onlyFiltered: boolean }) => void | Promise<void>
onDownload: (payload: ListDownloadPayload) => void | Promise<void>
}
const titleMap: Record<ListDownloadMode, string> = {
@@ -34,7 +35,10 @@ const ListDownloadDialog = ({
onDownload,
}: ListDownloadDialogProps) => {
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const [scope, setScope] = useState<'filtered' | 'all'>('filtered')
const [target, setTarget] = useState<ListFilterTarget>('filtered')
const [contactHistoryDateFrom, setContactHistoryDateFrom] = useState('')
const [contactHistoryDateTo, setContactHistoryDateTo] = useState('')
const [contactHistoryType, setContactHistoryType] = useState<ContactHistoryDownloadType>('all')
const [submitting, setSubmitting] = useState(false)
const resolvedOpen = open ?? isDialogOpen(dialogId)
@@ -49,9 +53,29 @@ const ListDownloadDialog = ({
}
const handleDownload = async () => {
if (mode === 'contact-history') {
const hasFrom = contactHistoryDateFrom.length > 0
const hasTo = contactHistoryDateTo.length > 0
if (hasFrom !== hasTo) {
alert('조회 기간은 시작일과 종료일을 모두 입력해 주세요.')
return
}
if (hasFrom && hasTo && contactHistoryDateFrom > contactHistoryDateTo) {
alert('조회 시작일은 종료일보다 이후일 수 없습니다.')
return
}
}
setSubmitting(true)
try {
await onDownload({ mode, onlyFiltered: scope === 'filtered' })
await onDownload({
mode,
target,
onlyFiltered: target === 'filtered',
contactHistoryDateFrom: mode === 'contact-history' ? contactHistoryDateFrom || undefined : undefined,
contactHistoryDateTo: mode === 'contact-history' ? contactHistoryDateTo || undefined : undefined,
contactHistoryType: mode === 'contact-history' ? contactHistoryType : undefined,
})
handleOpenChange(false)
} finally {
setSubmitting(false)
@@ -62,23 +86,47 @@ const ListDownloadDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[560px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">{titleMap[mode]}</DialogTitle>
<DialogTitle className="text-2xl font-bold">{titleMap[mode]}</DialogTitle>
</DialogHeader>
<div className="rounded-md border p-4 space-y-4">
<p className="content-text-lg font-semibold">다운로드 범위</p>
<RadioGroup value={scope} onValueChange={(v) => setScope(v as 'filtered' | 'all')} className="space-y-2">
<div className="flex items-center gap-2">
<RadioGroupItem value="filtered" id="download-scope-filtered" />
<Label htmlFor="download-scope-filtered">필터 적용 대상만</Label>
<div className="space-y-4">
{mode === 'contact-history' ? (
<div className="rounded-md border p-4 space-y-4">
<p className="text-lg font-semibold">조회 기간</p>
<KriDateRangePicker
value={{ from: contactHistoryDateFrom, to: contactHistoryDateTo }}
onChange={(range) => {
setContactHistoryDateFrom(range.from)
setContactHistoryDateTo(range.to)
}}
/>
<p className="text-xs text-muted-foreground">비워두면 전체 기간으로 다운로드됩니다.</p>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="all" id="download-scope-all" />
<Label htmlFor="download-scope-all">전체 대상</Label>
) : null}
<div className="rounded-md border p-4 space-y-4">
<p className="text-lg font-semibold">다운로드 범위</p>
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="download-scope-target" />
</div>
{mode === 'contact-history' ? (
<div className="rounded-md border p-4 space-y-4">
<p className="text-lg font-semibold">이력 기준</p>
<RadioGroup
value={contactHistoryType}
onValueChange={(v) => setContactHistoryType(v as ContactHistoryDownloadType)}
className="flex items-center gap-6 flex-wrap"
>
<div className="flex items-center gap-2">
<RadioGroupItem value="all" id="download-contact-history-all" />
<Label htmlFor="download-contact-history-all">전체 이력</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="latest" id="download-contact-history-latest" />
<Label htmlFor="download-contact-history-latest">마지막 이력만</Label>
</div>
</RadioGroup>
</div>
</RadioGroup>
) : null}
</div>
<DialogFooter>
<Button type="button" variant="outline" onClick={() => handleOpenChange(false)} disabled={submitting}>
취소

View File

@@ -5,7 +5,6 @@ import { Plus, X } from 'lucide-react'
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import {
Select,
SelectContent,
@@ -13,24 +12,10 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
import { useDialog } from '@/hooks/useDialog'
import type { DialogId } from '@/store/jotai/dialog'
export type FilterOperator = 'eq' | 'neq' | 'contains' | 'notContains'
export type FilterHeaderOption = {
id: number
label: string
values?: string[]
}
export type FilterRow = {
id: string
headerId: number
operator: FilterOperator
textValue: string
multiValues: string[]
}
import type { FilterHeaderOption, FilterOperator, FilterRow } from '@/types/list'
export type ListFilterDialogProps = {
dialogId?: DialogId
@@ -112,13 +97,12 @@ const ListFilterDialog = ({
() =>
rows
.map((row) => {
if (row.operator === 'contains' || row.operator === 'notContains') {
return row.textValue.trim().length > 0 ? row : null
}
return row.multiValues.length > 0 ? row : null
const hasValueOptions = getValueOptions(row.headerId).length > 0
if (hasValueOptions) return row.multiValues.length > 0 ? row : null
return row.textValue.trim().length > 0 ? row : null
})
.filter((row): row is FilterRow => row !== null),
[rows],
[rows, headerOptions],
)
const handleConfirm = async () => {
@@ -140,11 +124,11 @@ const ListFilterDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[940px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">필터</DialogTitle>
<DialogTitle className="text-2xl font-bold">필터</DialogTitle>
</DialogHeader>
<div className="rounded-md border overflow-hidden">
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[1fr_140px_1.4fr_64px] items-center text-sm font-semibold">
<div className="overflow-hidden rounded-md border">
<div className="grid h-11 grid-cols-[1fr_140px_1.4fr_64px] items-center border-b bg-muted/40 px-4 text-sm font-semibold">
<span>헤더</span>
<span>비교 연산자</span>
<span>값</span>
@@ -154,12 +138,12 @@ const ListFilterDialog = ({
<div className="max-h-80 overflow-auto">
{rows.map((row) => {
const valueOptions = getValueOptions(row.headerId)
const textMode = row.operator === 'contains' || row.operator === 'notContains'
const listMode = valueOptions.length > 0
return (
<div
key={row.id}
className="min-h-12 px-4 py-2 border-b last:border-b-0 grid grid-cols-[1fr_140px_1.4fr_64px] items-center gap-2"
className="grid min-h-12 grid-cols-[1fr_140px_1.4fr_64px] items-center gap-2 border-b px-4 py-2 last:border-b-0"
>
<Select
value={String(row.headerId)}
@@ -207,39 +191,37 @@ const ListFilterDialog = ({
</SelectContent>
</Select>
{textMode ? (
{listMode ? (
<KriMultiSelect
items={valueOptions}
value={row.multiValues}
onChange={(values) =>
handleChangeRow(row.id, (current) => ({
...current,
multiValues: values,
}))
}
getValue={(item) => item}
getLabel={(item) => item}
placeholder="값 선택"
widthClassName="w-full"
heightClassName="h-9"
className="w-full"
spanClassName="text-sm"
badgeClassName="text-xs"
maxCount={2}
/>
) : (
<Input
placeholder="검색할 텍스트"
value={row.textValue}
onChange={(e) =>
onChange={(event) =>
handleChangeRow(row.id, (current) => ({
...current,
textValue: e.target.value,
textValue: event.target.value,
}))
}
/>
) : (
<div className="space-y-1">
<select
multiple
className="w-full min-h-20 rounded-md border px-2 py-1 text-sm"
value={row.multiValues}
onChange={(e) => {
const values = Array.from(e.target.selectedOptions).map((option) => option.value)
handleChangeRow(row.id, (current) => ({
...current,
multiValues: values,
}))
}}
>
{valueOptions.map((value) => (
<option key={value} value={value}>
{value}
</option>
))}
</select>
<Label className="text-xs text-muted-foreground">Ctrl/Cmd + 클릭으로 다중 선택</Label>
</div>
)}
<div className="flex justify-center">
@@ -248,9 +230,9 @@ const ListFilterDialog = ({
variant="ghost"
size="icon-sm"
onClick={() => handleRemoveRow(row.id)}
aria-label="행 제거"
aria-label="조건 제거"
>
<X className="w-4 h-4" />
<X className="h-4 w-4" />
</Button>
</div>
</div>
@@ -260,7 +242,7 @@ const ListFilterDialog = ({
</div>
<Button type="button" variant="outline" onClick={handleAddRow} className="gap-2">
<Plus className="w-4 h-4" />
<Plus className="h-4 w-4" />
조건 추가
</Button>

View File

@@ -1,28 +1,172 @@
'use client'
import { useEffect, useState } from 'react'
import { GripVertical, Trash2 } from 'lucide-react'
import { CSSProperties, useEffect, useState } from 'react'
import {
closestCenter,
DndContext,
DragEndEvent,
DragStartEvent,
KeyboardSensor,
PointerSensor,
useSensor,
useSensors,
} from '@dnd-kit/core'
import {
arrayMove,
SortableContext,
sortableKeyboardCoordinates,
useSortable,
verticalListSortingStrategy,
} from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
import { GripVertical, Plus, Trash2 } from 'lucide-react'
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { Checkbox } from '@/components/ui/checkbox'
import { Label } from '@/components/ui/label'
import { Input } from '@/components/ui/input'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
import { useDialog } from '@/hooks/useDialog'
import type { DialogId } from '@/store/jotai/dialog'
import { cn } from '@/lib/utils'
export type ListHeaderManageRow = {
id: number
name: string
visible: boolean
locked?: boolean
}
import { listHeader, ListHeaderGrade, ListHeaderType } from '@/types/list'
import { LIST_HEADER_TYPE_LABEL, LIST_HEADER_TYPE_OPTIONS } from '@/const/listConst'
export type ListHeaderManageDialogProps = {
dialogId?: DialogId
open?: boolean
onOpenChange?: (open: boolean) => void
rows: ListHeaderManageRow[]
onConfirm: (rows: ListHeaderManageRow[]) => void | Promise<void>
rows: listHeader[]
onConfirm: (rows: listHeader[]) => void | Promise<void>
}
type ListHeaderRowProps = {
row: listHeader
activeId: number | null
onHeaderNameChange: (id: number, listHderNm: string) => void
onHeaderTypeChange: (id: number, listHderTy: ListHeaderType) => void
onFlagChange: (id: number, field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit', checked: boolean) => void
onDelete: (id: number) => void
}
const isCommonGrade = (grade: ListHeaderGrade) => grade === ListHeaderGrade.COMMON
const isImmutableGrade = (grade: ListHeaderGrade) => grade === ListHeaderGrade.IMMUTABLE
const ListHeaderRow = ({ row, activeId, onHeaderNameChange, onHeaderTypeChange, onFlagChange, onDelete }: ListHeaderRowProps) => {
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: row.listHderId })
const canEditName = isCommonGrade(row.listHderGrad)
const canEditType = isCommonGrade(row.listHderGrad)
const canDelete = isCommonGrade(row.listHderGrad)
const canEditFlags = !isImmutableGrade(row.listHderGrad)
const canSort = isCommonGrade(row.listHderGrad)
const style: CSSProperties = {
transform: CSS.Transform.toString(transform),
transition,
}
const typeValue = String(row.listHderTy)
const hasTypeOption = LIST_HEADER_TYPE_OPTIONS.some((option) => String(option.value) === typeValue)
const fallbackLabel = (LIST_HEADER_TYPE_LABEL as Record<number, string>)[Number(row.listHderTy)] ?? typeValue
const mergedTypeOptions = hasTypeOption
? LIST_HEADER_TYPE_OPTIONS
: [...LIST_HEADER_TYPE_OPTIONS, { value: Number(row.listHderTy), label: fallbackLabel }]
return (
<div
ref={setNodeRef}
style={style}
className={cn(
'h-12 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2',
(activeId === row.listHderId || isDragging) && 'bg-muted/40',
)}
>
<div className="flex items-center">
<button
type="button"
className={cn(
'inline-flex items-center justify-center size-8 rounded-sm',
canSort ? 'cursor-grab active:cursor-grabbing' : 'cursor-not-allowed opacity-40',
)}
aria-label={canSort ? `${row.listHderNm} 헤더 순서 변경` : `${row.listHderNm} 헤더 순서 변경 불가`}
disabled={!canSort}
{...(canSort ? attributes : {})}
{...(canSort ? listeners : {})}
>
<GripVertical className="w-4 h-4 text-muted-foreground" />
</button>
</div>
{canEditName ? (
<Input
value={row.listHderNm}
onChange={(event) => onHeaderNameChange(row.listHderId, event.target.value)}
className="h-9"
aria-label={`${row.listHderNm} 헤더명`}
/>
) : (
<span>{row.listHderNm}</span>
)}
<Select
value={typeValue}
onValueChange={(value) => onHeaderTypeChange(row.listHderId, Number(value) as ListHeaderType)}
disabled={!canEditType}
>
<SelectTrigger className="w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
{mergedTypeOptions.map((option) => (
<SelectItem key={option.value} value={String(option.value)}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
<div className="flex items-center gap-2 justify-center">
<Checkbox
id={`header-visible-${row.listHderId}`}
checked={row.useColView}
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useColView', checked === true)}
disabled={!canEditFlags}
/>
</div>
<div className="flex items-center gap-2 justify-center">
<Checkbox
id={`header-filter-${row.listHderId}`}
checked={row.useFilter}
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useFilter', checked === true)}
disabled={!canEditFlags}
/>
</div>
<div className="flex items-center gap-2 justify-center">
<Checkbox
id={`header-intrvwer-view-${row.listHderId}`}
checked={row.useIntrvwerView}
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useIntrvwerView', checked === true)}
disabled={!canEditFlags}
/>
</div>
<div className="flex items-center gap-2 justify-center">
<Checkbox
id={`header-intrvwer-edit-${row.listHderId}`}
checked={row.useIntrvwerEdit}
onCheckedChange={(checked) => onFlagChange(row.listHderId, 'useIntrvwerEdit', checked === true)}
disabled={!canEditFlags}
/>
</div>
<div className="flex justify-center">
<Button
type="button"
variant="ghost"
size="icon-sm"
onClick={() => onDelete(row.listHderId)}
className={!canDelete ? 'invisible pointer-events-none' : undefined}
disabled={!canDelete}
aria-label="헤더 삭제"
>
<Trash2 className="w-4 h-4 text-red-600" />
</Button>
</div>
</div>
)
}
const ListHeaderManageDialog = ({
@@ -33,11 +177,15 @@ const ListHeaderManageDialog = ({
onConfirm,
}: ListHeaderManageDialogProps) => {
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const [localRows, setLocalRows] = useState<ListHeaderManageRow[]>([])
const [draggingId, setDraggingId] = useState<number | null>(null)
const [localRows, setLocalRows] = useState<listHeader[]>([])
const [activeId, setActiveId] = useState<number | null>(null)
const [submitting, setSubmitting] = useState(false)
const resolvedOpen = open ?? isDialogOpen(dialogId)
const sensors = useSensors(
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
)
useEffect(() => {
if (!resolvedOpen) return
@@ -53,37 +201,103 @@ const ListHeaderManageDialog = ({
hideDialog(dialogId)
}
const handleDrop = (targetId: number) => {
if (draggingId === null || draggingId === targetId) return
const moveRow = (sourceId: number, targetId: number) => {
if (sourceId === targetId) return
setLocalRows((prev) => {
const sourceIndex = prev.findIndex((row) => row.id === draggingId)
const targetIndex = prev.findIndex((row) => row.id === targetId)
const sourceIndex = prev.findIndex((row) => row.listHderId === sourceId)
const targetIndex = prev.findIndex((row) => row.listHderId === targetId)
if (sourceIndex < 0 || targetIndex < 0) return prev
const next = [...prev]
const [moved] = next.splice(sourceIndex, 1)
next.splice(targetIndex, 0, moved)
return next
const sourceRow = prev[sourceIndex]
const targetRow = prev[targetIndex]
if (!sourceRow || !targetRow) return prev
if (!isCommonGrade(sourceRow.listHderGrad) || !isCommonGrade(targetRow.listHderGrad)) return prev
return arrayMove(prev, sourceIndex, targetIndex)
})
}
const handleVisibleChange = (id: number, checked: boolean) => {
const handleDragStart = (event: DragStartEvent) => {
setActiveId(Number(event.active.id))
}
const handleDragEnd = (event: DragEndEvent) => {
const sourceId = Number(event.active.id)
const targetId = Number(event.over?.id)
if (!Number.isNaN(sourceId) && !Number.isNaN(targetId)) {
moveRow(sourceId, targetId)
}
setActiveId(null)
}
const handleHeaderTypeChange = (id: number, listHderTy: ListHeaderType) => {
setLocalRows((prev) =>
prev.map((row) => {
if (row.id !== id || row.locked) return row
return { ...row, visible: checked }
if (row.listHderId !== id) return row
if (!isCommonGrade(row.listHderGrad)) return row
return { ...row, listHderTy }
}),
)
}
const handleHeaderNameChange = (id: number, listHderNm: string) => {
setLocalRows((prev) =>
prev.map((row) => {
if (row.listHderId !== id) return row
if (!isCommonGrade(row.listHderGrad)) return row
return { ...row, listHderNm }
}),
)
}
const handleFlagChange = (
id: number,
field: 'useColView' | 'useFilter' | 'useIntrvwerView' | 'useIntrvwerEdit',
checked: boolean,
) => {
setLocalRows((prev) =>
prev.map((row) => {
if (row.listHderId !== id) return row
if (isImmutableGrade(row.listHderGrad)) return row
return { ...row, [field]: checked }
}),
)
}
const handleDelete = (id: number) => {
setLocalRows((prev) => prev.filter((row) => row.id !== id || row.locked))
setLocalRows((prev) => prev.filter((row) => row.listHderId !== id || !isCommonGrade(row.listHderGrad)))
}
const handleAddHeader = () => {
setLocalRows((prev) => {
const minId = prev.reduce((acc, row) => Math.min(acc, row.listHderId), 0)
const nextId = minId <= 0 ? minId - 1 : -1
const newIndex = prev.filter((row) => row.listHderNm.startsWith('신규 헤더')).length + 1
const nextRow: listHeader = {
listHderId: nextId,
listHderOrder: prev.length + 1,
listHderGrad: ListHeaderGrade.COMMON,
listHderNm: `신규 헤더 ${newIndex}`,
listHderTy: LIST_HEADER_TYPE_OPTIONS[0].value,
useFilter: false,
useColView: true,
useIntrvwerView: false,
useIntrvwerEdit: false,
}
return [...prev, nextRow]
})
}
const handleConfirm = async () => {
setSubmitting(true)
try {
await onConfirm(localRows)
const orderedRows = localRows.map((row, index) => ({
...row,
listHderOrder: index + 1,
}))
await onConfirm(orderedRows)
handleOpenChange(false)
} finally {
setSubmitting(false)
@@ -92,63 +306,53 @@ const ListHeaderManageDialog = ({
return (
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[820px]">
<DialogContent className="sm:max-w-[1200px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">리스트 헤더 관리</DialogTitle>
<DialogTitle className="text-2xl font-bold">리스트 헤더 관리</DialogTitle>
</DialogHeader>
<div className="flex justify-end">
<Button type="button" className="gap-2 bg-blue" onClick={handleAddHeader} disabled={submitting}>
<Plus className="w-4 h-4" />
헤더 추가
</Button>
</div>
<div className="rounded-md border overflow-hidden">
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[56px_1fr_120px_88px] items-center text-sm font-semibold">
<div className="h-11 px-4 border-b bg-muted/40 grid grid-cols-[56px_1fr_150px_96px_96px_110px_110px_88px] items-center gap-2 text-sm font-semibold">
<span>순서</span>
<span>헤더명</span>
<span>노출</span>
<span>헤더 타입</span>
<span>헤더 노출</span>
<span>필터 사용</span>
<span>면접원 노출</span>
<span>면접원 수정</span>
<span className="text-center">삭제</span>
</div>
<div className="max-h-[420px] overflow-auto">
{localRows.map((row) => (
<div
key={row.id}
className={cn(
'h-11 px-4 border-b last:border-b-0 grid grid-cols-[56px_1fr_120px_88px] items-center',
draggingId === row.id && 'bg-muted/40',
)}
draggable={!row.locked}
onDragStart={() => setDraggingId(row.id)}
onDragEnd={() => setDraggingId(null)}
onDragOver={(e) => e.preventDefault()}
onDrop={() => handleDrop(row.id)}
>
<div className="flex items-center">
<GripVertical className="w-4 h-4 text-muted-foreground" />
</div>
<span>{row.name}</span>
<div className="flex items-center gap-2">
<Checkbox
id={`header-visible-${row.id}`}
checked={row.visible}
onCheckedChange={(checked) => handleVisibleChange(row.id, checked === true)}
disabled={row.locked}
<DndContext
sensors={sensors}
collisionDetection={closestCenter}
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
onDragCancel={() => setActiveId(null)}
>
<SortableContext items={localRows.map((row) => row.listHderId)} strategy={verticalListSortingStrategy}>
<div className="max-h-[420px] overflow-auto">
{localRows.map((row) => (
<ListHeaderRow
key={row.listHderId}
row={row}
activeId={activeId}
onHeaderNameChange={handleHeaderNameChange}
onHeaderTypeChange={handleHeaderTypeChange}
onFlagChange={handleFlagChange}
onDelete={handleDelete}
/>
<Label htmlFor={`header-visible-${row.id}`} className="cursor-pointer">
사용
</Label>
</div>
<div className="flex justify-center">
<Button
type="button"
variant="ghost"
size="icon-sm"
onClick={() => handleDelete(row.id)}
disabled={row.locked}
aria-label="헤더 삭제"
>
<Trash2 className="w-4 h-4 text-red-600" />
</Button>
</div>
))}
</div>
))}
</div>
</SortableContext>
</DndContext>
</div>
<DialogFooter>

View File

@@ -7,15 +7,14 @@ import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
import { useDialog } from '@/hooks/useDialog'
import type { DialogId } from '@/store/jotai/dialog'
export type ListResetTarget = 'selected' | 'filtered' | 'all'
export type ListResetScope = 'result-and-history' | 'list-only'
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
import type { ListFilterTarget, ListResetScope } from '@/types/list'
export type ListResetDialogProps = {
dialogId?: DialogId
open?: boolean
onOpenChange?: (open: boolean) => void
onConfirm: (payload: { target: ListResetTarget; scope: ListResetScope }) => void | Promise<void>
onConfirm: (payload: { target: ListFilterTarget; scope: ListResetScope }) => void | Promise<void>
}
const ListResetDialog = ({
@@ -25,7 +24,7 @@ const ListResetDialog = ({
onConfirm,
}: ListResetDialogProps) => {
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const [target, setTarget] = useState<ListResetTarget>('selected')
const [target, setTarget] = useState<ListFilterTarget>('selected')
const [scope, setScope] = useState<ListResetScope>('result-and-history')
const [submitting, setSubmitting] = useState(false)
@@ -54,38 +53,29 @@ const ListResetDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[700px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">리스트 초기화</DialogTitle>
<DialogTitle className="text-2xl font-bold">리스트 초기화</DialogTitle>
</DialogHeader>
<div className="space-y-6 py-2">
<div className="rounded-md border p-4 space-y-4">
<p className="content-text-lg font-semibold text-red-600">초기화 대상</p>
<RadioGroup value={target} onValueChange={(v) => setTarget(v as ListResetTarget)} className="space-y-2">
<div className="flex items-center gap-2">
<RadioGroupItem value="selected" id="list-reset-target-selected" />
<Label htmlFor="list-reset-target-selected">선택 항목만</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="filtered" id="list-reset-target-filtered" />
<Label htmlFor="list-reset-target-filtered">필터 적용 항목만</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="all" id="list-reset-target-all" />
<Label htmlFor="list-reset-target-all">리스트 전체</Label>
</div>
</RadioGroup>
<p className="text-lg font-semibold text-red-600">초기화 대상</p>
<ApplyFilterOption
value={target}
onValueChange={(v) => setTarget(v)}
idPrefix="list-reset-target"
/>
</div>
<div className="rounded-md border p-4 space-y-4">
<p className="content-text-lg font-semibold text-red-600">초기화 범위</p>
<p className="text-lg font-semibold text-red-600">초기화 범위</p>
<RadioGroup value={scope} onValueChange={(v) => setScope(v as ListResetScope)} className="space-y-2">
<div className="flex items-center gap-2">
<RadioGroupItem value="result-and-history" id="list-reset-scope-result-history" />
<Label htmlFor="list-reset-scope-result-history">최종 결과 + 컨택 이력 삭제</Label>
<Label htmlFor="list-reset-scope-result-history">결과 + 이력 삭제</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value="list-only" id="list-reset-scope-list-only" />
<Label htmlFor="list-reset-scope-list-only">리스트만 삭제</Label>
<Label htmlFor="list-reset-scope-list-only">결과 + 이력 + 리스트 삭제</Label>
</div>
</RadioGroup>
</div>

View File

@@ -2,41 +2,33 @@
import { useMemo, useRef, useState } from 'react'
import { ChevronDown, ChevronUp, Download, Upload, X } from 'lucide-react'
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { Checkbox } from '@/components/ui/checkbox'
import { Label } from '@/components/ui/label'
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
import { KriSelect, KriSelectItem } from '@/components/common/KriSelect'
import { useDialog } from '@/hooks/useDialog'
import { useLoading } from '@/hooks/useLoading'
import type { DialogId } from '@/store/jotai/dialog'
import { formatKst } from '@/lib/utils'
import { formatKst } from '@kri/common'
import { listHeader, ListHeaderGrade, ListHeaderType, ListUploadHistory, ListUploadMode, ListUploadRequest } from '@/types/list'
import { LIST_HEADER_TYPE_LABEL, LIST_HEADER_TYPE_ORDER, ListHeaderConst } from '@/const/listConst'
export type ValidationOption = {
checkEmailDuplicate: boolean
checkPhoneDuplicate: boolean
}
export type ListUploadHistory = {
round: number
fileName: string
userId: string
uploadCount: number
uploadAt: string
}
export type ListUploadDialogProps = {
dialogId?: DialogId
open?: boolean
onOpenChange?: (open: boolean) => void
onUpload: (file: File, validation: ValidationOption) => void | Promise<void>
onUpload: (file: File, request: ListUploadRequest) => void | Promise<void>
onDownloadTemplate?: () => void | Promise<void>
uploadHistory?: ListUploadHistory[]
onDownloadHistory?: (item: ListUploadHistory) => void | Promise<void>
headerRows?: listHeader[]
}
const ACCEPT_EXTENSIONS = ['.xlsx', '.xls', '.csv']
@@ -49,13 +41,18 @@ const ListUploadDialog = ({
onDownloadTemplate,
uploadHistory = [],
onDownloadHistory,
headerRows = [],
}: ListUploadDialogProps) => {
const { isDialogOpen, showDialog, hideDialog } = useDialog()
const { withLoadingAsync } = useLoading()
const fileInputRef = useRef<HTMLInputElement>(null)
const [selectedFile, setSelectedFile] = useState<File | null>(null)
const [excelHeaders, setExcelHeaders] = useState<string[]>([])
const [otherHeaderTypeMap, setOtherHeaderTypeMap] = useState<Record<number, ListHeaderType>>({})
const [uploadMode, setUploadMode] = useState<ListUploadMode>(ListUploadMode.CHANGE)
const [submitting, setSubmitting] = useState(false)
const [historyExpanded, setHistoryExpanded] = useState(true)
const [historyExpanded, setHistoryExpanded] = useState(false)
const [validation, setValidation] = useState<ValidationOption>({
checkEmailDuplicate: false,
checkPhoneDuplicate: false,
@@ -65,24 +62,43 @@ const ListUploadDialog = ({
const normalizedHistory = useMemo(
() =>
uploadHistory.map((item) => ({
...item,
uploadAtLabel: formatKst(item.uploadAt, 'dateTime'),
})),
[...uploadHistory]
.sort((a, b) => b.wave - a.wave)
.map((item) => ({
...item,
uploadAtLabel: formatKst(item.regDt, 'dateTime'),
})),
[uploadHistory],
)
const orderedHeaderRows = useMemo(() => [...headerRows].sort((a, b) => a.listHderOrder - b.listHderOrder), [headerRows])
const hasCommonHeader = useMemo(
() => orderedHeaderRows.some((row) => row.listHderGrad === ListHeaderGrade.COMMON),
[orderedHeaderRows],
)
const baseHeaderRows = useMemo(
() => orderedHeaderRows.filter((row) => row.listHderGrad !== ListHeaderGrade.COMMON),
[orderedHeaderRows],
)
const selectableHeaderTypeOptions = useMemo<KriSelectItem[]>(
() =>
LIST_HEADER_TYPE_ORDER.map((value) => ({ value: String(value), label: LIST_HEADER_TYPE_LABEL[value] })),
[],
)
const resetState = () => {
setSelectedFile(null)
setExcelHeaders([])
setOtherHeaderTypeMap({})
setUploadMode(ListUploadMode.ADD)
setSubmitting(false)
setHistoryExpanded(true)
setHistoryExpanded(false)
setValidation({
checkEmailDuplicate: false,
checkPhoneDuplicate: false,
})
if (fileInputRef.current) {
fileInputRef.current.value = ''
}
if (fileInputRef.current) fileInputRef.current.value = ''
}
const handleOpenChange = (nextOpen: boolean) => {
@@ -95,15 +111,25 @@ const ListUploadDialog = ({
}
const handleDialogOpenChange = (nextOpen: boolean) => {
if (!nextOpen && !submitting) {
resetState()
}
if (!nextOpen && !submitting) resetState()
handleOpenChange(nextOpen)
}
const handleSelectFileClick = () => {
if (submitting) return
fileInputRef.current?.click()
const extractHeaders = async (file: File) => {
const lower = file.name.toLowerCase()
if (lower.endsWith('.csv')) {
const text = await file.text()
const firstLine = text.split(/\r?\n/)[0] ?? ''
return firstLine.split(',').map((s) => s.trim()).filter((s) => s.length > 0)
}
const { read, utils } = await import('xlsx')
const buffer = await file.arrayBuffer()
const workbook = read(buffer, { type: 'array' })
const firstSheet = workbook.SheetNames[0]
if (!firstSheet) return []
const rows = utils.sheet_to_json<(string | number | null)[]>(workbook.Sheets[firstSheet], { header: 1, raw: false })
return (rows[0] ?? []).map((cell) => String(cell ?? '').trim()).filter((s) => s.length > 0)
}
const handleSelectFile = (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -116,14 +142,17 @@ const ListUploadDialog = ({
alert('엑셀 또는 CSV 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)')
return
}
setSelectedFile(file)
}
const handleRemoveFile = () => {
setSelectedFile(null)
if (fileInputRef.current) {
fileInputRef.current.value = ''
}
setSelectedFile(file)
void withLoadingAsync(async () => {
try {
const headers = await extractHeaders(file)
setExcelHeaders(headers)
} catch {
setExcelHeaders([])
alert('업로드 파일의 첫 행 헤더를 읽는 중 오류가 발생했습니다.')
}
})
}
const handleSubmit = async () => {
@@ -134,7 +163,18 @@ const ListUploadDialog = ({
setSubmitting(true)
try {
await onUpload(selectedFile, validation)
const specificHeader = Object.fromEntries(
Object.entries(otherHeaderTypeMap)
.map(([index, value]) => [String(Number(index) + 1), value])
.filter(([, value]) => value !== ListHeaderConst.TEXT),
)
await onUpload(selectedFile, {
uploadMode,
checkDuplicateEmail: validation.checkEmailDuplicate,
checkDuplicatePhone: validation.checkPhoneDuplicate,
...(Object.keys(specificHeader).length > 0 ? { specificHeader } : {}),
})
resetState()
handleOpenChange(false)
} catch {
@@ -144,64 +184,143 @@ const ListUploadDialog = ({
}
}
const compareRows = hasCommonHeader ? orderedHeaderRows : baseHeaderRows
const headerCompareList = useMemo(
() =>
excelHeaders.map((header, index) => {
const serverHeader = compareRows[index]
const isMatched = !!serverHeader && serverHeader.listHderNm === header && serverHeader.listHderOrder === index + 1
const isSettingRequired = !hasCommonHeader && index >= baseHeaderRows.length
return {
header,
index,
isMatched,
isSettingRequired,
serverHeader,
}
}),
[baseHeaderRows.length, compareRows, excelHeaders, hasCommonHeader],
)
const hasHeaderMismatch = headerCompareList.some(({ serverHeader, isMatched }) => !!serverHeader && !isMatched)
const renderHeaderTypeCell = (
serverHeader: listHeader | undefined,
isMatched: boolean,
isSettingRequired: boolean,
index: number,
) => {
if (serverHeader && !isMatched) {
return <span className="text-xs text-red-600">이름 또는 순서 불일치</span>
}
if (isSettingRequired) {
return (
<KriSelect
items={selectableHeaderTypeOptions}
value={String(otherHeaderTypeMap[index] ?? ListHeaderConst.TEXT)}
getValue={(item) => item.value}
getLabel={(item) => item.label}
onChange={(value) => setOtherHeaderTypeMap((prev) => ({ ...prev, [index]: Number(value) as ListHeaderType }))}
useAll={false}
className="w-full min-w-0 overflow-hidden [&>span]:truncate"
heightClassName="h-8"
triggerTextClassName="text-xs"
contentClassName="text-xs"
itemClassName="text-xs"
/>
)
}
return <span className="text-sm">{serverHeader ? LIST_HEADER_TYPE_LABEL[serverHeader.listHderTy] : '-'}</span>
}
return (
<Dialog open={resolvedOpen} onOpenChange={handleDialogOpenChange}>
<DialogContent className="sm:max-w-[860px]">
<DialogContent className="overflow-hidden" style={{ width: 'min(960px, 95vw)', maxWidth: '95vw' }}>
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">리스트 업로드</DialogTitle>
<DialogTitle className="text-2xl font-bold">리스트 업로드</DialogTitle>
</DialogHeader>
<div className="space-y-6 py-2">
<div className="min-w-0 space-y-6 py-2">
{
/*
<div className="space-y-3">
<Label className="content-text-lg font-semibold">업로드 파일</Label>
<div className="flex items-center gap-2">
<Button type="button" className="bg-excel content-text-lg" onClick={onDownloadTemplate}>
<Label className="text-lg font-semibold">업로드 방식</Label>
<RadioGroup
value={String(uploadMode)}
onValueChange={(value) => setUploadMode(Number(value) as ListUploadMode)}
className="flex flex-wrap items-center gap-6"
>
<div className="flex items-center gap-2">
<RadioGroupItem value={String(ListUploadMode.CHANGE)} id="list-upload-mode-change" />
<Label htmlFor="list-upload-mode-change" className="cursor-pointer">
전체 교체
</Label>
</div>
<div className="flex items-center gap-2">
<RadioGroupItem value={String(ListUploadMode.ADD)} id="list-upload-mode-add" />
<Label htmlFor="list-upload-mode-add" className="cursor-pointer">
추가
</Label>
</div>
</RadioGroup>
</div>
*/
}
<div className="space-y-3">
<Label className="text-lg font-semibold">업로드 파일</Label>
<div className="min-w-0 flex items-center gap-2">
<Button type="button" className="shrink-0 bg-excel text-base" onClick={onDownloadTemplate}>
<Download className="w-4 h-4" />
양식 다운로드
</Button>
<Button
type="button"
variant="outline"
className="flex-1 justify-start content-text-lg"
onClick={handleSelectFileClick}
className="min-w-0 flex-1 justify-start text-lg"
disabled={submitting}
onClick={() => fileInputRef.current?.click()}
>
<Upload className="w-4 h-4" />
{selectedFile ? selectedFile.name : '업로드 파일을 선택해 주세요'}
<Upload className="w-4 h-4 shrink-0" />
<span className="min-w-0 truncate">{selectedFile ? selectedFile.name : '업로드 파일을 선택해 주세요.'}</span>
</Button>
<Button
type="button"
variant="ghost"
size="icon-sm"
onClick={handleRemoveFile}
disabled={!selectedFile || submitting}
aria-label="선택 파일 제거"
>
<Button type="button" variant="ghost" size="icon-sm" disabled={!selectedFile || submitting} onClick={resetState} aria-label="선택 파일 제거">
<X className="w-4 h-4" />
</Button>
<input
ref={fileInputRef}
type="file"
accept={ACCEPT_EXTENSIONS.join(',')}
className="hidden"
onChange={handleSelectFile}
/>
<input ref={fileInputRef} type="file" accept={ACCEPT_EXTENSIONS.join(',')} className="hidden" onChange={handleSelectFile} />
</div>
</div>
{selectedFile && excelHeaders.length > 0 && compareRows.length > 0 && (
<div className="min-w-0 space-y-3">
<Label className="text-lg font-semibold">헤더 비교</Label>
<div className="block w-full max-w-full overflow-x-scroll rounded-md border pb-1">
<div className="w-max whitespace-nowrap">
{headerCompareList.map(({ header, index, isMatched, isSettingRequired, serverHeader }) => {
return (
<div key={`${header}-${index}`} className="inline-block w-[125px] align-top border-r last:border-r-0">
<div className="flex h-8 items-center truncate bg-slate-700 px-2.5 text-sm font-medium text-slate-50">
{header || `컬럼${index + 1}`}
</div>
<div className="flex h-9 items-center border-t px-2">
{renderHeaderTypeCell(serverHeader, isMatched, isSettingRequired, index)}
</div>
</div>
)
})}
</div>
</div>
</div>
)}
<div className="space-y-3">
<Label className="content-text-lg font-semibold">중복 검증</Label>
<Label className="text-lg font-semibold">중복 검증</Label>
<div className="flex items-center gap-6">
<div className="flex items-center gap-2">
<Checkbox
id="list-upload-email-dup"
checked={validation.checkEmailDuplicate}
onCheckedChange={(checked) =>
setValidation((prev) => ({
...prev,
checkEmailDuplicate: checked === true,
}))
}
onCheckedChange={(checked) => setValidation((prev) => ({ ...prev, checkEmailDuplicate: checked === true }))}
/>
<Label htmlFor="list-upload-email-dup" className="cursor-pointer">
이메일 중복검증
@@ -211,12 +330,7 @@ const ListUploadDialog = ({
<Checkbox
id="list-upload-phone-dup"
checked={validation.checkPhoneDuplicate}
onCheckedChange={(checked) =>
setValidation((prev) => ({
...prev,
checkPhoneDuplicate: checked === true,
}))
}
onCheckedChange={(checked) => setValidation((prev) => ({ ...prev, checkPhoneDuplicate: checked === true }))}
/>
<Label htmlFor="list-upload-phone-dup" className="cursor-pointer">
전화번호 중복검증
@@ -226,51 +340,41 @@ const ListUploadDialog = ({
</div>
<div className="rounded-md border">
<button
type="button"
className="w-full px-4 h-11 flex items-center justify-between border-b text-left"
onClick={() => setHistoryExpanded((prev) => !prev)}
>
<span className="content-text-lg font-semibold">업로드 이력</span>
{historyExpanded ? <ChevronUp className="w-4 h-4" /> : <ChevronDown className="w-4 h-4" />}
<button type="button" className="flex h-11 w-full items-center justify-between border-b px-4 text-left" onClick={() => setHistoryExpanded((prev) => !prev)}>
<span className="text-lg font-semibold">업로드 이력({normalizedHistory.length} 회)</span>
{historyExpanded ? <ChevronUp className="h-4 w-4" /> : <ChevronDown className="h-4 w-4" />}
</button>
{historyExpanded && (
<div className="max-h-56 overflow-auto">
<table className="w-full text-sm">
<thead className="sticky top-0 bg-white border-b">
<div className="h-[160px] overflow-y-auto">
<table className="w-full text-base">
<thead className="sticky top-0 border-b bg-white">
<tr>
<th className="px-3 h-9 text-left">회차</th>
<th className="px-3 h-9 text-left">파일명</th>
<th className="px-3 h-9 text-left">사용자 ID</th>
<th className="px-3 h-9 text-right">업로드 건수</th>
<th className="px-3 h-9 text-left">업로드 일시</th>
<th className="px-3 h-9 text-center">다운로드</th>
<th className="h-9 px-3 text-center">회차</th>
<th className="h-9 px-3 text-center">파일명</th>
<th className="h-9 px-3 text-center">사용자 ID</th>
<th className="h-9 px-3 text-center">업로드 건수</th>
<th className="h-9 px-3 text-center">업로드 일시</th>
<th className="h-9 px-3 text-center">다운로드</th>
</tr>
</thead>
<tbody>
{normalizedHistory.length === 0 && (
<tr>
<td className="px-3 h-12 text-center text-muted-foreground" colSpan={6}>
<td className="h-12 px-3 text-center text-muted-foreground" colSpan={6}>
업로드 이력이 없습니다.
</td>
</tr>
)}
{normalizedHistory.map((item) => (
<tr key={`${item.round}-${item.fileName}`} className="border-b last:border-b-0">
<td className="px-3 h-10">{item.round}</td>
<td className="px-3 h-10">{item.fileName}</td>
<td className="px-3 h-10">{item.userId}</td>
<td className="px-3 h-10 text-right">{item.uploadCount.toLocaleString()}</td>
<td className="px-3 h-10">{item.uploadAtLabel}</td>
<td className="px-3 h-10 text-center">
<Button
type="button"
variant="outline"
size="sm"
onClick={() => onDownloadHistory?.(item)}
disabled={!onDownloadHistory}
>
<tr key={item.listUploadLogId} className="border-b last:border-b-0">
<td className="h-10 px-3 text-center">{item.wave}</td>
<td className="h-10 px-3 text-center">{item.fileName}</td>
<td className="h-10 px-3 text-center">{item.regUser}</td>
<td className="h-10 px-3 text-center">{item.listCount.toLocaleString()}</td>
<td className="h-10 px-3 text-center">{item.uploadAtLabel}</td>
<td className="h-10 px-3 text-center">
<Button type="button" size="sm" className="bg-excel" onClick={() => onDownloadHistory?.(item)}>
<Download className="h-4 w-4" />
다운로드
</Button>
</td>
@@ -287,7 +391,7 @@ const ListUploadDialog = ({
<Button type="button" variant="outline" onClick={() => handleDialogOpenChange(false)} disabled={submitting}>
취소
</Button>
<Button type="button" onClick={handleSubmit} disabled={!selectedFile || submitting}>
<Button type="button" onClick={handleSubmit} disabled={!selectedFile || submitting || hasHeaderMismatch}>
{submitting ? '업로드 중...' : '업로드'}
</Button>
</DialogFooter>

View File

@@ -91,7 +91,7 @@ const MessageHistoryDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[1200px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">발송 이력</DialogTitle>
<DialogTitle className="text-2xl font-bold">발송 이력</DialogTitle>
</DialogHeader>
<div className="flex gap-2">
@@ -165,7 +165,7 @@ const MessageHistoryDialog = ({
</div>
<div className="rounded-md border p-4 space-y-3 min-h-80">
<p className="content-text-lg font-semibold">
<p className="text-lg font-semibold">
{detailType === null && '상세 이력'}
{detailType === 'template' && '미리보기'}
{detailType === 'target' && '수신 대상'}

View File

@@ -170,13 +170,13 @@ const MessageSendDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[980px]">
<DialogHeader>
<DialogTitle className="content-text-2xl font-bold">{titleMap[mode]}</DialogTitle>
<DialogTitle className="text-2xl font-bold">{titleMap[mode]}</DialogTitle>
</DialogHeader>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
<div className="space-y-4">
<div className="space-y-2">
<Label className="content-text-lg font-semibold">템플릿</Label>
<Label className="text-lg font-semibold">템플릿</Label>
<Select value={templateId} onValueChange={handleTemplateChange}>
<SelectTrigger className="w-full">
<SelectValue placeholder="템플릿을 선택해 주세요" />
@@ -262,7 +262,7 @@ const MessageSendDialog = ({
</div>
<div className="rounded-md border p-4 space-y-2">
<p className="content-text-lg font-semibold">미리보기</p>
<p className="text-lg font-semibold">미리보기</p>
{!selectedTemplate && <p className="text-sm text-muted-foreground">선택된 템플릿이 없습니다.</p>}
{selectedTemplate && (
<>

View File

@@ -1,4 +1,4 @@
'use client'
'use client'
import {useState, useEffect, useMemo} from 'react'
import {
@@ -15,11 +15,10 @@ import {Button} from "@/components/ui/button";
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
import {useDialog} from "@/hooks/useDialog";
import type {DialogId} from "@/store/jotai/dialog";
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@/const/commonConst";
import {apiError} from "@/lib/http-util";
import {IntranetProjectSearchResponse, ProjectCreateRequest} from "@/types/project";
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
import {nextApi} from "@/lib/http-client";
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
import {apiError} from "@kri/common/http";
import {ProjectCreateRequest} from "@/types/project";
import { useDebouncedValue } from "@kri/common/hooks";
import {PROJECT_NAME_REGEX} from "@/const/projectConst";
import {FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
import {MultiSelectOption} from "@/components/ui/multi-select";
@@ -27,10 +26,10 @@ import {ItrntUserInfo} from "@/types/user";
import {useIntranetProjectListQuery} from "@/query/intranet";
export type ProjectCreateDialogProps = {
/** Jotai로 관리할 다이얼로그 ID (기본값: 'userUpsertDialog') */
/** Jotai로 관리할 다이얼로그 ID */
dialogId?: DialogId
/** 필요하면 여전히 외부에서 open 제어도 가능하게 */
/** 필요한 경우 부모에서 직접 open 제어 */
open?: boolean
onOpenChange?: (open: boolean) => void
users:ItrntUserInfo[]
@@ -58,7 +57,7 @@ const ProjectCreateDialog = ({
const [isSubmitting, setIsSubmitting] = useState(false);
const [formData, setFormData] = useState<ProjectCreateRequest>(defaultProjectInfo);
// 실제로 Dialog에 넘길 open 값 (외부 open 있으면 우선)
// 실제 Dialog에 전달할 open 값
const resolvedOpen = open ?? isDialogOpen(dialogId);
const [itrntKeyword, setItrntKeyword] = useState('');
@@ -67,12 +66,10 @@ const ProjectCreateDialog = ({
const itrntPrjctListQuery = useIntranetProjectListQuery(debouncedKeyword, resolvedOpen);
const itrntPrjctArray = useMemo(() => itrntPrjctListQuery.data ?? [] ,[itrntPrjctListQuery.data]);
// 실제 onOpenChange 핸들러 (외부 콜백 + jotai 둘 다 처리)
// 부모 콜백과 jotai 상태를 함께 처리
const handleOpenChange = (nextOpen: boolean) => {
// 1) 외부에서 넘겨준 onOpenChange 먼저 호출
onOpenChange?.(nextOpen);
// 2) jotai 전역 상태도 함께 업데이트
if (nextOpen) {
showDialog(dialogId);
setItrntKeyword("");
@@ -99,31 +96,31 @@ const ProjectCreateDialog = ({
const handleSubmit = async () => {
if(!formData.itrntPrjctCd.trim()){
alert("인트라넷 프로젝트를 선택해 주세요");
alert("Please select an intranet project.");
return;
}
if (!formData.prjctName.trim()) {
alert('프로젝트 명을 입력해 주세요');
alert("Please enter project name.");
return;
}
if (!PROJECT_NAME_REGEX.test(formData.prjctName)) {
alert("프로젝트명에 허용되지 않는 문자가 포함되어 있습니다");
alert("프로젝트명에 허용되지 않는 문자가 포함되어 있습니다.");
return;
}
if(!formData.ownerDept.trim()){
alert('담당 그룹을 입력해 주세요');
alert("Please enter owner department.");
return;
}
if(!USER_NAME_REGEX.test(formData.ownerDept)){
alert('담당 그룹이 올바르지 않습니다.');
alert("해당 그룹이 올바르지 않습니다.");
return;
}
if(!formData.ownerFw.trim()){
alert('담당 SV를 입력해 주세요');
alert("Please enter owner department.");
return;
}
if(!USER_NAME_REGEX.test(formData.ownerDept)){
alert('담당 SV가 올바르지 않습니다.');
alert("해당 SV가 올바르지 않습니다.");
return;
}
@@ -132,12 +129,14 @@ const ProjectCreateDialog = ({
await onSubmit(formData as ProjectCreateRequest);
handleOpenChange(false);
} catch (e) {
const err = apiError(e);
const err = apiError(e, {
fallbackMessage: "Save failed.",
});
if(err.code !== NONE_HTTP_ERROR && err.code !== UNKNOWN_HTTP_ERROR){
alert(err.message);
}
else{
alert('저장에 실패했습니다.');
alert("저장에 실패했습니다.");
}
} finally {
setIsSubmitting(false);
@@ -167,12 +166,12 @@ const ProjectCreateDialog = ({
return (
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[500px] content-text-sm">
<DialogContent className="sm:max-w-[500px] text-sm">
<DialogHeader>
<DialogTitle className="content-text-sxl">
<DialogTitle className="text-xl">
프로젝트 생성
</DialogTitle>
<DialogDescription>프로젝트 생성에 필요한 기본정보를 입력해주세요.</DialogDescription>
<DialogDescription>프로젝트 생성에 필요한 기본 정보를 입력해주세요.</DialogDescription>
</DialogHeader>
<div className="grid gap-6 py-4">
<div className="grid gap-2">
@@ -194,11 +193,11 @@ const ProjectCreateDialog = ({
</div>
<div className="grid gap-2">
<Label htmlFor="prjctName">
프로젝트 명<span className="text-red-500 ml-1">*</span>
Project name<span className="text-red-500 ml-1">*</span>
</Label>
<Input
id="prjctName"
placeholder="프로젝트명을 입력하세요"
placeholder="Enter project name"
value={formData.prjctName}
onChange={(e) => handleInputChange('prjctName', e.target.value)}
/>
@@ -211,7 +210,7 @@ const ProjectCreateDialog = ({
items={deptArray}
value={formData.ownerDept || ''}
onChange={(value) => handleInputChange('ownerDept', value)}
placeholder="담당 그룹을 선택하세요"
placeholder="Select owner department"
heightClassName="h-9"
widthClassName="w-full"
/>
@@ -226,7 +225,7 @@ const ProjectCreateDialog = ({
onChange={(value) => handleInputChange('ownerFw', value)}
getValue={(item) => item.value}
getLabel={(item) => item.label}
placeholder="담당 실사를 선택하세요"
placeholder="Select owner department"
heightClassName="h-9"
widthClassName="w-full"
/>
@@ -253,4 +252,4 @@ const ProjectCreateDialog = ({
);
}
export default ProjectCreateDialog
export default ProjectCreateDialog

View File

@@ -13,7 +13,7 @@ import { Input } from '@/components/ui/input'
import {Trash2, Plus, Download} from 'lucide-react'
import {ProjectInfo, ResultCode, ResultCodeType} from "@/types/project";
import {PROJECT_SEARCH_COUNT, RESULT_CODE_TYPE_OPTIONS} from "@/const/projectConst";
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
import { useDebouncedValue } from "@kri/common/hooks";
import {SelectedProject} from "@/store/jotai/project";
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
import {useSelectedProject} from "@/hooks/useSelectedProject";

View File

@@ -1,4 +1,4 @@
'use client'
'use client'
import {
Dialog,
@@ -12,13 +12,13 @@ import { useState, useRef } from 'react'
import {Download, Upload, X} from 'lucide-react'
import { useDialog } from '@/hooks/useDialog'
import type { DialogId } from '@/store/jotai/dialog'
import {apiError} from "@/lib/http-util";
import {apiError} from "@kri/common/http";
export type UserUploadDialogProps = {
/** jotai로 관리할 dialog id (기본값: 'userUploadDialog') */
/** jotai로 관리할 dialog id */
dialogId?: DialogId
/** 필요하면 부모에서 직접 제어도 가능 */
/** 필요한 경우 부모에서 직접 제어 */
open?: boolean
onOpenChange?: (open: boolean) => void
@@ -39,15 +39,13 @@ const UserUploadDialog = ({
const [selectedFile, setSelectedFile] = useState<File | null>(null);
const fileInputRef = useRef<HTMLInputElement>(null);
//실제 Dialog에 넘길 open값 (props 우선, 없으면 jotai 사용)
// 실제 Dialog에 전달할 open 값
const resolvedOpen = open ?? isDialogOpen(dialogId);
// open change 공통 처리 (부모 콜백 + jotai 동시 반영)
// 부모 콜백과 jotai 상태를 함께 처리
const handleOpenChange = (nextOpen: boolean) => {
// 1) 부모 콜백 먼저
onOpenChange?.(nextOpen)
// 2) jotai 상태 업데이트
if (nextOpen) {
showDialog(dialogId)
} else {
@@ -72,7 +70,7 @@ const UserUploadDialog = ({
) {
setSelectedFile(file)
} else {
alert('엑셀 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)')
alert("엑셀 파일만 업로드 가능합니다. (.xlsx, .xls, .csv)")
}
}
}
@@ -100,7 +98,9 @@ const UserUploadDialog = ({
handleRemoveFile();
handleOpenChange(false);
} catch (e) {
const err = apiError(e);
const err = apiError(e, {
fallbackMessage: "File upload failed.",
});
console.error(err.status, err.code, err.message);
alert("업로드에 실패했습니다.");
} finally {
@@ -108,7 +108,7 @@ const UserUploadDialog = ({
}
};
// ✅ Dialog에서 닫힐 때: 파일도 초기화 + 상태 닫기
// Dialog가 닫힐 때 파일 선택 상태 초기화
const handleDialogOpenChange = (nextOpen: boolean) => {
if (!nextOpen) {
handleRemoveFile()
@@ -120,7 +120,7 @@ const UserUploadDialog = ({
<Dialog open={resolvedOpen} onOpenChange={handleDialogOpenChange}>
<DialogContent className="sm:max-w-[600px]">
<DialogHeader>
<DialogTitle className=" content-text-2xl font-bold">엑셀 업로드</DialogTitle>
<DialogTitle className=" text-2xl font-bold">User upload</DialogTitle>
</DialogHeader>
<div className="space-y-6 py-4">
@@ -129,7 +129,7 @@ const UserUploadDialog = ({
<Button
type="button"
variant="default"
className="content-text-lg bg-excel"
className="text-lg bg-excel"
onClick={onDownloadTemplate}
>
<Download className="w-4 h-4 mr-2" />
@@ -138,11 +138,11 @@ const UserUploadDialog = ({
<Button
type="button"
variant="outline"
className="flex-1 content-text-lg w-full"
className="flex-1 text-lg w-full"
onClick={handleUploadClick}
>
<Upload className="w-4 h-4 mr-2" />
{selectedFile ? selectedFile.name : '선택된 파일 없음'}
{selectedFile ? selectedFile.name : "선택된 파일 없음"}
</Button>
<div className="w-9 h-8">
{selectedFile && (

View File

@@ -1,4 +1,4 @@
'use client'
'use client'
import { useState, useEffect } from 'react'
import {
@@ -18,16 +18,16 @@ import { UserInfoSaveRequest } from '@/types/user'
import KriPassword from "@/components/common/KriPassword";
import {KriSelect, KriSelectItem} from "@/components/common/KriSelect";
import {DataVerification} from "@/types/common";
import {apiError} from "@/lib/http-util";
import {apiError} from "@kri/common/http";
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
import {FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@/const/commonConst";
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
export type UserUpsertDialogProps = {
/** Jotai로 관리할 다이얼로그 ID (기본값: 'userUpsertDialog') */
/** Jotai로 관리할 다이얼로그 ID */
dialogId?: DialogId
/** 필요하면 여전히 외부에서 open 제어도 가능하게 */
/** 필요한 경우 부모에서 직접 open 제어 */
open?: boolean
onOpenChange?: (open: boolean) => void
@@ -71,15 +71,13 @@ const UserUpsertDialog = ({
const [isCheckedDuplicate, setIsCheckedDuplicate] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
// 🔹 실제로 Dialog에 넘길 open 값 (외부 open 있으면 우선)
// 실제 Dialog에 전달할 open 값
const resolvedOpen = open ?? isDialogOpen(dialogId);
// 🔹 실제 onOpenChange 핸들러 (외부 콜백 + jotai 둘 다 처리)
// 부모 콜백과 jotai 상태를 함께 처리
const handleOpenChange = (nextOpen: boolean) => {
// 1) 외부에서 넘겨준 onOpenChange 먼저 호출
onOpenChange?.(nextOpen);
// 2) jotai 전역 상태도 함께 업데이트
if (nextOpen) {
showDialog(dialogId);
} else {
@@ -117,7 +115,7 @@ const UserUpsertDialog = ({
const handleCheckDuplicate = async () => {
if (!formData.userId.trim()) {
alert('아이디를 입력해주세요.');
alert("아이디를 입력해주세요.");
return
}
@@ -127,7 +125,7 @@ const UserUpsertDialog = ({
alert(isDuplicate.errMessage);
setIsCheckedDuplicate(false);
} else {
alert('사용 가능한 아이디입니다.');
alert("사용 가능한 아이디입니다.");
setIsCheckedDuplicate(true);
}
} else {
@@ -137,23 +135,23 @@ const UserUpsertDialog = ({
const handleSubmit = async () => {
if (!formData.userId.trim()) {
alert('아이디를 입력해주세요.');
alert("아이디를 입력해주세요.");
return;
}
if (mode === 'create' && !isCheckedDuplicate) {
alert('아이디 중복체크를 해주세요.');
alert("아이디 중복체크를 해주세요.");
return;
}
if (!formData.userPw.trim()) {
alert('비밀번호를 입력해주세요.');
alert("비밀번호를 입력해주세요.");
return;
}
if (!formData.userName.trim()) {
alert('이름을 입력해주세요.');
alert("이름을 입력해주세요.");
return;
}
if(!USER_NAME_REGEX.test(formData.userName)){
alert('올바르지 않은 이름입니다.');
alert("올바르지 않은 이름입니다.");
return;
}
@@ -165,13 +163,15 @@ const UserUpsertDialog = ({
await onSubmit(formData as UserInfoSaveRequest);
handleOpenChange(false);
} catch (e) {
const err = apiError(e);
const err = apiError(e, {
fallbackMessage: "Save failed.",
});
console.error(err.status, err.code, err.message);
if(err.code !== NONE_HTTP_ERROR && err.code !== UNKNOWN_HTTP_ERROR){
alert(err.message);
}
else{
alert('저장에 실패했습니다.');
alert("저장에 실패했습니다.");
}
} finally {
setIsSubmitting(false);
@@ -180,9 +180,9 @@ const UserUpsertDialog = ({
return (
<Dialog open={resolvedOpen} onOpenChange={handleOpenChange}>
<DialogContent className="sm:max-w-[500px] content-text-sm">
<DialogContent className="sm:max-w-[500px] text-sm">
<DialogHeader>
<DialogTitle className="content-text-sxl">
<DialogTitle className="text-xl">
{mode === 'create' ? '계정 등록' : '계정 수정'}
</DialogTitle>
<DialogDescription>면접원 계정 정보를 입력해주세요.</DialogDescription>
@@ -195,7 +195,7 @@ const UserUpsertDialog = ({
<div className="flex gap-2">
<Input
id="userId"
placeholder="아이디를 입력하세요"
placeholder="Enter ID"
value={formData.userId}
onChange={(e) => handleInputChange('userId', e.target.value)}
disabled={mode === 'edit'}
@@ -206,7 +206,7 @@ const UserUpsertDialog = ({
onClick={handleCheckDuplicate}
disabled={!formData.userId.trim() || isCheckedDuplicate}
>
{isCheckedDuplicate ? '확인완료' : '중복체크'}
{isCheckedDuplicate ? "확인완료" : "중복체크"}
</Button>
)}
</div>
@@ -219,7 +219,7 @@ const UserUpsertDialog = ({
id="password"
value={formData.userPw}
onChange={(v) => handleInputChange('userPw', v)}
placeholder="비밀번호를 입력하세요"
placeholder="Enter password"
/>
</div>
<div className="grid gap-2">
@@ -228,7 +228,7 @@ const UserUpsertDialog = ({
</Label>
<Input
id="userName"
placeholder="이름을 입력하세요"
placeholder="Enter name"
value={formData.userName}
onChange={(e) => handleInputChange('userName', e.target.value)}
/>
@@ -240,7 +240,7 @@ const UserUpsertDialog = ({
value={String(formData.userRole)}
onChange={(e) => {
if(mode !== 'create'){
alert("권한이 변경되면 해당 계정에 배정된 리스트 정보가 초기화 됩니다.");
alert("권한이 변경되면 해당 계정에 배정된 리스트 정보가 초기화됩니다.");
}
handleInputChange('userRole', Number(e));
@@ -267,7 +267,7 @@ const UserUpsertDialog = ({
:
<Input
id="userCmpn"
placeholder="소속 회사를 입력하세요"
placeholder="Enter company"
value={formData.userCmpn}
disabled={!isInternal}
onChange={(e) => handleInputChange('userCmpn', e.target.value)}
@@ -279,7 +279,7 @@ const UserUpsertDialog = ({
<Label htmlFor="memo">메모</Label>
<textarea id="memo" className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
rows={3}
placeholder="메모를 입력하세요"
placeholder="Enter memo"
value={formData.memo}
onChange={(e) => handleInputChange('memo', e.target.value)}
/>
@@ -298,7 +298,7 @@ const UserUpsertDialog = ({
onClick={handleSubmit}
disabled={isSubmitting}
>
{mode === 'create' ? '등록' : '수정'}
{mode === 'create' ? "등록" : "수정"}
</Button>
</DialogFooter>
</DialogContent>
@@ -306,4 +306,4 @@ const UserUpsertDialog = ({
)
}
export default UserUpsertDialog
export default UserUpsertDialog

View File

@@ -2,9 +2,9 @@
import * as React from "react";
import { toast } from "sonner";
import { cn } from "@kri/common/ui";
import type { KriEditorProps } from "./types";
import { cn } from "./utils/cn";
import { compressImage } from "./utils/imageCompression";
import { useDebouncedChange } from "./hooks/useDebouncedChange";
import { sanitizeHtmlForPreview } from "./utils/sanitizeHtml";

View File

@@ -1,7 +1,7 @@
"use client";
import React from "react";
import { cn } from "./utils/cn"; // 기존 "@/lib/utils" 제거
import { cn } from "@kri/common/ui";
import type { KriEditorProps } from "./types";
import { useDebouncedChange } from "./hooks/useDebouncedChange";
import { useTextareaInsert } from "./hooks/useTextareaInsert";
@@ -192,4 +192,4 @@ export function KriEditorSms(props: SmsEditorProps) {
</div>
</div>
);
};
};

View File

@@ -18,11 +18,11 @@ import TableHeader from "@tiptap/extension-table-header";
import TableCell from "@tiptap/extension-table-cell";
import { toast } from "sonner";
import { cn } from "@kri/common/ui";
import type { KriEditorProps, KriEditorMode, ToolbarState } from "./types";
import { FontSize } from "./extensions/font-size";
import { Div } from "./extensions/div";
import { cn } from "./utils/cn";
import { compressImage } from "./utils/imageCompression";
import { sanitizeHtml } from "./utils/sanitizeHtml";
import { Toolbar } from "./toolbar/Toolbar";

View File

@@ -3,7 +3,8 @@ import { Extension } from "@tiptap/core";
declare module "@tiptap/core" {
interface Commands<ReturnType> {
fontSize: {
setFontSize: (fontSize: string | null) => ReturnType;
setFontSize: (fontSize: string) => ReturnType;
unsetFontSize: () => ReturnType;
};
}
}
@@ -17,7 +18,7 @@ export const FontSize = Extension.create({
attributes: {
fontSize: {
default: null as string | null,
parseHTML: (element) => (element as HTMLElement).style.fontSize || null,
parseHTML: (element) => (element).style.fontSize || null,
renderHTML: (attributes) => {
if (!attributes.fontSize) return {};
return { style: `font-size:${attributes.fontSize}` };
@@ -33,11 +34,13 @@ export const FontSize = Extension.create({
setFontSize:
(fontSize) =>
({ chain }) => {
if (!fontSize) {
return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
}
return chain().setMark("textStyle", { fontSize }).run();
},
unsetFontSize:
() =>
({ chain }) => {
return chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run();
},
};
},
});

View File

@@ -10,7 +10,7 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Separator } from "@/components/ui/separator";
import { cn } from "../utils/cn";
import { cn } from "@kri/common/ui";
import {
AlignCenter,
AlignLeft,

View File

@@ -1,3 +0,0 @@
export function cn(...inputs: Array<string | undefined | null | false>) {
return inputs.filter(Boolean).join(" ");
}

View File

@@ -1,15 +1,28 @@
export function sanitizeHtml(input: string): string {
if (!input) return "";
"use client";
let s = input.replace(/<\s*script[^>]*>[\s\S]*?<\s*\/\s*script\s*>/gi, "");
s = s.replace(/<\s*style[^>]*>[\s\S]*?<\s*\/\s*style\s*>/gi, "");
s = s.replace(/\son\w+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "");
s = s.replace(/\s(href|src)\s*=\s*("|')\s*javascript:[^"']*("|')/gi, ' $1="#"');
import DOMPurify from "dompurify";
return s;
const HTML_PROFILE = {
USE_PROFILES: {
html: true,
},
} as const;
export function sanitizeHtml(
input: string,
): string {
if (!input) {
return "";
}
return DOMPurify.sanitize(
input,
HTML_PROFILE,
);
}
// 기존 코드 호환용
export function sanitizeHtmlForPreview(input: string): string {
export function sanitizeHtmlForPreview(
input: string,
): string {
return sanitizeHtml(input);
}

View File

@@ -5,7 +5,7 @@ interface BodyTitleProps {
const BodyTitle = ({titleText}:BodyTitleProps) => {
return (
<div className="flex justify-between items-center">
<h1 className="font-bold content-text-2xl">{titleText}</h1>
<h1 className="font-bold text-2xl">{titleText}</h1>
</div>
);
}

View File

@@ -7,12 +7,15 @@ import Image from "next/image";
import { topMenus } from "@/config/menu.data";
import {useAuth} from "@/hooks/useAuth";
import type {LoginUser} from "@/types/auth";
import {useEffect, useState} from "react";
import {useEffect, useMemo, useState} from "react";
import {useSelectedProject} from "@/hooks/useSelectedProject";
import { useMounted } from "@kri/common/hooks";
interface HeaderProps {
isMain: boolean;
menuOpen: boolean;
activeTopId: string;
isViewProjectTitle: boolean;
fontSize: number;
onToggleMenu: () => void;
onNavigate: (path: string) => void;
@@ -24,6 +27,7 @@ export const Header = ({
isMain,
menuOpen,
activeTopId,
isViewProjectTitle,
fontSize,
onToggleMenu,
onNavigate,
@@ -32,16 +36,21 @@ export const Header = ({
}: HeaderProps) => {
const router = useRouter();
const { auth } = useAuth();
const mounted = useMounted();
const [userInfo, setUserInfo] = useState<LoginUser|undefined>(undefined);
const { selectedProject } = useSelectedProject();
const projectName = useMemo(() => selectedProject?.prjctName ?? "", [selectedProject]);
useEffect(() => {
if (!mounted) return;
if(auth.user){
setUserInfo(auth.user);
}
else{
router.replace("/logout");
}
}, [auth.user])
}, [auth.user, mounted, router])
return (
<header className="bg-white border-b border-gray-200 sticky top-0 z-40">
@@ -89,7 +98,11 @@ export const Header = ({
))}
</nav>
</div>
<div className="flex flex-grow justify-center">
{isViewProjectTitle && projectName &&
<h1 className="font-bold text-2xl ml-3">{projectName}</h1>
}
</div>
{/* 우측 컨트롤 */}
<div className="flex items-center gap-4">
<div className="flex items-center gap-1 border-r pr-4">
@@ -127,4 +140,4 @@ export const Header = ({
</div>
</header>
);
};
};

View File

@@ -6,7 +6,6 @@ import { Header } from "@/components/layout/Header";
import { Sidebar } from "@/components/layout/Sidebar";
import {useFontSize} from "@/hooks/useFontSize";
import {projectSideMenus, manageSideMenus, topMenus} from "@/config/menu.data";
import ProjectTitle from "@/components/layout/ProjectTitle";
import {cn} from "@/lib/utils";
import {FONT_SIZE} from "@/const/commonConst";
import {useSelectedProject} from "@/hooks/useSelectedProject";
@@ -20,7 +19,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
const router = useRouter();
const pathname = usePathname();
const { selectedProject } = useSelectedProject();
const { selectedProject, isSelectedProjectHydrated } = useSelectedProject();
const [menuOpen, setMenuOpen] = useState(true);
const [fontSize, setFontSize] = useFontSize(initialFontSize, { hydrateFromCookie: false });
@@ -60,21 +59,14 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
setFontSize(Math.min(FONT_SIZE.MAX, fontSize + 2));
}
// CSS 변수 동기화
useEffect(() => {
if (typeof document === "undefined") return;
document.documentElement.style.setProperty(
"--content-font-size",
`${fontSize}px`,
);
}, [fontSize]);
if (!isSelectedProjectHydrated) return;
useEffect(() => {
if(!isMain && isProjectMenu && !selectedProject){
alert("옳지 않은 접근입니다.");
router.replace("/");
}
}, []);
}, [isMain, isProjectMenu, isSelectedProjectHydrated, router, selectedProject]);
return (
<div
@@ -88,6 +80,7 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
isMain={isMain}
menuOpen={menuOpen}
activeTopId={activeTop.id}
isViewProjectTitle={isViewProjectTitle}
fontSize={fontSize}
onToggleMenu={() => setMenuOpen((prev) => !prev)}
onNavigate={movePage}
@@ -120,9 +113,6 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
// SSR 단계에서의 초기 폰트 값을 FOUC 없이 유지하기 위해 fallback을 함께 지정
style={{ fontSize: `var(--content-font-size, ${initialFontSize}px)` }}
>
{isViewProjectTitle &&
<ProjectTitle/>
}
{children}
</main>
</div>
@@ -138,4 +128,4 @@ const MainLayout = ({ children, initialFontSize }: MainLayoutProps) => {
);
};
export default MainLayout;
export default MainLayout;

View File

@@ -1,17 +0,0 @@
import {useSelectedProject} from "@/hooks/useSelectedProject";
import {useMounted} from "@/hooks/useMounted";
const ProjectTitle = () => {
const mounted = useMounted();
const { selectedProject } = useSelectedProject();
if(!mounted) return null;
return (
<div className="flex justify-between items-center mb-2">
<h1 className="font-bold content-text-2xl">{selectedProject?.prjctName}</h1>
</div>
);
}
export default ProjectTitle

View File

@@ -3,7 +3,7 @@
import { Button } from "@/components/ui/button";
import { ChevronDown } from "lucide-react";
import { SideMenuItem } from "@/config/menu.types";
import {SidebarProjectSearch} from "@/components/layout/SidebarProjectSearch ";
import {SidebarProjectSearch} from "@/components/layout/SidebarProjectSearch";
interface SidebarProps {
isProjectMenu: boolean;

View File

@@ -1,8 +1,7 @@
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
import {useMemo, useState} from "react";
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
import {useSelectedProject} from "@/hooks/useSelectedProject";
import {useMounted} from "@/hooks/useMounted";
import {PROJECT_SEARCH_COUNT} from "@/const/projectConst";
import {SelectedProject} from "@/store/jotai/project";
import {useProjectTopQuery} from "@/query/project";
@@ -37,7 +36,7 @@ export const SidebarProjectSearch = () =>{
searchMode="inputOnly"
onSearchValueChange={setSearchKeyword}
placeholder="프로젝트 검색..."
spanClassName="content-text-sm"
spanClassName="text-sm"
widthClassName="w-full"
heightClassName="h-9"
preventDeselect
@@ -47,4 +46,4 @@ export const SidebarProjectSearch = () =>{
getValue={(item) => String(item.prjctIdx)}
/>
);
}
}

View File

@@ -18,7 +18,8 @@ import {Input} from "@/components/ui/input";
import {Checkbox} from "@/components/ui/checkbox";
import {KriEditor, KriEditorCommand} from "@/components/kri-editor";
import {Button} from "@/components/ui/button";
import {cn, isBlank} from "@/lib/utils";
import { isBlank } from "@kri/common";
import {cn} from "@/lib/utils";
import {ProjectMainTemplateUpdateRequest} from "@/types/project";
import { DataVerification } from "@/types/common";
import {
@@ -263,7 +264,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
>
<Card>
<CardHeader className="border-b">
<CardTitle className="text-center content-text-lg font-bold">
<CardTitle className="text-center text-lg font-bold">
{pageTitle}
</CardTitle>
</CardHeader>
@@ -277,7 +278,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
<div className="space-y-6">
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label htmlFor="tmplatNm" className="content-text-base">
<Label htmlFor="tmplatNm" className="text-base">
템플릿
</Label>
@@ -287,7 +288,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
checked={mainDesired}
onClick={toggleMainTemplate}
/>
<label htmlFor="mainTemplate" className="content-text-base cursor-pointer">
<label htmlFor="mainTemplate" className="text-base cursor-pointer">
대표 템플릿
</label>
</div>
@@ -310,7 +311,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
{isSms && (
<div className="space-y-2">
<Label className="content-text-base">타입</Label>
<Label className="text-base">타입</Label>
<KriSingleSelect
items={[...SMS_TYPE_OPTIONS]}
value={String(selectedTemplate.tmplatTy || MessageType.SMS)}
@@ -325,7 +326,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
)}
<div className="space-y-2">
<Label htmlFor="tmplatNm" className="content-text-base">
<Label htmlFor="tmplatNm" className="text-base">
템플릿 명
</Label>
<Input
@@ -337,7 +338,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
</div>
<div className="space-y-2">
<Label htmlFor="tmplatTitle" className="content-text-base">
<Label htmlFor="tmplatTitle" className="text-base">
제목
</Label>
<Input
@@ -350,15 +351,15 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
<div className="space-y-3">
<div className="flex items-center">
<Label className="content-text-base">변수 리스트</Label>
<Label className="text-base">변수 리스트</Label>
</div>
<div className="border rounded-md overflow-hidden">
<div className="bg-blue-100 grid grid-cols-2 border-b">
<div className="py-2 px-3 text-center font-medium border-r content-text-base">
<div className="py-2 px-3 text-center font-medium border-r text-base">
리스트 헤더명
</div>
<div className="py-2 px-3 text-center font-medium content-text-base">
<div className="py-2 px-3 text-center font-medium text-base">
치환 문자
</div>
</div>
@@ -375,10 +376,10 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
handleVariableClick(placeholder);
}}
>
<div className="py-2 px-3 text-center border-r content-text-base">
<div className="py-2 px-3 text-center border-r text-base">
{h.listHderNm}
</div>
<div className="py-2 px-3 text-center content-text-base">
<div className="py-2 px-3 text-center text-base">
{placeholder}
</div>
</div>
@@ -391,7 +392,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
{selectedTemplate ? (
isSmsTemplate(selectedTemplate) ? (
<div className="space-y-2">
<Label htmlFor="sendTel" className="content-text-base">
<Label htmlFor="sendTel" className="text-base">
발신 번호
</Label>
<Input
@@ -401,13 +402,13 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
placeholder="발신 번호를 입력하세요"
className="w-full"
/>
<p className="content-text-sm text-red-600 font-medium">
<p className="text-sm text-red-600 font-medium">
⚠️ 비즈 뿌리오에 등록된 발신 번호가 아니면 전송되지 않습니다.
</p>
</div>
) : (
<div className="space-y-2">
<Label htmlFor="sendEmail" className="content-text-base">
<Label htmlFor="sendEmail" className="text-base">
발신 이메일
</Label>
<Input
@@ -422,7 +423,7 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
) : null}
<div className="space-y-2">
<Label htmlFor="sendNm" className="content-text-base">
<Label htmlFor="sendNm" className="text-base">
발신자 명
</Label>
<Input
@@ -488,4 +489,4 @@ const MessageTemplate = ({ pageTitle, defaultTemplate }: MessageTemplateProps) =
);
};
export default MessageTemplate;
export default MessageTemplate;

View File

@@ -2,7 +2,7 @@
import { Provider as JotaiProvider } from "jotai";
import { LoadingOverlay } from "@/components/common/LoadingOverlay";
import { QueryProvider } from "./QueryProvider";
import { QueryProvider } from "@kri/common/query";
import { QueryLoadingSync } from "./QueryLoadingSync";
export function AppProvider({ children }: { children: React.ReactNode }) {
@@ -15,4 +15,4 @@ export function AppProvider({ children }: { children: React.ReactNode }) {
</QueryProvider>
</JotaiProvider>
);
}
}

View File

@@ -1,20 +1,11 @@
"use client";
import { useEffect } from "react";
import { useAtom } from "jotai";
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
import { QueryLoadingSync as CommonQueryLoadingSync } from "@kri/common/query";
import { useSetAtom } from "jotai";
import { queryLoadingAtom } from "@/store/jotai/loading";
export function QueryLoadingSync() {
const fetching = useIsFetching({
predicate: (q) => !q.options.meta?.ignoreGlobalLoading,
});
const mutating = useIsMutating();
const [, setQueryLoading] = useAtom(queryLoadingAtom);
const setQueryLoading = useSetAtom(queryLoadingAtom);
useEffect(() => {
setQueryLoading(fetching + mutating > 0);
}, [fetching, mutating, setQueryLoading]);
return null;
}
return <CommonQueryLoadingSync onLoadingChange={setQueryLoading} />;
}

View File

@@ -1,23 +0,0 @@
"use client";
import React, { useState } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
export function QueryProvider({ children }: { children: React.ReactNode }) {
const [client] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
retry: 1,
refetchOnWindowFocus: false,
refetchOnReconnect: false,
staleTime: 30_000,
gcTime: 5 * 60_000,
},
},
})
);
return <QueryClientProvider client={client}>{children}</QueryClientProvider>;
}

View File

@@ -2,7 +2,7 @@ import { DataTableColumn } from "@/components/data-table/DataTable.type";
import {ListContactResult, listHeader, ListResultBase, ListSendResult} from "@/types/list";
import { ListHeaderAssignConst, ListHeaderConst } from "@/const/listConst";
import { Button } from "@/components/ui/button";
import { formatKst } from "@/lib/utils";
import { formatKst } from "@kri/common";
import { ResultCode, ResultCodeType } from "@/types/project";
export type ListTableRow = Record<string, unknown>;

View File

@@ -1,7 +1,8 @@
import {ProjectInfo} from "@/types/project";
import {ColumnDef} from "@tanstack/react-table";
import {Badge} from "@/components/ui/badge";
import {cn, formatKst} from "@/lib/utils";
import { formatKst } from "@kri/common";
import {cn} from "@/lib/utils";
import {PROJECT_STATUS_CLASS, PROJECT_STATUS_LABEL} from "@/const/projectConst";
import {ItrntUserInfo} from "@/types/user";
@@ -50,4 +51,4 @@ export const getProjectColumns = (users:ItrntUserInfo[]): ColumnDef<ProjectInfo>
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
enableSorting: true,
}
];
];

View File

@@ -2,7 +2,7 @@ import {ColumnDef} from "@tanstack/react-table";
import {Button} from "@/components/ui/button";
import {Pencil, Trash2} from "lucide-react";
import {UserInfo} from "@/types/user";
import {formatKst} from "@/lib/utils";
import {formatKst} from "@kri/common";
import {MultiSelectOption} from "@/components/ui/multi-select";
@@ -77,4 +77,4 @@ export const getUserColumns = (actions: UserColumnsActions, userRoleArray:MultiS
),
enableSorting: false,
},
];
];

View File

@@ -11,7 +11,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
"placeholder-content-text-lg",
"placeholder:text-lg",
className
)}
{...props}