Merge branch 'feat/ui-v0.4' of git.backyard.segmentfault.com:opensource/answer into feat/ui-v0.4

This commit is contained in:
shuai 2022-11-17 14:54:03 +08:00
commit 3770bce2a7
3 changed files with 6 additions and 4 deletions

View File

@ -337,6 +337,7 @@ export interface SearchResItem {
object_type: string;
object: {
id: string;
question_id?: string;
title: string;
excerpt: string;
created_at: number;

View File

@ -14,6 +14,10 @@ const Index: FC<Props> = ({ 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 (
<ListGroupItem className="py-3 px-0">
<div className="mb-2 clearfix">
@ -23,9 +27,7 @@ const Index: FC<Props> = ({ data }) => {
style={{ marginTop: '2px' }}>
{data.object_type === 'question' ? 'Q' : 'A'}
</Badge>
<a
className="h5 mb-0 link-dark text-break"
href={`/questions/${data.object.id}`}>
<a className="h5 mb-0 link-dark text-break" href={itemUrl}>
{data.object.title}
{data.object.status === 'closed'
? ` [${t('closed', { keyPrefix: 'question' })}]`

View File

@ -85,7 +85,6 @@ export const getCurrentLang = () => {
export const setupAppLanguage = async () => {
const lang = getCurrentLang();
console.log(lang);
if (!i18next.getDataByLanguage(lang)) {
await addI18nResource(lang);
}