Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Added privacy policy and terms of service link in the footer #1216

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/en_US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,8 @@ ui:
build_on: >-
Powered by <1> Apache Answer </1>- the open-source software that powers Q&A
communities.<br />Made with love © {{cc}}.
privacy: Privacy Policy
terms_of_service: Terms of Service
upload_img:
name: Change
loading: loading...
Expand Down
2 changes: 1 addition & 1 deletion internal/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var migrations = []Migration{
NewMigration("v1.3.6", "add hot score to question table", addQuestionHotScore, true),
NewMigration("v1.4.0", "add badge/badge_group/badge_award table", addBadges, true),
NewMigration("v1.4.1", "add question link", addQuestionLink, true),
NewMigration("v1.4.2", "add the number of question links", addQuestionLinkedCount, false),
NewMigration("v1.4.2", "add the number of question links", addQuestionLinkedCount, true),
}

func GetMigrations() []Migration {
Expand Down
33 changes: 25 additions & 8 deletions ui/src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,51 @@

import React from 'react';
import { Container } from 'react-bootstrap';
import { Trans } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';

import dayjs from 'dayjs';

import { siteInfoStore } from '@/stores';

const Index = () => {
const Footer = () => {
const { t } = useTranslation('translation', { keyPrefix: 'footer' }); // Scoped translations for footer
const fullYear = dayjs().format('YYYY');
const siteName = siteInfoStore((state) => state.siteInfo.name);
const cc = `${fullYear} ${siteName}`;

return (
<footer className="bg-light">
<Container className="py-3">
<p className="text-center mb-0 small text-secondary">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete text-secondary in class

<Trans i18nKey="footer.build_on" values={{ cc }}>
Powered by
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a href="https://answer.apache.org" target="_blank">
<a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Use the Link component of react-router-dom to replace the a tag.
  2. Remove target and rel attributes.

className="me-2"
href="/privacy"
target="_blank"
rel="noopener noreferrer">
{t('privacy')} {/* Fetch translated Privacy Policy text */}
</a>
<a href="/tos" target="_blank" rel="noopener noreferrer">
{t('terms_of_service')}{' '}
{/* Fetch translated Terms of Service text */}
</a>
</p>
<p className="text-center mb-0 small text-secondary">
<Trans i18nKey="build_on" values={{ cc }}>
Powered by{' '}
<a
href="https://answer.apache.org"
target="_blank"
rel="noopener noreferrer">
Apache Answer
</a>
- the open-source software that powers Q&A communities.
<br />
Made with love. © 2022 Answer.
Made with love © 2022 Answer.
</Trans>
</p>
</Container>
</footer>
);
};

export default React.memo(Index);
export default React.memo(Footer);