From 8e521652294249ed55990608083cc4d52b1a6531 Mon Sep 17 00:00:00 2001 From: "haitao(lj)" Date: Tue, 29 Nov 2022 17:49:02 +0800 Subject: [PATCH 1/3] fix(footer): gitlab#1342 --- i18n/en_US.yaml | 2 +- ui/src/common/constants.ts | 1 + ui/src/components/Footer/index.tsx | 12 ++++++++++-- ui/src/components/Header/index.tsx | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index c3e3085e..98b40543 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -529,7 +529,7 @@ ui: footer: build_on: >- Built on <1> Answer - the open-source software that power Q&A - communities
Made with love © 2022 Answer + communities.
Made with love © {{cc}}. upload_img: name: Change loading: loading... diff --git a/ui/src/common/constants.ts b/ui/src/common/constants.ts index f0a282ba..4992c200 100644 --- a/ui/src/common/constants.ts +++ b/ui/src/common/constants.ts @@ -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_'; diff --git a/ui/src/components/Footer/index.tsx b/ui/src/components/Footer/index.tsx index d7664e85..65ac6f33 100644 --- a/ui/src/components/Footer/index.tsx +++ b/ui/src/components/Footer/index.tsx @@ -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 (