import { useNavigate } from 'react-router-dom'; import { ColourVariants } from '../api/actions/updateUserConfig'; import { ColourConstant } from '../configuration/colours/getColours'; import SettingsNavigation from '../components/SettingsNavigation'; import Notifications from '../components/Notifications'; import Button from '../components/Button'; import loadIsAdmin from '../functions/getIsAdmin'; import { useUserConfigStore } from '../stores/UserConfigStore'; import { useEffect, useState } from 'react'; const SettingsUser = () => { const { userConfig, setPartialConfig } = useUserConfigStore(); const isAdmin = loadIsAdmin(); const navigate = useNavigate(); const [styleSheet, setStyleSheet] = useState(userConfig.config.stylesheet); const [styleSheetRefresh, setStyleSheetRefresh] = useState(false); const [pageSize, setPageSize] = useState(userConfig.config.page_size); useEffect(() => { (async () => { setStyleSheet(userConfig.config.stylesheet); setPageSize(userConfig.config.page_size); })(); }, [userConfig.config.page_size, userConfig.config.stylesheet]); const handleStyleSheetChange = async (selectedStyleSheet: ColourVariants) => { setPartialConfig({ stylesheet: selectedStyleSheet }); setStyleSheet(selectedStyleSheet); setStyleSheetRefresh(true); }; const handlePageSizeChange = async () => { setPartialConfig({ page_size: pageSize }); }; const handlePageRefresh = () => { navigate(0); setStyleSheetRefresh(false); }; return ( <> TA | User Settings

User Configurations

Customize user Interface

Switch your color scheme

{styleSheetRefresh && }

Archive view page size

{ setPageSize(Number(event.target.value)); }} />
{userConfig.config.page_size !== pageSize && ( <> )}
{isAdmin && ( <>

User Management

Access the admin interface for basic user management functionality like adding and deleting users, changing passwords and more.

)}
); }; export default SettingsUser;