[CAL-462] Team settings dropdown menu should be open when you navigate from Teams (#5868)

Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: niteshsingh1357 <niteshsingh1357@gmail.com>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>
Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Rafael <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com>

Co-authored-by: gitstart <gitstart@users.noreply.github.com>
Co-authored-by: Nitesh Singh <nitesh.singh@gitstart.dev>
Co-authored-by: niteshsingh1357 <niteshsingh1357@gmail.com>
Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com>
Co-authored-by: Rafael <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: gitstart <gitstart@gitstart.com>
Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com>
Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com>
This commit is contained in:
GitStart
2022-12-07 21:35:41 +00:00
committed by GitHub
co-authored by Nitesh Singh niteshsingh1357 Rafael Toledo gitstart Rafael gitstart Matheus Benini Ferreira gitstart-app[bot] gitstart_bot Thiago Nascimbeni Matheus Muniz
parent 5d775bd4a3
commit 21dd1f4e95
+12 -2
View File
@@ -102,6 +102,7 @@ const useTabs = () => {
const SettingsSidebarContainer = ({ className = "" }) => {
const { t } = useLocale();
const router = useRouter();
const tabsWithPermissions = useTabs();
const [teamMenuState, setTeamMenuState] =
useState<{ teamId: number | undefined; teamMenuOpen: boolean }[]>();
@@ -110,10 +111,19 @@ const SettingsSidebarContainer = ({ className = "" }) => {
useEffect(() => {
if (teams) {
const teamStates = teams?.map((team) => ({ teamId: team.id, teamMenuOpen: false }));
const teamStates = teams?.map((team) => ({
teamId: team.id,
teamMenuOpen: String(team.id) === router.query.id,
}));
setTeamMenuState(teamStates);
setTimeout(() => {
const tabMembers = Array.from(document.getElementsByTagName("a")).filter(
(bottom) => bottom.dataset.testid === "vertical-tab-Members"
)[1];
tabMembers?.scrollIntoView({ behavior: "smooth" });
}, 100);
}
}, [teams]);
}, [router.query.id, teams]);
return (
<nav