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: footer:
build_on: >- build_on: >-
Built on <1> Answer </1>- the open-source software that power Q&A 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: upload_img:
name: Change name: Change
loading: loading... loading: loading...

View File

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

View File

@ -20,6 +20,7 @@ import {
import { loggedUserInfoStore, siteInfoStore, brandingStore } from '@/stores'; import { loggedUserInfoStore, siteInfoStore, brandingStore } from '@/stores';
import { logout, useQueryNotificationStatus } from '@/services'; import { logout, useQueryNotificationStatus } from '@/services';
import { RouteAlias } from '@/router/alias'; import { RouteAlias } from '@/router/alias';
import { DEFAULT_SITE_NAME } from '@/common/constants';
import NavItems from './components/NavItems'; 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> </Navbar.Brand>