feat: 검색이 있는 모든 목록에 [검색 초기화]를 두고 기존 [초기화]를 그 이름으로 바꾼다
게시판(공지·FAQ·1:1문의)·콘텐츠(쇼츠·만화·퀴즈)·꾸미기 아이템·금칙어·공통코드 그룹 목록에 새로 추가하고, 포인트 적립·기준의 [초기화]는 [검색 초기화]로 바꾼다. 모두 목록 컨테이너를 다시 마운트해 입력 중인 검색어까지 비우고 기본 주소로 돌아간다. 검색이 없는 앱 메뉴·관리자 메뉴 목록은 대상이 아니고, 가맹몰 관리는 앞서 요청으로 뺀 상태를 유지한다. Co-Authored-By: Claude Opus 5
@54cf18e8e0af506047329ae4bfcccff3c0560288
--- app/(protected)/(basic)/boards/_components/board-post-list.tsx
+++ app/(protected)/(basic)/boards/_components/board-post-list.tsx
... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 |
import { useState, type ReactNode } from 'react';
|
| 5 | 5 |
import { useBlockingAction } from '@/app/_hooks/use-blocking-action';
|
| 6 | 6 |
import { FoxButton } from '@fox/core/components/fox-button';
|
| 7 |
+import { FoxButtonGroup } from '@fox/core/components/fox-button-group';
|
|
| 7 | 8 |
import { FoxIconButton } from '@fox/core/components/fox-icon-button';
|
| 8 | 9 |
import { FoxListContainer } from '@fox/core/components/fox-list-container';
|
| 9 | 10 |
import { FoxSelectText } from '@fox/core/components/fox-select-text';
|
... | ... | @@ -12,6 +13,7 @@ |
| 12 | 13 |
import type { BoardPost, BoardType } from '@/lib/domain/board-post';
|
| 13 | 14 |
import type { CommonCode } from '@/lib/domain/common-code';
|
| 14 | 15 |
import {
|
| 16 |
+ BOARD_PATHS, |
|
| 15 | 17 |
BOARD_PAGE_SIZE_OPTIONS, |
| 16 | 18 |
BOARD_SEARCH_FIELDS, |
| 17 | 19 |
FILTER_ALL, |
... | ... | @@ -67,9 +69,18 @@ |
| 67 | 69 |
router.replace(buildBoardPostHref(boardType, query, { ...patch, page: 1 }));
|
| 68 | 70 |
} |
| 69 | 71 |
|
| 72 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 73 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 74 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 75 |
+ function resetSearch() {
|
|
| 76 |
+ setResetCount((count) => count + 1); |
|
| 77 |
+ router.replace(BOARD_PATHS[boardType]); |
|
| 78 |
+ } |
|
| 79 |
+ |
|
| 70 | 80 |
return ( |
| 71 | 81 |
<> |
| 72 | 82 |
<FoxListContainer<BoardPost> |
| 83 |
+ key={resetCount}
|
|
| 73 | 84 |
title={title}
|
| 74 | 85 |
breadcrumb={breadcrumb}
|
| 75 | 86 |
caption={title}
|
... | ... | @@ -114,17 +125,20 @@ |
| 114 | 125 |
searchField={query.searchField}
|
| 115 | 126 |
keyword={query.keyword}
|
| 116 | 127 |
toolbarActions={
|
| 117 |
- canCreate ? ( |
|
| 118 |
- <FoxButton |
|
| 119 |
- type="primary" |
|
| 120 |
- size="md" |
|
| 121 |
- leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 122 |
- label="신규 등록" |
|
| 123 |
- onAction={() => setIsCreateOpen(true)}
|
|
| 124 |
- /> |
|
| 125 |
- ) : ( |
|
| 126 |
- extraToolbar |
|
| 127 |
- ) |
|
| 128 |
+ <FoxButtonGroup size="md"> |
|
| 129 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 130 |
+ {canCreate ? (
|
|
| 131 |
+ <FoxButton |
|
| 132 |
+ type="primary" |
|
| 133 |
+ size="md" |
|
| 134 |
+ leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 135 |
+ label="신규 등록" |
|
| 136 |
+ onAction={() => setIsCreateOpen(true)}
|
|
| 137 |
+ /> |
|
| 138 |
+ ) : ( |
|
| 139 |
+ extraToolbar |
|
| 140 |
+ )} |
|
| 141 |
+ </FoxButtonGroup> |
|
| 128 | 142 |
} |
| 129 | 143 |
filter={
|
| 130 | 144 |
<div className={styles.filter}>
|
--- app/(protected)/(basic)/contents/_components/content-list-shell.tsx
+++ app/(protected)/(basic)/contents/_components/content-list-shell.tsx
... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 |
'use client'; |
| 2 | 2 |
|
| 3 | 3 |
import { useRouter } from 'next/navigation';
|
| 4 |
-import type { ReactNode } from 'react';
|
|
| 4 |
+import { useState, type ReactNode } from 'react';
|
|
| 5 | 5 |
import { FoxButton } from '@fox/core/components/fox-button';
|
| 6 | 6 |
import { FoxButtonGroup } from '@fox/core/components/fox-button-group';
|
| 7 | 7 |
import { FoxSelectText } from '@fox/core/components/fox-select-text';
|
... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 |
buildContentHref, |
| 18 | 18 |
contentBreadcrumb, |
| 19 | 19 |
contentCreatePath, |
| 20 |
+ contentListPath, |
|
| 20 | 21 |
type ContentPageSize, |
| 21 | 22 |
type ContentQuery, |
| 22 | 23 |
type ContentSortOption, |
... | ... | @@ -60,8 +61,17 @@ |
| 60 | 61 |
router.push(buildContentHref(kind, query, patch)); |
| 61 | 62 |
} |
| 62 | 63 |
|
| 64 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 65 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 66 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 67 |
+ function resetSearch() {
|
|
| 68 |
+ setResetCount((count) => count + 1); |
|
| 69 |
+ router.replace(contentListPath(kind)); |
|
| 70 |
+ } |
|
| 71 |
+ |
|
| 63 | 72 |
return ( |
| 64 | 73 |
<FoxListContainer<T> |
| 74 |
+ key={resetCount}
|
|
| 65 | 75 |
title={`콘텐츠 목록 (${CONTENT_KIND_LABEL[kind]})`}
|
| 66 | 76 |
breadcrumb={contentBreadcrumb(kind)}
|
| 67 | 77 |
caption={`${CONTENT_KIND_LABEL[kind]} 콘텐츠 목록`}
|
... | ... | @@ -118,6 +128,7 @@ |
| 118 | 128 |
searchPlaceholder="검색어를 입력하세요." |
| 119 | 129 |
toolbarActions={
|
| 120 | 130 |
<FoxButtonGroup size="md"> |
| 131 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 121 | 132 |
{extraActions}
|
| 122 | 133 |
<FoxButton |
| 123 | 134 |
type="primary" |
--- app/(protected)/(basic)/decoration-items/_components/decoration-item-list.tsx
+++ app/(protected)/(basic)/decoration-items/_components/decoration-item-list.tsx
... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 |
import { useRouter } from 'next/navigation';
|
| 4 | 4 |
import { useState } from 'react';
|
| 5 | 5 |
import { FoxButton } from '@fox/core/components/fox-button';
|
| 6 |
+import { FoxButtonGroup } from '@fox/core/components/fox-button-group';
|
|
| 6 | 7 |
import {
|
| 7 | 8 |
FoxListContainer, |
| 8 | 9 |
type FoxListColumn, |
... | ... | @@ -29,6 +30,7 @@ |
| 29 | 30 |
type DecorationItemPageSize, |
| 30 | 31 |
type DecorationItemQuery, |
| 31 | 32 |
type DecorationItemSearchField, |
| 33 |
+ DECORATION_ITEMS_PATH, |
|
| 32 | 34 |
} from '@/lib/domain/decoration-item-query'; |
| 33 | 35 |
import { DecorationItemCreateModal } from './decoration-item-create-modal';
|
| 34 | 36 |
import { DecorationItemRowActions } from './decoration-item-row-actions';
|
... | ... | @@ -77,6 +79,14 @@ |
| 77 | 79 |
/** 목록 조건이 바뀌면 늘 1페이지로 되돌린다 — 이전 페이지 번호는 새 조건에서 의미가 다르다. */ |
| 78 | 80 |
function go(patch: Partial<DecorationItemQuery>) {
|
| 79 | 81 |
router.replace(buildDecorationItemHref(query, { ...patch, page: 1 }));
|
| 82 |
+ } |
|
| 83 |
+ |
|
| 84 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 85 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 86 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 87 |
+ function resetSearch() {
|
|
| 88 |
+ setResetCount((count) => count + 1); |
|
| 89 |
+ router.replace(DECORATION_ITEMS_PATH); |
|
| 80 | 90 |
} |
| 81 | 91 |
|
| 82 | 92 |
const columns: FoxListColumn<DecorationItem>[] = [ |
... | ... | @@ -155,6 +165,7 @@ |
| 155 | 165 |
return ( |
| 156 | 166 |
<> |
| 157 | 167 |
<FoxListContainer<DecorationItem> |
| 168 |
+ key={resetCount}
|
|
| 158 | 169 |
title="꾸미기 아이템 목록" |
| 159 | 170 |
breadcrumb={[
|
| 160 | 171 |
{ label: '홈', href: '/' },
|
... | ... | @@ -205,13 +216,16 @@ |
| 205 | 216 |
searchField={query.searchField}
|
| 206 | 217 |
keyword={query.keyword}
|
| 207 | 218 |
toolbarActions={
|
| 208 |
- <FoxButton |
|
| 209 |
- type="primary" |
|
| 210 |
- size="md" |
|
| 211 |
- leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 212 |
- label="신규 등록" |
|
| 213 |
- onAction={() => setIsCreateOpen(true)}
|
|
| 214 |
- /> |
|
| 219 |
+ <FoxButtonGroup size="md"> |
|
| 220 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 221 |
+ <FoxButton |
|
| 222 |
+ type="primary" |
|
| 223 |
+ size="md" |
|
| 224 |
+ leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 225 |
+ label="신규 등록" |
|
| 226 |
+ onAction={() => setIsCreateOpen(true)}
|
|
| 227 |
+ /> |
|
| 228 |
+ </FoxButtonGroup> |
|
| 215 | 229 |
} |
| 216 | 230 |
page={currentPage}
|
| 217 | 231 |
totalPages={totalPages}
|
--- app/(protected)/(basic)/points/accumulated/_components/point-account-list.tsx
+++ app/(protected)/(basic)/points/accumulated/_components/point-account-list.tsx
... | ... | @@ -65,6 +65,15 @@ |
| 65 | 65 |
router.replace(buildPointAccountHref(query, { ...patch, page: 1 }));
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 69 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 70 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 71 |
+ function resetSearch() {
|
|
| 72 |
+ setSchoolNameDraft('');
|
|
| 73 |
+ setResetCount((count) => count + 1); |
|
| 74 |
+ router.replace(POINT_ACCOUNTS_PATH); |
|
| 75 |
+ } |
|
| 76 |
+ |
|
| 68 | 77 |
function selectedNumber(value: number | null) {
|
| 69 | 78 |
return value === null ? FILTER_ALL : String(value); |
| 70 | 79 |
} |
... | ... | @@ -140,6 +149,7 @@ |
| 140 | 149 |
return ( |
| 141 | 150 |
<> |
| 142 | 151 |
<FoxListContainer<PointAccount> |
| 152 |
+ key={resetCount}
|
|
| 143 | 153 |
title="누적포인트 관리 목록" |
| 144 | 154 |
breadcrumb={[
|
| 145 | 155 |
{ label: '홈', href: '/' },
|
... | ... | @@ -219,15 +229,7 @@ |
| 219 | 229 |
keyword={query.keyword}
|
| 220 | 230 |
searchPlaceholder="검색어를 입력하세요." |
| 221 | 231 |
toolbarActions={
|
| 222 |
- <FoxButton |
|
| 223 |
- type="default" |
|
| 224 |
- size="md" |
|
| 225 |
- label="초기화" |
|
| 226 |
- onAction={() => {
|
|
| 227 |
- setSchoolNameDraft('');
|
|
| 228 |
- router.replace(POINT_ACCOUNTS_PATH); |
|
| 229 |
- }} |
|
| 230 |
- /> |
|
| 232 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 231 | 233 |
} |
| 232 | 234 |
page={currentPage}
|
| 233 | 235 |
totalPages={totalPages}
|
--- app/(protected)/(basic)/points/standards/_components/point-standard-list.tsx
+++ app/(protected)/(basic)/points/standards/_components/point-standard-list.tsx
... | ... | @@ -55,6 +55,14 @@ |
| 55 | 55 |
router.replace(buildPointStandardHref(query, { ...patch, page: 1 }));
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 59 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 60 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 61 |
+ function resetSearch() {
|
|
| 62 |
+ setResetCount((count) => count + 1); |
|
| 63 |
+ router.replace(POINT_STANDARDS_PATH); |
|
| 64 |
+ } |
|
| 65 |
+ |
|
| 58 | 66 |
const columns: FoxListColumn<PointStandard>[] = [ |
| 59 | 67 |
{
|
| 60 | 68 |
key: 'no', |
... | ... | @@ -125,6 +133,7 @@ |
| 125 | 133 |
return ( |
| 126 | 134 |
<> |
| 127 | 135 |
<FoxListContainer<PointStandard> |
| 136 |
+ key={resetCount}
|
|
| 128 | 137 |
title="포인트 기준관리 목록" |
| 129 | 138 |
breadcrumb={[
|
| 130 | 139 |
{ label: '홈', href: '/' },
|
... | ... | @@ -156,12 +165,7 @@ |
| 156 | 165 |
searchPlaceholder="검색어를 입력하세요." |
| 157 | 166 |
toolbarActions={
|
| 158 | 167 |
<FoxButtonGroup size="md"> |
| 159 |
- <FoxButton |
|
| 160 |
- type="default" |
|
| 161 |
- size="md" |
|
| 162 |
- label="초기화" |
|
| 163 |
- onAction={() => router.replace(POINT_STANDARDS_PATH)}
|
|
| 164 |
- /> |
|
| 168 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 165 | 169 |
<FoxButton |
| 166 | 170 |
type="primary" |
| 167 | 171 |
size="md" |
--- app/(protected)/(basic)/system/banned-words/_components/banned-word-list.tsx
+++ app/(protected)/(basic)/system/banned-words/_components/banned-word-list.tsx
... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 |
import { useBlockingAction } from '@/app/_hooks/use-blocking-action';
|
| 15 | 15 |
import { formatOptionalValue, type BannedWord } from '@/lib/domain/banned-word';
|
| 16 | 16 |
import {
|
| 17 |
+ BANNED_WORDS_PATH, |
|
| 17 | 18 |
BANNED_WORD_NEW_PATH, |
| 18 | 19 |
BANNED_WORD_PAGE_SIZE_OPTIONS, |
| 19 | 20 |
buildBannedWordHref, |
... | ... | @@ -45,6 +46,14 @@ |
| 45 | 46 |
|
| 46 | 47 |
function go(patch: Partial<BannedWordQuery>) {
|
| 47 | 48 |
router.replace(buildBannedWordHref(query, { ...patch, page: 1 }));
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 52 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 53 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 54 |
+ function resetSearch() {
|
|
| 55 |
+ setResetCount((count) => count + 1); |
|
| 56 |
+ router.replace(BANNED_WORDS_PATH); |
|
| 48 | 57 |
} |
| 49 | 58 |
|
| 50 | 59 |
function runDelete(word: BannedWord) {
|
... | ... | @@ -112,6 +121,7 @@ |
| 112 | 121 |
return ( |
| 113 | 122 |
<> |
| 114 | 123 |
<FoxListContainer<BannedWord> |
| 124 |
+ key={resetCount}
|
|
| 115 | 125 |
title="금칙어관리" |
| 116 | 126 |
breadcrumb={[
|
| 117 | 127 |
{ label: '홈', href: '/' },
|
... | ... | @@ -143,6 +153,7 @@ |
| 143 | 153 |
searchPlaceholder="금칙어를 입력하세요." |
| 144 | 154 |
toolbarActions={
|
| 145 | 155 |
<> |
| 156 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 146 | 157 |
<FoxButton |
| 147 | 158 |
type="secondary" |
| 148 | 159 |
size="md" |
--- app/(protected)/(basic)/system/codes/_components/code-management.tsx
+++ app/(protected)/(basic)/system/codes/_components/code-management.tsx
... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 |
import { useRouter } from 'next/navigation';
|
| 4 | 4 |
import { useState } from 'react';
|
| 5 | 5 |
import { FoxButton } from '@fox/core/components/fox-button';
|
| 6 |
+import { FoxButtonGroup } from '@fox/core/components/fox-button-group';
|
|
| 6 | 7 |
import { FoxHeadingGroup } from '@fox/core/components/fox-heading-group';
|
| 7 | 8 |
import {
|
| 8 | 9 |
FoxListContainer, |
... | ... | @@ -19,6 +20,7 @@ |
| 19 | 20 |
import {
|
| 20 | 21 |
COMMON_CODE_PAGE_SIZE, |
| 21 | 22 |
COMMON_CODE_SEARCH_FIELD_OPTIONS, |
| 23 |
+ COMMON_CODES_PATH, |
|
| 22 | 24 |
buildCommonCodeHref, |
| 23 | 25 |
type CommonCodeQuery, |
| 24 | 26 |
type CommonCodeSearchField, |
... | ... | @@ -96,6 +98,14 @@ |
| 96 | 98 |
|
| 97 | 99 |
function go(patch: Partial<CommonCodeQuery>) {
|
| 98 | 100 |
router.replace(buildCommonCodeHref(query, patch)); |
| 101 |
+ } |
|
| 102 |
+ |
|
| 103 |
+ // 검색 초기화 — 주소를 되돌리는 것만으론 아직 적용 안 한 입력값이 남는다. 목록 컨테이너를 |
|
| 104 |
+ // 다시 마운트해 검색 상자의 초안까지 비운다. |
|
| 105 |
+ const [resetCount, setResetCount] = useState(0); |
|
| 106 |
+ function resetSearch() {
|
|
| 107 |
+ setResetCount((count) => count + 1); |
|
| 108 |
+ router.replace(COMMON_CODES_PATH); |
|
| 99 | 109 |
} |
| 100 | 110 |
|
| 101 | 111 |
/** |
... | ... | @@ -239,6 +249,7 @@ |
| 239 | 249 |
<section className={styles.panel}>
|
| 240 | 250 |
<FoxHeadingGroup title="공통코드 목록" /> |
| 241 | 251 |
<FoxListContainer<CommonCodeGroup> |
| 252 |
+ key={resetCount}
|
|
| 242 | 253 |
caption="공통코드 목록" |
| 243 | 254 |
columns={groupColumns}
|
| 244 | 255 |
rows={groups}
|
... | ... | @@ -252,13 +263,16 @@ |
| 252 | 263 |
searchField={query.searchField}
|
| 253 | 264 |
keyword={query.keyword}
|
| 254 | 265 |
toolbarActions={
|
| 255 |
- <FoxButton |
|
| 256 |
- type="primary" |
|
| 257 |
- size="md" |
|
| 258 |
- leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 259 |
- label="신규 등록" |
|
| 260 |
- onAction={() => setModal({ kind: 'group-create' })}
|
|
| 261 |
- /> |
|
| 266 |
+ <FoxButtonGroup size="md"> |
|
| 267 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetSearch} />
|
|
| 268 |
+ <FoxButton |
|
| 269 |
+ type="primary" |
|
| 270 |
+ size="md" |
|
| 271 |
+ leadingIcon={<i className="fox-ico fox-ico-Plus" aria-hidden="true" />}
|
|
| 272 |
+ label="신규 등록" |
|
| 273 |
+ onAction={() => setModal({ kind: 'group-create' })}
|
|
| 274 |
+ /> |
|
| 275 |
+ </FoxButtonGroup> |
|
| 262 | 276 |
} |
| 263 | 277 |
onRowSelect={(row) => go({ comCd: row.comCd })}
|
| 264 | 278 |
page={groupPage}
|
--- app/(protected)/(basic)/system/merchant-details/_components/merchant-detail-list.tsx
+++ app/(protected)/(basic)/system/merchant-details/_components/merchant-detail-list.tsx
... | ... | @@ -351,7 +351,7 @@ |
| 351 | 351 |
</div> |
| 352 | 352 |
<FoxButtonGroup size="md"> |
| 353 | 353 |
<FoxButton type="secondary" size="md" label="적용" onAction={applyFilters} />
|
| 354 |
- <FoxButton type="default" size="md" label="초기화" onAction={resetFilters} />
|
|
| 354 |
+ <FoxButton type="default" size="md" label="검색 초기화" onAction={resetFilters} />
|
|
| 355 | 355 |
</FoxButtonGroup> |
| 356 | 356 |
</div> |
| 357 | 357 |
} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?