Add db_path to settings page

This commit is contained in:
2023-05-28 15:34:27 +08:00
parent 993de92e34
commit 5d2d911d1a
5 changed files with 25 additions and 8 deletions

View File

@@ -97,8 +97,10 @@ export default class SettingsText<T extends keyof TextType>
render() { render() {
this.ref = useRef<TextField>(); this.ref = useRef<TextField>();
const id = `s-${this.props.name}`; const id = `s-${this.props.name}`;
let cn = "text";
if (this.props.helpertext) cn += " helper";
return ( return (
<div class="text" id={id}> <div class={cn} id={id}>
<label>{this.props.description}</label> <label>{this.props.description}</label>
<TextField <TextField
fullwidth={this.props.fullwidth} fullwidth={this.props.fullwidth}

View File

@@ -171,6 +171,13 @@ export default class Settings extends Component<SettingsProps> {
type="number" type="number"
min={1} min={1}
/> />
<SettingsText
name="db_path"
value={settings.db_path || ""}
type="text"
description={t("settings.db_path")}
helpertext={t("settings.db_path_help")}
/>
</SettingsContext> </SettingsContext>
<Button onClick={loadData}>{t("common.reload")}</Button> <Button onClick={loadData}>{t("common.reload")}</Button>
<Button onClick={showDlg} disabled={disabled}> <Button onClick={showDlg} disabled={disabled}>

View File

@@ -14,14 +14,10 @@
} }
.main { .main {
position: fixed; position: relative;
top: 64px; top: 64px;
} }
.settings {
width: 100vw;
}
.settings div.text { .settings div.text {
width: 100%; width: 100%;
} }
@@ -39,3 +35,11 @@
.settings #s-cookies .mdc-text-field { .settings #s-cookies .mdc-text-field {
min-width: 50%; min-width: 50%;
} }
.settings div.text.helper {
display: flex;
}
.settings div.text.helper label {
margin-top: 14px;
}

View File

@@ -15,5 +15,7 @@
"max_task_count": "Maximum number of parallel tasks: ", "max_task_count": "Maximum number of parallel tasks: ",
"max_retry_count": "Maximum retry count: ", "max_retry_count": "Maximum retry count: ",
"max_download_img_count": "Maximum number of parallel downloads of images: ", "max_download_img_count": "Maximum number of parallel downloads of images: ",
"save_dlg": "Do you want to save settings?" "save_dlg": "Do you want to save settings?",
"db_path": "The folder where the database is stored: ",
"db_path_help": "If not set, the download location is used."
} }

View File

@@ -15,5 +15,7 @@
"max_task_count": "最大并行任务数:", "max_task_count": "最大并行任务数:",
"max_retry_count": "最大重试次数:", "max_retry_count": "最大重试次数:",
"max_download_img_count": "最大图片并行下载数:", "max_download_img_count": "最大图片并行下载数:",
"save_dlg": "是否保存设置?" "save_dlg": "是否保存设置?",
"db_path": "存放数据库的文件夹位置:",
"db_path_help": "如果未设置,将使用下载位置。"
} }