mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-06 06:28:27 +00:00
fix(settings): default to first rendered tab when Account disabled
This commit is contained in:
@@ -267,8 +267,12 @@ export default function UserSettingsDialog(props: IProps): JSX.Element {
|
||||
return tabs as NonEmptyArray<Tab<UserTab>>;
|
||||
};
|
||||
|
||||
const defaultTab = moduleSettingsTabs.length > 0 ? (moduleSettingsTabs[0].key as UserTab) : UserTab.Account;
|
||||
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(getTabs(), defaultTab, props.initialTabId);
|
||||
const tabs = getTabs();
|
||||
// Prefer the first module-registered tab (e.g. HealthChat "Profil"); otherwise fall back to the first
|
||||
// tab that actually renders. The Account tab is disabled for HealthChat, so it cannot be the default —
|
||||
// using it would leave no tab active and a blank panel when no module tab is present.
|
||||
const defaultTab = moduleSettingsTabs.length > 0 ? (moduleSettingsTabs[0].key as UserTab) : tabs[0].id;
|
||||
const [activeTabId, _setActiveTabId] = useActiveTabWithDefault(tabs, defaultTab, props.initialTabId);
|
||||
const setActiveTabId = (tabId: UserTab): void => {
|
||||
_setActiveTabId(tabId);
|
||||
// Clear these so switching away from the tab and back to it will not show the QR code again
|
||||
|
||||
Reference in New Issue
Block a user