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/Admin/Dashboard/components/HealthStatus/index.tsx b/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx index fd511ca1..2193df17 100644 --- a/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx +++ b/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx @@ -22,17 +22,36 @@ const HealthStatus: FC = ({ data }) => { {t('version')} {version} {isLatest && ( - + {t('latest')} )} {!isLatest && remote_version && ( - + {t('update_to')} {remote_version} )} {!isLatest && !remote_version && ( - + {t('check_failed')} )} diff --git a/ui/src/pages/Search/components/Head/index.tsx b/ui/src/pages/Search/components/Head/index.tsx index 45906e05..260ecc65 100644 --- a/ui/src/pages/Search/components/Head/index.tsx +++ b/ui/src/pages/Search/components/Head/index.tsx @@ -36,7 +36,7 @@ const Index: FC = ({ data }) => {

{t('title')}

- {t('keywords')} + {t('keywords')} {q?.replace(reg, '')}
{options?.length && ( 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/pages/Users/ActiveEmail/index.tsx b/ui/src/pages/Users/ActiveEmail/index.tsx index 177395d7..77a5afdf 100644 --- a/ui/src/pages/Users/ActiveEmail/index.tsx +++ b/ui/src/pages/Users/ActiveEmail/index.tsx @@ -1,6 +1,6 @@ import { FC, memo, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams, useNavigate } from 'react-router-dom'; import { loggedUserInfoStore } from '@/stores'; import { activateAccount } from '@/services'; @@ -10,6 +10,7 @@ const Index: FC = () => { const { t } = useTranslation('translation', { keyPrefix: 'page_title' }); const [searchParams] = useSearchParams(); const updateUser = loggedUserInfoStore((state) => state.update); + const navigate = useNavigate(); useEffect(() => { const code = searchParams.get('code'); @@ -17,9 +18,11 @@ const Index: FC = () => { activateAccount(encodeURIComponent(code)).then((res) => { updateUser(res); setTimeout(() => { - window.location.replace('/users/account-activation/success'); + navigate('/users/account-activation/success', { replace: true }); }, 0); }); + } else { + navigate('/', { replace: true }); } }, []); return ; diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index 7336b995..be7e61ac 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -167,13 +167,13 @@ const routes: RouteNode[] = [ { path: 'users/account-activation', page: 'pages/Users/ActiveEmail', - guard: async () => { - const notActivated = guard.notActivated(); - if (notActivated.ok) { - return notActivated; - } - return guard.notLogged(); - }, + // guard: async () => { + // const notActivated = guard.notActivated(); + // if (notActivated.ok) { + // return notActivated; + // } + // return guard.notLogged(); + // }, }, { path: 'users/account-activation/success', 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); } diff --git a/ui/src/utils/request.ts b/ui/src/utils/request.ts index 7d880bbf..aac4c149 100644 --- a/ui/src/utils/request.ts +++ b/ui/src/utils/request.ts @@ -103,6 +103,7 @@ class Request { return Promise.reject(false); } if (status === 403) { + debugger; // Permission interception if (data?.type === 'url_expired') { // url expired