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>
<div id="Checks"><H2 text="Check-Ins"/></div>
</section>
<div id="Lab"><H2 text="Our Lab"/></div>
</section>
<div id="Biosafety"><H2 text="Biosafety"/></div>
<div id="BS1"><h3>Mechanism</h3> </div>
<div id="BS2"><h3>Delivery</h3> </div>
</section>
</div>
<div className="col">
<div id="Biosecurity"><H2 text="Biosecurity"/></div>
<div id="BSec1"><h3>Our Project</h3> </div>
<div id="BSec2"><h3>Risk Assesment</h3> </div>
<div id="BSec3"><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>