From a23425f4f6705dcc1608e181db0efcc25a69bfa8 Mon Sep 17 00:00:00 2001 From: tiddlygit-test Date: Mon, 20 Sep 2021 22:50:18 +0800 Subject: [PATCH] refactor: move some create field into advanced, so new user friendly --- localization/locales/en/translation.json | 3 +- localization/locales/zh_CN/translation.json | 3 +- src/pages/AddWorkspace/CloneWikiForm.tsx | 12 ------ src/pages/AddWorkspace/Description.tsx | 5 +-- src/pages/AddWorkspace/ExistedWikiForm.tsx | 12 ------ src/pages/AddWorkspace/FormComponents.tsx | 1 + src/pages/AddWorkspace/NewWikiForm.tsx | 12 ------ src/pages/AddWorkspace/index.tsx | 47 +++++++++++++++------ 8 files changed, 41 insertions(+), 54 deletions(-) diff --git a/localization/locales/en/translation.json b/localization/locales/en/translation.json index 8ec59f59..d69cac83 100644 --- a/localization/locales/en/translation.json +++ b/localization/locales/en/translation.json @@ -113,7 +113,8 @@ "AddWorkspace": "Add Workspace", "WorkspaceUserName": "Workspace User Name", "WorkspaceUserNameDetail": "The editor name used in the Wiki will be fill in the creator field when the Tiddler is created or edited. The editor name set in the workspace will override the global default editor name assigned in the preferences. This allows you to create Tiddlers with different identities in the same Wiki, with multiple workspace configed with different user name.", - "WikiNotStarted": "Wiki is not started or not loaded" + "WikiNotStarted": "Wiki is not started or not loaded", + "Advanced": "Advanced Settings" }, "EditWorkspace": { "Path": "Wiki Path", diff --git a/localization/locales/zh_CN/translation.json b/localization/locales/zh_CN/translation.json index 148233ac..77f0c952 100644 --- a/localization/locales/zh_CN/translation.json +++ b/localization/locales/zh_CN/translation.json @@ -144,7 +144,8 @@ "TagName": "标签名", "TagNameHelp": "加上此标签的笔记将会自动被放入这个子知识库内(可先不填,之后右键点击这个工作区的图标选择编辑工作区修改)", "NoGitInfoAlert": "你未选择在线Git仓库地址,或未成功登录在线Git存储服务账号(可能被墙)。点击创建按钮将创建一个不会自动同步到Github的本地仓库,请注意。", - "WikiNotStarted": "Wiki 页面未成功启动或未成功加载" + "WikiNotStarted": "Wiki 页面未成功启动或未成功加载", + "Advanced": "高级设置" }, "EditWorkspace": { "Path": "Wiki的位置", diff --git a/src/pages/AddWorkspace/CloneWikiForm.tsx b/src/pages/AddWorkspace/CloneWikiForm.tsx index c57a7a11..d76ef108 100644 --- a/src/pages/AddWorkspace/CloneWikiForm.tsx +++ b/src/pages/AddWorkspace/CloneWikiForm.tsx @@ -62,18 +62,6 @@ export function CloneWikiForm({ value={form.wikiFolderName} /> - {isCreateMainWorkspace && ( - - { - form.wikiPortSetter(Number(event.target.value)); - }} - label={t('AddWorkspace.WikiServerPort')} - value={form.wikiPort} - /> - - )} {!isCreateMainWorkspace && ( <> - {isCreateMainWorkspace && ( - - { - wikiPortSetter(Number(event.target.value)); - }} - label={t('AddWorkspace.WikiServerPort')} - value={wikiPort} - /> - - )} {!isCreateMainWorkspace && ( <> - {isCreateMainWorkspace && ( - - { - form.wikiPortSetter(Number(event.target.value)); - }} - label={t('AddWorkspace.WikiServerPort')} - value={form.wikiPort} - /> - - )} {!isCreateMainWorkspace && ( <> ({}); // update storageProviderSetter to local based on isCreateSyncedWorkspace. Other services value will be changed by TokenForm - const { storageProvider, storageProviderSetter, wikiFolderName } = form; + const { storageProvider, storageProviderSetter, wikiFolderName, wikiPort } = form; useEffect(() => { if (!isCreateSyncedWorkspace && storageProvider !== SupportedStorageServices.local) { storageProviderSetter(SupportedStorageServices.local); @@ -88,14 +93,33 @@ export default function AddWorkspace(): JSX.Element { variant="scrollable" value={currentTab} aria-label={t('AddWorkspace.SwitchCreateNewOrOpenExisted')}> - + - + + }>{t('AddWorkspace.Advanced')} + + + + {isCreateMainWorkspace && ( + + { + form.wikiPortSetter(Number(event.target.value)); + }} + label={t('AddWorkspace.WikiServerPort')} + value={wikiPort} + /> + + )} + + + {isCreateSyncedWorkspace && ( @@ -103,19 +127,18 @@ export default function AddWorkspace(): JSX.Element { )} {storageProvider !== SupportedStorageServices.local && } - - - - - - - + + + + + +