mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-03-27 21:31:49 +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 = {
|
type SettingsProps = {
|
||||||
|
initialPage?: SettingsPages;
|
||||||
requestClose: () => void;
|
requestClose: () => void;
|
||||||
};
|
};
|
||||||
export function Settings({ requestClose }: SettingsProps) {
|
export function Settings({ initialPage, requestClose }: SettingsProps) {
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
const useAuthentication = useMediaAuthentication();
|
const useAuthentication = useMediaAuthentication();
|
||||||
const userId = mx.getUserId()!;
|
const userId = mx.getUserId()!;
|
||||||
|
@ -90,9 +91,10 @@ export function Settings({ requestClose }: SettingsProps) {
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const screenSize = useScreenSizeContext();
|
const screenSize = useScreenSizeContext();
|
||||||
const [activePage, setActivePage] = useState<SettingsPages | undefined>(
|
const [activePage, setActivePage] = useState<SettingsPages | undefined>(() => {
|
||||||
screenSize === ScreenSize.Mobile ? undefined : SettingsPages.GeneralPage
|
if (initialPage) return initialPage;
|
||||||
);
|
return screenSize === ScreenSize.Mobile ? undefined : SettingsPages.GeneralPage;
|
||||||
|
});
|
||||||
const menuItems = useSettingsMenuItems();
|
const menuItems = useSettingsMenuItems();
|
||||||
|
|
||||||
const handlePageRequestClose = () => {
|
const handlePageRequestClose = () => {
|
||||||
|
|
Loading…
Reference in a new issue