コミットを比較
2
コミット
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
e3e9efe684 | ||
|
|
73d290c450 |
@@ -218,63 +218,16 @@ class TagsController < ApplicationController
|
||||
locale = resolve_locale!
|
||||
|
||||
q = params[:q].to_s.strip.sub(/\Anot:/i, '')
|
||||
prefix = "#{ ActiveRecord::Base.sanitize_sql_like(q) }%"
|
||||
literal = ActiveRecord::Base.sanitize_sql_like(q)
|
||||
nico = bool?(:nico, default: true)
|
||||
present = bool?(:present, default: true)
|
||||
|
||||
with_nico = bool?(:nico, default: true)
|
||||
present_only = bool?(:present, default: true)
|
||||
|
||||
alias_rows =
|
||||
TagName
|
||||
.where(language_code: locale.language_code, primary_flg: false)
|
||||
.where('name LIKE ?', prefix)
|
||||
.pluck(:tag_id, :name)
|
||||
|
||||
matched_alias_by_tag_id = { }
|
||||
tag_ids = []
|
||||
alias_rows.each do |tag_id, alias_name|
|
||||
tag_ids << tag_id
|
||||
matched_alias_by_tag_id[tag_id] ||= alias_name
|
||||
rows = autocomplete_rows(locale:, pattern: "#{ literal }%", nico:, present:)
|
||||
if rows.length < 20 && q.present?
|
||||
suffix_rows = autocomplete_rows(locale:, pattern: "%#{ literal }", nico:, present:)
|
||||
rows = (rows + suffix_rows).uniq { [_1['category'], _1['id']] }.first(20)
|
||||
end
|
||||
|
||||
base =
|
||||
Tag
|
||||
.joins(:tag_names)
|
||||
.preload(:tag_names, :materials, :deerjikists, :tag_descriptions,
|
||||
parents: [:tag_names, :materials, :deerjikists, :tag_descriptions])
|
||||
.where(tag_names: { language_code: locale.language_code, primary_flg: true },
|
||||
deprecated_at: nil)
|
||||
base = base.where('tags.post_count > 0') if present_only
|
||||
|
||||
canonical_hit = base.where('tag_names.name LIKE ?', prefix)
|
||||
|
||||
internal_tags = canonical_hit.or(base.where(id: tag_ids.uniq))
|
||||
|
||||
internal_rows =
|
||||
internal_tags
|
||||
.order(Arel.sql('tags.post_count DESC, tag_names.name'))
|
||||
.limit(20)
|
||||
.map { |tag|
|
||||
TagRepr.base(tag, language_code: locale.language_code)
|
||||
.merge(matched_alias: matched_alias_by_tag_id[tag.id])
|
||||
}
|
||||
|
||||
return render json: internal_rows unless with_nico
|
||||
|
||||
external_base = ExternalTag.all
|
||||
external_base = external_base.where('post_count > 0') if present_only
|
||||
|
||||
external_rows =
|
||||
external_base
|
||||
.where("CONCAT(platform, ':', name) LIKE ? OR name LIKE ?", prefix, prefix)
|
||||
.order(post_count: :desc, name: :asc)
|
||||
.limit(20)
|
||||
.map { external_tag_json(_1) }
|
||||
|
||||
rows =
|
||||
(internal_rows + external_rows)
|
||||
.sort_by { |row| [-row['post_count'], row['name'] || row[:name]] }
|
||||
.first(20)
|
||||
|
||||
render json: rows
|
||||
end
|
||||
|
||||
@@ -545,6 +498,59 @@ class TagsController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def autocomplete_rows locale:, pattern:, nico:, present:
|
||||
alias_rows =
|
||||
TagName
|
||||
.where(language_code: locale.language_code, primary_flg: false)
|
||||
.where('name LIKE ?', pattern)
|
||||
.pluck(:tag_id, :name)
|
||||
|
||||
matched_alias_by_tag_id = { }
|
||||
tag_ids = []
|
||||
alias_rows.each do |tag_id, alias_name|
|
||||
tag_ids << tag_id
|
||||
matched_alias_by_tag_id[tag_id] ||= alias_name
|
||||
end
|
||||
|
||||
base =
|
||||
Tag
|
||||
.joins(:tag_names)
|
||||
.preload(:tag_names, :materials, :deerjikists, :tag_descriptions,
|
||||
parents: [:tag_names, :materials, :deerjikists, :tag_descriptions])
|
||||
.where(tag_names: { language_code: locale.language_code, primary_flg: true },
|
||||
deprecated_at: nil)
|
||||
base = base.where('tags.post_count > 0') if present
|
||||
|
||||
canonical_hit = base.where('tag_names.name LIKE ?', pattern)
|
||||
|
||||
internal_tags = canonical_hit.or(base.where(id: tag_ids.uniq))
|
||||
|
||||
internal_rows =
|
||||
internal_tags
|
||||
.order(Arel.sql('tags.post_count DESC, tag_names.name'))
|
||||
.limit(20)
|
||||
.map { |tag|
|
||||
TagRepr.base(tag, language_code: locale.language_code)
|
||||
.merge(matched_alias: matched_alias_by_tag_id[tag.id])
|
||||
}
|
||||
|
||||
return internal_rows unless nico
|
||||
|
||||
external_base = ExternalTag.all
|
||||
external_base = external_base.where('post_count > 0') if present
|
||||
|
||||
external_rows =
|
||||
external_base
|
||||
.where("CONCAT(platform, ':', name) LIKE ? OR name LIKE ?", pattern, pattern)
|
||||
.order(post_count: :desc, name: :asc)
|
||||
.limit(20)
|
||||
.map { external_tag_json(_1) }
|
||||
|
||||
(internal_rows + external_rows)
|
||||
.sort_by { |row| [-row['post_count'], row['name'] || row[:name]] }
|
||||
.first(20)
|
||||
end
|
||||
|
||||
def material_filter_param default:
|
||||
value = params[:material_filter].to_s.presence
|
||||
return default unless ['present', 'missing', 'any'].include?(value)
|
||||
|
||||
@@ -6,11 +6,6 @@ class WikiPagesController < ApplicationController
|
||||
def index
|
||||
locale = resolve_locale!
|
||||
|
||||
resource_type = params[:resource_type]
|
||||
unless resource_type.nil? || ['tag_description', 'tag_group'].include?(resource_type)
|
||||
return head :bad_request
|
||||
end
|
||||
|
||||
title = params[:title].to_s.strip
|
||||
descriptions =
|
||||
HistoryAccess.current(TagDescription.all, TagDescriptionVersion)
|
||||
@@ -19,8 +14,6 @@ class WikiPagesController < ApplicationController
|
||||
|
||||
descriptions = descriptions.order(updated_at: :desc, id: :asc)
|
||||
tag_groups = HistoryAccess.current(TagGroup.all, TagGroupVersion).order(updated_at: :desc, id: :asc)
|
||||
descriptions = descriptions.none if resource_type == 'tag_group'
|
||||
tag_groups = tag_groups.none if resource_type == 'tag_description'
|
||||
if title.present?
|
||||
pattern = "%#{ ApplicationRecord.sanitize_sql_like(title) }%"
|
||||
descriptions =
|
||||
|
||||
@@ -482,6 +482,7 @@ RSpec.describe 'Tags API', type: :request do
|
||||
create(:tag, category: :general, primary_name: name, post_count: 1)
|
||||
create(:external_tag, name:, post_count: 1)
|
||||
end
|
||||
create(:external_tag, name: 'suffix_combined', post_count: 100)
|
||||
|
||||
get '/tags/autocomplete', params: { q: 'combined' }
|
||||
|
||||
@@ -490,6 +491,39 @@ RSpec.describe 'Tags API', type: :request do
|
||||
expect(json.map { |row| row.fetch('name') }).to eq(expected.first(20))
|
||||
end
|
||||
|
||||
it 'appends primary, alias, and external suffix matches without duplicate resources' do
|
||||
prefix = create(:tag, primary_name: 'tail', post_count: 1)
|
||||
create(:tag_name, :alias, name: 'tail_alias', tag: prefix)
|
||||
create(:tag_name, :alias, name: 'alias_tail', tag: prefix)
|
||||
create(:tag, primary_name: 'primary_tail', post_count: 4)
|
||||
alias_target = create(:tag, primary_name: 'alias_target', post_count: 3)
|
||||
create(:tag_name, :alias, name: 'suffix_tail', tag: alias_target)
|
||||
external = create(:external_tag, id: prefix.id, name: 'external_tail', post_count: 5)
|
||||
create(:tag, primary_name: 'middle_tail_only', post_count: 100)
|
||||
create(:external_tag, name: 'middle_tail_only', post_count: 100)
|
||||
|
||||
get '/tags/autocomplete', params: { q: 'tail' }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.map { |row| row.fetch('name') }).to eq(
|
||||
['tail', 'nico:external_tail', 'primary_tail', 'alias_target'])
|
||||
expect(json.first.fetch('matched_alias')).to eq('tail_alias')
|
||||
expect(json.last.fetch('matched_alias')).to eq('suffix_tail')
|
||||
expect(json[1]).to include('id' => external.id, 'category' => 'nico')
|
||||
end
|
||||
|
||||
it 'fills only the remaining places with suffix matches' do
|
||||
names = 19.times.map { |number| "capacity_#{ number.to_s.rjust(2, '0') }" }
|
||||
names.each { create(:tag, primary_name: _1, post_count: 1) }
|
||||
create(:tag, primary_name: 'first_capacity', post_count: 3)
|
||||
create(:external_tag, name: 'second_capacity', post_count: 2)
|
||||
|
||||
get '/tags/autocomplete', params: { q: 'capacity' }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json.map { |row| row.fetch('name') }).to eq(names + ['first_capacity'])
|
||||
end
|
||||
|
||||
it 'excludes external tags but preserves internal alias matches when nico is false' do
|
||||
internal = create(:tag, category: :general, primary_name: 'switch_internal', post_count: 1)
|
||||
alias_target = create(:tag, category: :general, primary_name: 'alias_target', post_count: 1)
|
||||
@@ -518,12 +552,20 @@ RSpec.describe 'Tags API', type: :request do
|
||||
create(:external_tag, name: literal, post_count: 1)
|
||||
create(:tag, category: :general, primary_name: 'literalXmatch', post_count: 2)
|
||||
create(:external_tag, name: 'literalXmatch', post_count: 2)
|
||||
suffix = "suffix_literal#{ wildcard }"
|
||||
create(:tag, primary_name: suffix, post_count: 1)
|
||||
suffix_alias = create(:tag, primary_name: 'suffix_alias_target', post_count: 1)
|
||||
create(:tag_name, :alias, name: "alias_#{ suffix }", tag: suffix_alias)
|
||||
create(:external_tag, name: suffix, post_count: 1)
|
||||
create(:tag, primary_name: 'suffix_literalX', post_count: 2)
|
||||
create(:external_tag, name: 'suffix_literalX', post_count: 2)
|
||||
|
||||
get '/tags/autocomplete', params: { q: "literal#{ wildcard }" }
|
||||
|
||||
expect(json.map { |row| row.fetch('name') })
|
||||
.to contain_exactly(
|
||||
literal, primary_tag_name_for(alias_target, 'ja').name, "nico:#{ literal }")
|
||||
literal, primary_tag_name_for(alias_target, 'ja').name, "nico:#{ literal }",
|
||||
suffix, 'suffix_alias_target', "nico:#{ suffix }")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+1
-7
@@ -166,13 +166,7 @@ export const pageRoutes = (
|
||||
robots: 'noindex', authentication: 'user' } },
|
||||
{ path: ':id', element: <MaterialDetailPage/>,
|
||||
handle: { preload: MaterialDetailPage.preload, sitemap: ['materials'] } }] },
|
||||
{ path: 'wiki', element: <LocaleRedirect to="/tag-descriptions"/>,
|
||||
handle: { redirectTo: '/tag-descriptions' } },
|
||||
{ path: 'tag-descriptions',
|
||||
element: <WikiSearchPage key="tag_description" resourceType="tag_description"/>,
|
||||
handle: { preload: WikiSearchPage.preload, sitemap: ['static'] } },
|
||||
{ path: 'tag-groups',
|
||||
element: <WikiSearchPage key="tag_group" resourceType="tag_group"/>,
|
||||
{ path: 'wiki', element: <WikiSearchPage/>,
|
||||
handle: { preload: WikiSearchPage.preload, sitemap: ['static'] } },
|
||||
{ path: 'wiki/:title', element: <WikiDetailPage/>,
|
||||
handle: { preload: WikiDetailPage.preload, switchLocale: switchWikiLocale,
|
||||
|
||||
@@ -29,7 +29,7 @@ import { fetchWikiPage } from '@/lib/wiki'
|
||||
import type { FC, MouseEvent } from 'react'
|
||||
|
||||
import type { AvailableLocale, LocaleCode } from '@/lib/locales'
|
||||
import type { Material, Menu, MenuVisibleItem, Tag, User, WikiPage } from '@/types'
|
||||
import type { Material, Menu, MenuVisibleItem, Tag, User } from '@/types'
|
||||
|
||||
type Props = {
|
||||
user: User | null
|
||||
@@ -39,11 +39,10 @@ type NavDensity = 'auto' | 'comfortable' | 'compact'
|
||||
|
||||
|
||||
export const menuOutline = (
|
||||
{ tag, material, wikiId, wikiResourceType, user, pathName: fullPathname }: {
|
||||
{ tag, material, wikiId, user, pathName: fullPathname }: {
|
||||
tag?: Tag | null
|
||||
material?: Material | null
|
||||
wikiId: number | null
|
||||
wikiResourceType?: WikiPage['resourceType']
|
||||
user: User | null
|
||||
pathName: string },
|
||||
): Menu => {
|
||||
@@ -100,30 +99,17 @@ export const menuOutline = (
|
||||
visible: materialFlg && Boolean (material?.tag) },
|
||||
{ ...message ('history'), to: `/materials/changes?material_id=${ material?.id }`,
|
||||
visible: materialFlg }] },
|
||||
...([
|
||||
{ key: 'tagDescriptions', path: '/tag-descriptions', type: 'tag_description' },
|
||||
{ key: 'tagGroups', path: '/tag-groups', type: 'tag_group' }] as const)
|
||||
.map (({ key, path, type }): MenuVisibleItem => {
|
||||
const current = (wikiResourceType ?? 'tag_description') === type
|
||||
const detailFlg = wikiPageFlg && current
|
||||
const creationPath =
|
||||
type === 'tag_group'
|
||||
? `/wiki/new?title=${ encodeURIComponent ('タググループ:') }` : '/wiki/new'
|
||||
return { ...message (key), to: path,
|
||||
base: (pathName.startsWith ('/wiki') && current) ? '/wiki' : path,
|
||||
subMenu: [
|
||||
{ ...message ('search'), to: path },
|
||||
{ ...message ('create'), to: creationPath, visible: editable },
|
||||
{ ...message ('allHistory'), to: '/wiki/changes' },
|
||||
{ ...message ('help'), to: '/wiki/ヘルプ:Wiki' },
|
||||
{ component: <Separator/>, visible: detailFlg },
|
||||
{ ...message ('postsWithCount', { count: postCount }),
|
||||
to: `/posts?tags=${ wikiTitle }`, visible: detailFlg },
|
||||
{ ...message ('history'), to: `/wiki/changes?id=${ wikiId }`,
|
||||
visible: detailFlg },
|
||||
{ ...message ('edit'), to: `/wiki/${ wikiId || wikiTitle }/edit`,
|
||||
visible: detailFlg && editable }] }
|
||||
}),
|
||||
{ ...message ('wiki'), to: '/wiki', subMenu: [
|
||||
{ ...message ('search'), to: '/wiki' },
|
||||
{ ...message ('create'), to: '/wiki/new', visible: editable },
|
||||
{ ...message ('allHistory'), to: '/wiki/changes' },
|
||||
{ ...message ('help'), to: '/wiki/ヘルプ:Wiki' },
|
||||
{ component: <Separator/>, visible: wikiPageFlg },
|
||||
{ ...message ('postsWithCount', { count: postCount }), to: `/posts?tags=${ wikiTitle }`,
|
||||
visible: wikiPageFlg },
|
||||
{ ...message ('history'), to: `/wiki/changes?id=${ wikiId }`, visible: wikiPageFlg },
|
||||
{ ...message ('edit'), to: `/wiki/${ wikiId || wikiTitle }/edit`,
|
||||
visible: wikiPageFlg && editable }] },
|
||||
{ ...message ('help'), to: '/help/home', base: '/help', subMenu: [
|
||||
{ ...message ('search'), to: '/help' },
|
||||
{ ...message ('allHistory'), to: '/help/changes' },
|
||||
@@ -243,8 +229,7 @@ const TopNav: FC<Props> = ({ user, locales, resolveLocaleSwitch }) => {
|
||||
queryKey: materialsKeys.show (effectiveTitle, locale),
|
||||
queryFn: () => fetchMaterial (effectiveTitle, locale) })
|
||||
|
||||
const menu = menuOutline ({ tag, material, wikiId,
|
||||
wikiResourceType: wikiPage?.resourceType, user, pathName: location.pathname })
|
||||
const menu = menuOutline ({ tag, material, wikiId, user, pathName: location.pathname })
|
||||
const visibleMenu = menu.filter ((item): item is MenuVisibleItem => item.visible ?? true)
|
||||
const menuLabels = visibleMenu.map (item => item.name).join ('\u0000')
|
||||
const moreMenu = menu.filter (item =>
|
||||
|
||||
@@ -100,11 +100,10 @@ const prefetchHelpDiff: Prefetcher = async (qc, url, locale) => {
|
||||
|
||||
const prefetchWikiPagesIndex: Prefetcher = async (qc, url, locale) => {
|
||||
const title = url.searchParams.get ('title') ?? ''
|
||||
const resourceType = url.pathname === '/tag-groups' ? 'tag_group' : 'tag_description'
|
||||
|
||||
await qc.prefetchQuery ({
|
||||
queryKey: wikiKeys.index ({ title, resourceType }, locale),
|
||||
queryFn: () => fetchWikiPages ({ title, resourceType }, locale) })
|
||||
queryKey: wikiKeys.index ({ title }, locale),
|
||||
queryFn: () => fetchWikiPages ({ title }, locale) })
|
||||
}
|
||||
|
||||
|
||||
@@ -311,8 +310,7 @@ export const routePrefetchers: { test: (u: URL) => boolean; run: Prefetcher }[]
|
||||
&& Boolean (mPost (u.pathname))),
|
||||
run: prefetchPostShow },
|
||||
{ test: u => u.pathname === '/posts/changes', run: prefetchPostChanges },
|
||||
{ test: u => ['/wiki', '/tag-descriptions', '/tag-groups'].includes (u.pathname),
|
||||
run: prefetchWikiPagesIndex },
|
||||
{ test: u => u.pathname === '/wiki', run: prefetchWikiPagesIndex },
|
||||
{ test: u => (!(['/wiki/new', '/wiki/changes'].includes (u.pathname))
|
||||
&& Boolean (mWiki (u.pathname))),
|
||||
run: prefetchWikiPageShow },
|
||||
|
||||
@@ -5,7 +5,6 @@ import type {
|
||||
FetchPostsParams,
|
||||
FetchTagsParams,
|
||||
MaterialFilter,
|
||||
WikiPage,
|
||||
WikiTagReference } from '@/types'
|
||||
|
||||
export const localesKeys = {
|
||||
@@ -131,7 +130,7 @@ export const wikiKeys = {
|
||||
autolinkCandidates: (language: string, locale: LocaleCode) =>
|
||||
['wiki', 'autolink', locale, language] as const,
|
||||
index: (
|
||||
p: { title?: string, resourceType?: WikiPage['resourceType'] },
|
||||
p: { title?: string },
|
||||
locale: LocaleCode = 'ja',
|
||||
) => ['wiki', locale, 'index', p] as const,
|
||||
show: (
|
||||
|
||||
@@ -24,10 +24,10 @@ export const fetchWikiChanges = (
|
||||
|
||||
|
||||
export const fetchWikiPages = async (
|
||||
{ title, resourceType }: { title?: string, resourceType?: WikiPage['resourceType'] },
|
||||
{ title }: { title?: string },
|
||||
locale: LocaleCode = 'ja',
|
||||
): Promise<WikiPage[]> =>
|
||||
await apiGet ('/wiki', { locale, params: { title, resource_type: resourceType } })
|
||||
await apiGet ('/wiki', { locale, params: { title } })
|
||||
|
||||
|
||||
export const fetchWikiPage = async (
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
"materials": "チカㇻペ",
|
||||
"suppressions": "アエアイカㇷ゚テㇷ゚",
|
||||
"wiki": "Wiki",
|
||||
"tagDescriptions": "$t(counts:resources.tag_descriptions)",
|
||||
"tagGroups": "$t(counts:resources.tag_groups)",
|
||||
"create": "アシㇼ",
|
||||
"edit": "イヌイェㇷ゚",
|
||||
"entertainment": "シノッ",
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
"materials": "素材",
|
||||
"suppressions": "抑止",
|
||||
"wiki": "Wiki",
|
||||
"tagDescriptions": "$t(counts:resources.tag_descriptions)",
|
||||
"tagGroups": "$t(counts:resources.tag_groups)",
|
||||
"create": "新規",
|
||||
"edit": "編輯",
|
||||
"entertainment": "おたのしみ",
|
||||
|
||||
@@ -135,7 +135,7 @@ const MaterialDetailPage: FC = () => {
|
||||
|
||||
<TabGroup>
|
||||
{material.tag && (
|
||||
<Tab name={label ('navigation:tagDescriptions')}>
|
||||
<Tab name={label ('navigation:wiki')}>
|
||||
<WikiBody
|
||||
title={material.tag.name}
|
||||
language={localeLanguage (locale)}
|
||||
|
||||
@@ -176,7 +176,7 @@ const PostListPage: FC = () => {
|
||||
{loading && label ('common:loading')}
|
||||
</Tab>
|
||||
{tags.length === 1 && (
|
||||
<Tab name={label ('navigation:tagDescriptions')}>
|
||||
<Tab name={label ('navigation:wiki')}>
|
||||
<WikiBody title={tags[0]} body={wikiPage?.body}
|
||||
language={wikiPage?.languageCode ?? (wikiPage?.resourceType === 'tag_description'
|
||||
? localeLanguage (locale) : 'und')}/>
|
||||
|
||||
@@ -51,8 +51,7 @@ const WikiDetailPage: FC = () => {
|
||||
queryKey: helpKeys.titles ('ja'),
|
||||
queryFn: () => getHelpTitleIndex ('ja'),
|
||||
staleTime: Infinity })
|
||||
const lookupTitle = title.trim ().normalize ('NFKC').toLowerCase ()
|
||||
.replace (/^(?:ヘルプ|手引):/, '')
|
||||
const lookupTitle = title.trim ().normalize ('NFKC').toLowerCase ().replace (/^ヘルプ:/, '')
|
||||
const identifiers = useMemo (() => (
|
||||
(titleIndex != null && Object.hasOwn (titleIndex, lookupTitle))
|
||||
? titleIndex[lookupTitle] : []), [titleIndex, lookupTitle])
|
||||
|
||||
@@ -8,7 +8,7 @@ import FormField from '@/components/common/FormField'
|
||||
import PageTitle from '@/components/common/PageTitle'
|
||||
import MainArea from '@/components/layout/MainArea'
|
||||
import PageHead from '@/components/common/PageHead'
|
||||
import { fetchWikiPages } from '@/lib/wiki'
|
||||
import { apiGet } from '@/lib/api'
|
||||
import { wikiKeys } from '@/lib/queryKeys'
|
||||
import { dateString, inputClass } from '@/lib/utils'
|
||||
|
||||
@@ -17,20 +17,16 @@ import type { FormEvent , FC } from 'react'
|
||||
import type { WikiPage } from '@/types'
|
||||
|
||||
|
||||
const WikiSearchPage: FC<{ resourceType?: WikiPage['resourceType'] }> = (
|
||||
{ resourceType = 'tag_description' },
|
||||
) => {
|
||||
const WikiSearchPage: FC = () => {
|
||||
const { message, label } = useUITranslation ('shared')
|
||||
const locale = useLocale ()
|
||||
const heading =
|
||||
resourceType === 'tag_group'
|
||||
? 'navigation:tagGroups' : 'navigation:tagDescriptions'
|
||||
const [title, setTitle] = useState ('')
|
||||
const [text, setText] = useState ('')
|
||||
const [submittedTitle, setSubmittedTitle] = useState ('')
|
||||
const { data: results = [], refetch } = useQuery ({
|
||||
queryKey: wikiKeys.index ({ title: submittedTitle, resourceType }, locale),
|
||||
queryFn: () => fetchWikiPages ({ title: submittedTitle, resourceType }, locale) })
|
||||
queryKey: wikiKeys.index ({ title: submittedTitle }, locale),
|
||||
queryFn: () => apiGet<WikiPage[]> ('/wiki', {
|
||||
locale, params: { title: submittedTitle } }) })
|
||||
|
||||
const handleSearch = (ev: FormEvent) => {
|
||||
ev.preventDefault ()
|
||||
@@ -46,10 +42,10 @@ const WikiSearchPage: FC<{ resourceType?: WikiPage['resourceType'] }> = (
|
||||
|
||||
return (
|
||||
<MainArea>
|
||||
<PageHead title={message (heading)}/>
|
||||
<PageHead title={message ('navigation:wiki')}/>
|
||||
|
||||
<div className="max-w-xl">
|
||||
<PageTitle>{label (heading)}</PageTitle>
|
||||
<PageTitle>{label ('navigation:wiki')}</PageTitle>
|
||||
<form onSubmit={handleSearch} className="space-y-2">
|
||||
{/* タイトル */}
|
||||
<FormField label={label ('labels.title')}>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする