import { useAppDispatch, useAppSelector } from '~/hooks';
import { commitStagingChange, discardStagingChanges } from './settingsSlice';
import { selectIsSettingsNotSaved } from './settingsSelector';
import { NavLink, Outlet } from 'react-router';
import { SETTINGS_TABS } from '~/features/settings/settingsTabs.tsx';
import { MdOutlineSettingsBackupRestore } from 'react-icons/md';
import { toast } from 'react-toastify';
export function Settings() {
const dispatch = useAppDispatch();
const handleResetSettings = () => {
dispatch(discardStagingChanges());
toast.info(() => (
));
};
const handleApplySettings = () => {
dispatch(commitStagingChange());
toast.success('设定已应用');
};
const isSettingsNotSaved = useAppSelector(selectIsSettingsNotSaved);
return (
{Object.entries(SETTINGS_TABS).map(([id, { name }]) => (
{name}
))}
{/* TODO: ensure this flex div does not overflow */}
{/*
*/}
{/* */}
{/* */}
{/* {isSettingsNotSaved ? (*/}
{/* */}
{/* 有未储存的更改{' '}*/}
{/* */}
{/* 设定将在保存后生效*/}
{/* */}
{/* */}
{/* ) : (*/}
{/* 设定将在保存后生效*/}
{/* )}*/}
{/* */}
{/* */}
{/* */}
{/* }*/}
{/* onClick={handleResetSettings}*/}
{/* colorScheme="red"*/}
{/* variant="ghost"*/}
{/* title="放弃未储存的更改,将设定还原未储存前的状态。"*/}
{/* aria-label="放弃未储存的更改"*/}
{/* />*/}
{/* */}
{/* */}
{/* */}
{/* */}
{/* */}
{/* ))}*/}
{/* */}
{/**/}
);
}