Newer
Older
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
import { openFromOtherPage } from "../utils/openFromOtherpAge";
Liliana Sanfilippo
committed
import { openNestedTab, openTab, handleScrollToCollapse } from "../utils/TabNavigation";
Liliana Sanfilippo
committed
const location = useLocation();
useEffect(() => {
Liliana Sanfilippo
committed
const params = new URLSearchParams(location.search);
const collapseId = params.get('collapseId');
const tabId = params.get('tab');
const subTabId = params.get('subTab'); // Neues Parameter für verschachtelte Tabs
// Open the tab specified by tabId (and subTab if nested)
if (tabId) {
if (subTabId) {
// If subTab is provided, open the nested tab
openNestedTab(tabId, subTabId);
} else {
// Otherwise, just open the main tab
openTab(tabId);
Liliana Sanfilippo
committed
}
// Scroll to the section specified by collapseId after opening the tab
if (collapseId) {
handleScrollToCollapse(collapseId);
}
// Open the tab from another page
if (tabId) {
openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! });
}
Liliana Sanfilippo
committed
<div id="Role"><H2 text="Role in iGem"/></div>
</section>
</div>
<section id="Biosafety1">
<div id="Biosafety1H"><h3>Mechanism</h3> </div>
</section>
<section id="Biosafety2">
<div id="Biosafety2H"><h3>Delivery</h3> </div>
</section>
<section id="Biosecurity1">
<div id="Biosecurity1H"><h3>Our Project</h3> </div>
</section>
<section id="Biosecurity2">
<div id="Biosecurity2H"><h3>Risk Assesment</h3> </div>
</section>
<section id="Biosecurity3">
<div id="Biosecurity3H"><h3>Managing Risks</h3> </div>
</section>
<div id="Bioethics"><H2 text="Bioethics"/></div>
<div id="BE1"><h3>Gene Therapy</h3> </div>
<div id="BE2"><h3>Primary cells</h3> </div>
<div id="BE3"><h3>Consent and Guidelines</h3> </div>
</section>