fix(footer): gitlab#1342

This commit is contained in:
haitao(lj) 2022-11-29 17:49:02 +08:00
parent 065b6ce87f
commit 8e52165229
4 changed files with 14 additions and 4 deletions

View File

@ -529,7 +529,7 @@ ui:
footer:
build_on: >-
Built on <1> Answer </1>- the open-source software that power Q&A
communities<br />Made with love © 2022 Answer
communities.<br />Made with love © {{cc}}.
upload_img:
name: Change
loading: loading...

View File

@ -1,3 +1,4 @@
export const DEFAULT_SITE_NAME = 'Answer';
export const DEFAULT_LANG = 'en_US';
export const CURRENT_LANG_STORAGE_KEY = '_a_lang_';
export const LANG_RESOURCE_STORAGE_KEY = '_a_lang_r_';

View File

@ -2,12 +2,20 @@ import React from 'react';
import { Container } from 'react-bootstrap';
import { Trans } from 'react-i18next';
import dayjs from 'dayjs';
import { siteInfoStore } from '@/stores';
import { DEFAULT_SITE_NAME } from '@/common/constants';
const Index = () => {
const fullYear = dayjs().format('YYYY');
const siteName = siteInfoStore.getState().siteInfo.name || DEFAULT_SITE_NAME;
const cc = `${fullYear} ${siteName}`;
return (
<footer className="bg-light py-3">
<Container>
<p className="text-center mb-0 fs-14 text-secondary">
<Trans i18nKey="footer.build_on">
<Trans i18nKey="footer.build_on" values={{ cc }}>
Built on
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a href="https://answer.dev/" target="_blank">
@ -15,7 +23,7 @@ const Index = () => {
</a>
- the open-source software that powers Q&A communities.
<br />
Made with love. © 2022 Answer .
Made with love. © 2022 Answer.
</Trans>
</p>
</Container>

View File

@ -20,6 +20,7 @@ import {
import { loggedUserInfoStore, siteInfoStore, brandingStore } from '@/stores';
import { logout, useQueryNotificationStatus } from '@/services';
import { RouteAlias } from '@/router/alias';
import { DEFAULT_SITE_NAME } from '@/common/constants';
import NavItems from './components/NavItems';
@ -88,7 +89,7 @@ const Header: FC = () => {
/>
</>
) : (
<span>{siteInfo.name || 'Answer'}</span>
<span>{siteInfo.name || DEFAULT_SITE_NAME}</span>
)}
</Navbar.Brand>