diff --git a/components/dashboard/UserMenu.tsx b/components/dashboard/UserMenu.tsx index 64616f20..1c27c58b 100644 --- a/components/dashboard/UserMenu.tsx +++ b/components/dashboard/UserMenu.tsx @@ -334,7 +334,7 @@ export default function UserMenu({ {tNav('settings')} - + {tNav('members_roles')} diff --git a/components/settings/sections/CompanySettingsContent.tsx b/components/settings/sections/CompanySettingsContent.tsx index 3924ea7b..40f9afd8 100644 --- a/components/settings/sections/CompanySettingsContent.tsx +++ b/components/settings/sections/CompanySettingsContent.tsx @@ -1,5 +1,6 @@ 'use client' +import { useCallback } from 'react' import { useRouter } from 'next/navigation' import { useTranslations } from 'next-intl' import { CompanyDangerZone } from '@/components/settings/CompanyDangerZone' @@ -22,6 +23,17 @@ export function CompanySettingsContent() { const tIntro = useTranslations('settings_intro') const { settings, isLoading, updateSettings, refetch } = useSettings() + // Deep-link target for "Medlemmar och roller" (/settings/company#members): + // a ref callback rather than an effect because this content mounts late + // (settings fetch + dynamic import); the callback fires exactly when the + // section exists. The hash is cleared after scrolling so switching tabs + // and returning to Företag doesn't scroll again. + const scrollToMembers = useCallback((node: HTMLDivElement | null) => { + if (!node || window.location.hash !== '#members') return + node.scrollIntoView({ block: 'start' }) + history.replaceState(null, '', window.location.pathname + window.location.search) + }, []) + if (isLoading) return if (!settings) return @@ -77,7 +89,9 @@ export function CompanySettingsContent() { onUpdate={(url) => updateSettings({ logo_url: url })} /> - +
+ +