mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-31 09:49:10 +01:00
add initial page param in settings
This commit is contained in:
parent
97ec9965ca
commit
233ec012a0
1 changed files with 6 additions and 4 deletions
|
@ -77,9 +77,10 @@ const useSettingsMenuItems = (): SettingsMenuItem[] =>
|
|||
);
|
||||
|
||||
type SettingsProps = {
|
||||
initialPage?: SettingsPages;
|
||||
requestClose: () => void;
|
||||
};
|
||||
export function Settings({ requestClose }: SettingsProps) {
|
||||
export function Settings({ initialPage, requestClose }: SettingsProps) {
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const userId = mx.getUserId()!;
|
||||
|
@ -90,9 +91,10 @@ export function Settings({ requestClose }: SettingsProps) {
|
|||
: undefined;
|
||||
|
||||
const screenSize = useScreenSizeContext();
|
||||
const [activePage, setActivePage] = useState<SettingsPages | undefined>(
|
||||
screenSize === ScreenSize.Mobile ? undefined : SettingsPages.GeneralPage
|
||||
);
|
||||
const [activePage, setActivePage] = useState<SettingsPages | undefined>(() => {
|
||||
if (initialPage) return initialPage;
|
||||
return screenSize === ScreenSize.Mobile ? undefined : SettingsPages.GeneralPage;
|
||||
});
|
||||
const menuItems = useSettingsMenuItems();
|
||||
|
||||
const handlePageRequestClose = () => {
|
||||
|
|
Loading…
Reference in a new issue