diff --git a/ui/src/common/interface.ts b/ui/src/common/interface.ts index 9e933fc1..4ff68ed2 100644 --- a/ui/src/common/interface.ts +++ b/ui/src/common/interface.ts @@ -337,6 +337,7 @@ export interface SearchResItem { object_type: string; object: { id: string; + question_id?: string; title: string; excerpt: string; created_at: number; diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsx index 8b9d8e6e..ad08aa5e 100644 --- a/ui/src/pages/Search/components/SearchItem/index.tsx +++ b/ui/src/pages/Search/components/SearchItem/index.tsx @@ -14,6 +14,10 @@ const Index: FC = ({ data }) => { if (!data?.object_type) { return null; } + let itemUrl = `/questions/${data.object.id}`; + if (data.object_type === 'answer') { + itemUrl = `/questions/${data.object.question_id}/${data.object.id}`; + } return (
@@ -23,9 +27,7 @@ const Index: FC = ({ data }) => { style={{ marginTop: '2px' }}> {data.object_type === 'question' ? 'Q' : 'A'} - + {data.object.title} {data.object.status === 'closed' ? ` [${t('closed', { keyPrefix: 'question' })}]` diff --git a/ui/src/utils/localize.ts b/ui/src/utils/localize.ts index 37b0919b..5071ee9d 100644 --- a/ui/src/utils/localize.ts +++ b/ui/src/utils/localize.ts @@ -85,7 +85,6 @@ export const getCurrentLang = () => { export const setupAppLanguage = async () => { const lang = getCurrentLang(); - console.log(lang); if (!i18next.getDataByLanguage(lang)) { await addI18nResource(lang); }