From 9a4fef21a6458f786d06baffc5a5c5e5ce7d007c Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 29 Jan 2026 07:22:46 +0900 Subject: [PATCH 1/2] #28 --- frontend/src/components/TagLink.tsx | 7 +++++++ frontend/src/components/TagSearch.tsx | 3 ++- frontend/src/components/TagSearchBox.tsx | 4 ++-- frontend/src/types.ts | 13 +++++++------ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/TagLink.tsx b/frontend/src/components/TagLink.tsx index a9a1c11..3ef86c8 100644 --- a/frontend/src/components/TagLink.tsx +++ b/frontend/src/components/TagLink.tsx @@ -91,6 +91,13 @@ export default (({ tag, style={{ paddingLeft: `${ (nestLevel - 1) }rem` }}> ↳ )} + {tag.matchedAlias != null && ( + <> + + {tag.matchedAlias} + + <> → + )} {linkFlg ? ( { } const res = await axios.get (`${ API_BASE_URL }/tags/autocomplete`, { params: { q } }) - const data = res.data as Tag[] + const data = toCamel (res.data, { deep: true }) as Tag[] setSuggestions (data) if (suggestions.length > 0) setSuggestionsVsbl (true) diff --git a/frontend/src/components/TagSearchBox.tsx b/frontend/src/components/TagSearchBox.tsx index 79c912f..cb62541 100644 --- a/frontend/src/components/TagSearchBox.tsx +++ b/frontend/src/components/TagSearchBox.tsx @@ -1,3 +1,4 @@ +import TagLink from '@/components/TagLink' import { cn } from '@/lib/utils' import type { FC } from 'react' @@ -22,8 +23,7 @@ export default (({ suggestions, activeIndex, onSelect }: Props) => { className={cn ('px-3 py-2 cursor-pointer hover:bg-gray-300 dark:hover:bg-gray-700', i === activeIndex && 'bg-gray-300 dark:bg-gray-700')} onMouseDown={() => onSelect (tag)}> - {tag.name} - {{tag.postCount}} + ))} ) }) satisfies FC diff --git a/frontend/src/types.ts b/frontend/src/types.ts index a2f57b7..5cf9f5d 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -44,12 +44,13 @@ export type SubMenuItem = visible?: boolean } export type Tag = { - id: number - name: string - category: Category - postCount: number - hasWiki: boolean - children?: Tag[] } + id: number + name: string + category: Category + postCount: number + hasWiki: boolean + children?: Tag[] + matchedAlias?: string | null } export type User = { id: number -- 2.34.1 From b58c114b15169e968413dd84064aedcdfacd57e0 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Thu, 29 Jan 2026 07:29:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#28=20=E4=BB=B6=E6=95=B0=200=20=E4=BB=B6?= =?UTF-8?q?=E9=99=A4=E5=A4=96=E3=82=92=E3=81=A4=E3=81=84=E3=81=A7=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C=EF=BC=88=E3=83=95=E3=83=AD=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E3=81=BF=EF=BC=9B=E3=83=90=E3=83=83=E3=82=AF=E3=82=A8?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=AF=E5=BE=8C=E3=81=A7=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/PostFormTagsArea.tsx | 3 ++- frontend/src/components/TagSearch.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/PostFormTagsArea.tsx b/frontend/src/components/PostFormTagsArea.tsx index 38ffd70..de97ada 100644 --- a/frontend/src/components/PostFormTagsArea.tsx +++ b/frontend/src/components/PostFormTagsArea.tsx @@ -60,7 +60,8 @@ export default (({ tags, setTags }: Props) => { const { start, end, token } = getTokenAt (v, pos) setBounds ({ start, end }) const res = await axios.get (`${ API_BASE_URL }/tags/autocomplete`, { params: { q: token } }) - setSuggestions (toCamel (res.data as any, { deep: true }) as Tag[]) + const data = toCamel (res.data as any, { deep: true }) as Tag[] + setSuggestions (data.filter (t => t.postCount > 0)) setSuggestionsVsbl (suggestions.length > 0) } diff --git a/frontend/src/components/TagSearch.tsx b/frontend/src/components/TagSearch.tsx index 62cb8d2..de1cde1 100644 --- a/frontend/src/components/TagSearch.tsx +++ b/frontend/src/components/TagSearch.tsx @@ -33,7 +33,7 @@ export default (() => { const res = await axios.get (`${ API_BASE_URL }/tags/autocomplete`, { params: { q } }) const data = toCamel (res.data, { deep: true }) as Tag[] - setSuggestions (data) + setSuggestions (data.filter (t => t.postCount > 0)) if (suggestions.length > 0) setSuggestionsVsbl (true) } -- 2.34.1