fix: Adding logical control to the `signup` button on the home page

This commit is contained in:
haitaoo 2023-04-19 18:46:26 +08:00
parent 24afb5e21b
commit 726fab77ac
1 changed files with 14 additions and 7 deletions

View File

@ -10,7 +10,11 @@ import {
HotQuestions,
CustomSidebar,
} from '@/components';
import { siteInfoStore, loggedUserInfoStore } from '@/stores';
import {
siteInfoStore,
loggedUserInfoStore,
loginSettingStore,
} from '@/stores';
import { useQuestionList } from '@/services';
import * as Type from '@/common/interface';
import { userCenter, floppyNavigation } from '@/utils';
@ -36,6 +40,7 @@ const Questions: FC = () => {
pageTitle = `${siteInfo.name}`;
slogan = `${siteInfo.short_description}`;
}
const { login: loginSetting } = loginSettingStore();
usePageTags({ title: pageTitle, subtitle: slogan });
return (
@ -65,12 +70,14 @@ const Questions: FC = () => {
onClick={floppyNavigation.handleRouteLinkClick}>
{t('login', { keyPrefix: 'btns' })}
</Link>
<Link
to={userCenter.getSignUpUrl()}
className="btn btn-link ms-2"
onClick={floppyNavigation.handleRouteLinkClick}>
{t('signup', { keyPrefix: 'btns' })}
</Link>
{loginSetting.allow_new_registrations ? (
<Link
to={userCenter.getSignUpUrl()}
className="btn btn-link ms-2"
onClick={floppyNavigation.handleRouteLinkClick}>
{t('signup', { keyPrefix: 'btns' })}
</Link>
) : null}
</div>
</div>
)}