Merge pull request #370 from answerdev/feat/1.1.0/ui

Feat/1.1.0/UI
This commit is contained in:
haitao.jarvis 2023-05-24 17:48:09 +08:00 committed by GitHub
commit 363d7c714d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 10 deletions

View File

@ -19,7 +19,7 @@ import {
import classnames from 'classnames';
import { userCenter } from '@/utils';
import { userCenter, floppyNavigation } from '@/utils';
import {
loggedUserInfoStore,
siteInfoStore,
@ -152,6 +152,7 @@ const Header: FC = () => {
'link-light': navbarStyle === 'theme-colored',
'link-primary': navbarStyle !== 'theme-colored',
})}
onClick={() => floppyNavigation.storageLoginRedirect()}
href={userCenter.getLoginUrl()}>
{t('btns.login')}
</Button>
@ -224,6 +225,7 @@ const Header: FC = () => {
'link-light': navbarStyle === 'theme-colored',
'link-primary': navbarStyle !== 'theme-colored',
})}
onClick={() => floppyNavigation.storageLoginRedirect()}
href={userCenter.getLoginUrl()}>
{t('btns.login')}
</Button>

View File

@ -74,17 +74,19 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
const showAddButton = editing && (!users || users.length < MAX_ASK_NUMBER);
const showInviteDesc = !editing && users?.length === 0;
const showEditButton = !readOnly && !editing && users?.length;
const showSaveButton = !readOnly && editing;
return (
<Card className="mt-4">
<Card.Header className="text-nowrap d-flex justify-content-between text-capitalize">
{t('title')}
{!readOnly && editing ? (
{showSaveButton ? (
<Button onClick={saveInviteUsers} variant="link" className="p-0">
{t('save', { keyPrefix: 'btns' })}
</Button>
) : null}
{!readOnly && !editing ? (
{showEditButton ? (
<Button
onClick={() => setEditing(true)}
variant="link"
@ -137,13 +139,16 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
</div>
{showInviteDesc ? (
<>
<div className="text-muted mb-3">{t('desc')}</div>
<Button
size="sm"
variant="outline-primary"
onClick={() => setEditing(true)}>
{t('invite')}
</Button>
<div className="text-muted">{t('desc')}</div>
{readOnly ? null : (
<Button
size="sm"
variant="outline-primary"
className="mt-3"
onClick={() => setEditing(true)}>
{t('invite')}
</Button>
)}
</>
) : null}
</Card.Body>

View File

@ -136,4 +136,5 @@ export const floppyNavigation = {
isRoutableLink,
handleRouteLinkClick,
equalToCurrentHref,
storageLoginRedirect,
};