mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 02:19:23 +00:00
add show helptext user config value
This commit is contained in:
@@ -27,6 +27,7 @@ export type UserConfigType = {
|
||||
hide_watched: boolean;
|
||||
show_ignored_only: boolean;
|
||||
show_subed_only: boolean;
|
||||
show_help_text: boolean;
|
||||
};
|
||||
|
||||
const updateUserConfig = async (config: Partial<UserConfigType>): Promise<UserConfigType> => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import Button from '../components/Button';
|
||||
import useIsAdmin from '../functions/useIsAdmin';
|
||||
import { useUserConfigStore } from '../stores/UserConfigStore';
|
||||
import { useEffect, useState } from 'react';
|
||||
import ToggleConfig from '../components/ToggleConfig';
|
||||
|
||||
const SettingsUser = () => {
|
||||
const { userConfig, setPartialConfig } = useUserConfigStore();
|
||||
@@ -16,13 +17,15 @@ const SettingsUser = () => {
|
||||
const [styleSheet, setStyleSheet] = useState<ColourVariants>(userConfig.config.stylesheet);
|
||||
const [styleSheetRefresh, setStyleSheetRefresh] = useState(false);
|
||||
const [pageSize, setPageSize] = useState<number>(userConfig.config.page_size);
|
||||
const [showHelpText, setShowHelpText] = useState(userConfig.config.show_help_text);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setStyleSheet(userConfig.config.stylesheet);
|
||||
setPageSize(userConfig.config.page_size);
|
||||
setShowHelpText(userConfig.config.show_help_text);
|
||||
})();
|
||||
}, [userConfig.config.page_size, userConfig.config.stylesheet]);
|
||||
}, [userConfig.config.page_size, userConfig.config.stylesheet, userConfig.config.show_help_text]);
|
||||
|
||||
const handleStyleSheetChange = async (selectedStyleSheet: ColourVariants) => {
|
||||
setPartialConfig({ stylesheet: selectedStyleSheet });
|
||||
@@ -34,6 +37,10 @@ const SettingsUser = () => {
|
||||
setPartialConfig({ page_size: pageSize });
|
||||
};
|
||||
|
||||
const handleShowHelpTextChange = async (configKey: string, configValue: boolean) => {
|
||||
setPartialConfig({ [configKey]: configValue });
|
||||
};
|
||||
|
||||
const handlePageRefresh = () => {
|
||||
navigate(0);
|
||||
setStyleSheetRefresh(false);
|
||||
@@ -103,6 +110,16 @@ const SettingsUser = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-box-wrapper">
|
||||
<div>
|
||||
<p>Show help text</p>
|
||||
</div>
|
||||
<ToggleConfig
|
||||
name="show_help_text"
|
||||
value={showHelpText}
|
||||
updateCallback={handleShowHelpTextChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isAdmin && (
|
||||
|
||||
@@ -29,6 +29,7 @@ export const useUserConfigStore = create<UserConfigState>(set => ({
|
||||
hide_watched: false,
|
||||
show_ignored_only: false,
|
||||
show_subed_only: false,
|
||||
show_help_text: true,
|
||||
},
|
||||
},
|
||||
setUserConfig: userConfig => set({ userConfig }),
|
||||
|
||||
Reference in New Issue
Block a user