Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(Questions): Add welcome card for page questions

haitao(lj)b05db2a05401
diff --git a/ui/src/pages/Questions/index.tsx b/ui/src/pages/Questions/index.tsx
index 6320ca05..db0c7d69 100644
--- a/ui/src/pages/Questions/index.tsx
+++ b/ui/src/pages/Questions/index.tsx
@@ -1,17 +1,17 @@
import { FC } from 'react';
import { Container, Row, Col } from 'react-bootstrap';
-import { useMatch } from 'react-router-dom';
+import { useMatch, Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { usePageTags } from '@/hooks';
import { FollowingTags } from '@/components';
import QuestionList from '@/components/QuestionList';
import HotQuestions from '@/components/HotQuestions';
-import { siteInfoStore } from '@/stores';
+import { siteInfoStore, loggedUserInfoStore } from '@/stores';
const Questions: FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'question' });
-
+ const { user: loggedUser } = loggedUserInfoStore((_) => _);
const isIndexPage = useMatch('/');
let pageTitle = t('questions', { keyPrefix: 'page_title' });
let slogan = '';
@@ -29,6 +29,25 @@ const Questions: FC = () => {
<QuestionList source="questions" />
</Col>
<Col xxl={3} lg={4} sm={12} className="mt-5 mt-lg-0">
+ {!loggedUser.access_token && (
+ <div className="card mb-4">
+ <div className="card-body">
+ <h5 className="card-title">
+ {t('page_title', {
+ keyPrefix: 'login',
+ site_name: siteInfo.name,
+ })}
+ </h5>
+ <p className="card-text">{siteInfo.description}</p>
+ <Link to="/users/login" className="card-link btn btn-primary">
+ {t('login', { keyPrefix: 'btns' })}
+ </Link>
+ <Link to="/users/register" className="card-link">
+ {t('signup', { keyPrefix: 'btns' })}
+ </Link>
+ </div>
+ </div>
+ )}
<FollowingTags />
<HotQuestions />
</Col>