feat: beautify server options

This commit is contained in:
linonetwo 2023-10-16 21:00:45 +08:00
parent 41bd361bba
commit c2009fef01
4 changed files with 33 additions and 24 deletions

View file

@ -205,7 +205,8 @@
"TokenAuthCurrentToken": "Current Token of Token Auth",
"TokenAuthCurrentTokenDescription": "This token is confidential, which needs to be regenerated after being leaked to a hostile entity, and credentials need to be updated for connected third-party applications after regeneration",
"Generate": "Generate",
"TokenAuthCurrentTokenEmptyText": "Click the Generate button to generate a new credential"
"TokenAuthCurrentTokenEmptyText": "Click the Generate button to generate a new credential",
"ClickToExpand": "Click To Expand"
},
"Dialog": {
"CantFindWorkspaceFolderRemoveWorkspace": "Cannot find the workspace folder that was still there before! \nThe folders that should have existed here may have been removed, or there is no wiki in this folder! \nDo you want to remove the workspace?",

View file

@ -239,7 +239,8 @@
"TokenAuthCurrentToken": "当前可用的鉴权凭证",
"TokenAuthCurrentTokenEmptyText": "点击生成按钮来生成新的凭证",
"TokenAuthCurrentTokenDescription": "机密信息,泄露给敌意实体后需要重新生成,重新生成后需要为连接的第三方应用更新凭证",
"Generate": "生成"
"Generate": "生成",
"ClickToExpand": "点击展开"
},
"Scripting": {
"ExecutingScript": "正在执行脚本"

View file

@ -31,7 +31,7 @@ const Root = styled(Paper)`
width: 100%;
padding: 20px;
/** for SaveCancelButtonsContainer 's height */
margin-bottom: 20px;
margin-bottom: 40px;
display: flex;
flex-direction: column;
background: ${({ theme }) => theme.palette.background.paper};
@ -256,26 +256,6 @@ export default function EditWorkspace(): JSX.Element {
value={userName}
/>
<Divider />
{!isSubWiki && (
<>
{rememberLastPageVisited && (
<TextField
id='outlined-full-width'
label={t('EditWorkspace.LastVisitState')}
helperText={t('Preference.RememberLastVisitState')}
placeholder={homeUrl}
value={lastUrl}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
workspaceSetter({
...workspace,
lastUrl: (event.target.value || homeUrl) ?? '',
});
}}
/>
)}
<ServerOptions workspace={workspace} workspaceSetter={workspaceSetter} />
</>
)}
{isSubWiki && (
<Autocomplete
freeSolo
@ -409,6 +389,28 @@ export default function EditWorkspace(): JSX.Element {
</ListItem>
</List>
)}
{!isSubWiki && rememberLastPageVisited && (
<TextField
id='outlined-full-width'
label={t('EditWorkspace.LastVisitState')}
helperText={t('Preference.RememberLastVisitState')}
placeholder={homeUrl}
value={lastUrl}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
workspaceSetter({
...workspace,
lastUrl: (event.target.value || homeUrl) ?? '',
});
}}
/>
)}
{!isSubWiki && (
<>
<Divider />
<ServerOptions workspace={workspace} workspaceSetter={workspaceSetter} />
<Divider />
</>
)}
</FlexGrow>
{!isEqual(workspace, originalWorkspace) && (
<SaveCancelButtonsContainer>

View file

@ -15,6 +15,7 @@ import {
ListItemSecondaryAction,
Switch,
TextField,
Tooltip,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
@ -76,7 +77,11 @@ export function ServerOptions(props: IServerOptionsProps) {
const alreadyEnableSomeServerOptions = readOnlyMode;
return (
<AServerOptionsAccordion defaultExpanded={alreadyEnableSomeServerOptions}>
<AServerOptionsAccordionSummary expandIcon={<ExpandMoreIcon />}>{t('EditWorkspace.ServerOptions')}</AServerOptionsAccordionSummary>
<Tooltip title={t('EditWorkspace.ClickToExpand')}>
<AServerOptionsAccordionSummary expandIcon={<ExpandMoreIcon />}>
{t('EditWorkspace.ServerOptions')}
</AServerOptionsAccordionSummary>
</Tooltip>
<AccordionDetails>
<List>
<ListItem disableGutters>