diff --git a/src/contents/Bfh.tsx b/src/contents/Bfh.tsx index bb8ff4562acc5adbc6ef3ef4c0f16a4ea9f2e067..a99f0529374c1e0c4985b282be9b14db9a505de9 100644 --- a/src/contents/Bfh.tsx +++ b/src/contents/Bfh.tsx @@ -41,33 +41,33 @@ let tabbys = [ ] export function Bfh() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="" /* style={{ paddingTop: "5vw"}} */> diff --git a/src/contents/Home.tsx b/src/contents/Home.tsx index db3d50f1dc0a898c46c1a6e5bb13826a471a14da..5abc4d5768f3746fbecf77b9475ffbf129c927c7 100644 --- a/src/contents/Home.tsx +++ b/src/contents/Home.tsx @@ -4,33 +4,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Home() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/collaborations.tsx b/src/contents/collaborations.tsx index 4f0e2aaf4fd88a32c80e498a15e8932b3ea2ed24..cde7c71adadd40c1d2d8ed1a39b01f4acf38a21e 100644 --- a/src/contents/collaborations.tsx +++ b/src/contents/collaborations.tsx @@ -4,33 +4,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Collaborations() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/contribution.tsx b/src/contents/contribution.tsx index 530e90e899cf8a29749c1f8b8ae041236373bc22..ccdb11e1793a841b28f2a861cdfa28f7acd1aff7 100644 --- a/src/contents/contribution.tsx +++ b/src/contents/contribution.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Contribution() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/description.tsx b/src/contents/description.tsx index 1f298eeb811629f8ff389fe0b27d136cd1773951..8ca219d1d196265d5494b461d7723a404af84feb 100644 --- a/src/contents/description.tsx +++ b/src/contents/description.tsx @@ -15,33 +15,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Description() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); + useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <div className="row mt-4"> <div className="col"> diff --git a/src/contents/design.tsx b/src/contents/design.tsx index 6e4c3607673c3e7474a83421b73851b500335d92..f3bdf4faffee58620ef76a5a5b4d2a31c8153120 100644 --- a/src/contents/design.tsx +++ b/src/contents/design.tsx @@ -4,33 +4,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Design() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/drylab.tsx b/src/contents/drylab.tsx index 2a4a431084cac7d0196866cd0b9c50219f02e692..d4a212701887f5bec76d32785eaa08f87436b423 100644 --- a/src/contents/drylab.tsx +++ b/src/contents/drylab.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Drylab() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/education.tsx b/src/contents/education.tsx index a0ee81f2e73d0ddd7d7058cc4a083cf5de1b14e2..8d40105e768980930d0d0899b8001ebced96807d 100644 --- a/src/contents/education.tsx +++ b/src/contents/education.tsx @@ -7,33 +7,32 @@ import { openFromOtherPage } from "../components/Buttons"; export function Education() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); + useEffect(() => { + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); - useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div> diff --git a/src/contents/engineering.tsx b/src/contents/engineering.tsx index 9a0b127657c52db01d1164cbb9b8cb29407710ab..6d109446321585371b2aad4441e8c39bdbb8eb58 100644 --- a/src/contents/engineering.tsx +++ b/src/contents/engineering.tsx @@ -7,33 +7,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Engineering() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/ethics.tsx b/src/contents/ethics.tsx index cadb0b50631e6df26176487fc92271016008c150..7eb8b28d70fc498a09f36b9f3b3c9d6e7daedd4b 100644 --- a/src/contents/ethics.tsx +++ b/src/contents/ethics.tsx @@ -4,33 +4,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Ethics() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/experiments.tsx b/src/contents/experiments.tsx index 3c28d4f171db5aa8d2b8b238bb557e120ad395a5..b9ee8698bf28a35c0124f03ab7993bac2096d9b1 100644 --- a/src/contents/experiments.tsx +++ b/src/contents/experiments.tsx @@ -4,33 +4,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Experiments() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/human-practices.tsx b/src/contents/human-practices.tsx index 9b28b4a6bf454089ed1b6336a39e1345d5120a9c..ec3ae8dcdccadee73de4a9122a8336e2e3c3adad 100644 --- a/src/contents/human-practices.tsx +++ b/src/contents/human-practices.tsx @@ -716,33 +716,33 @@ let timelinepersontabs =[ export function HumanPractices() { openTab({cityName: "All", cla: "timelinecardtabs"}); const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <div className="row mt-4"> diff --git a/src/contents/impressum.tsx b/src/contents/impressum.tsx index 3db4618f1efb1ebcdf7f220726ce27d83cf76774..cad9229a7751cf4597321e4c097666e92828b914 100644 --- a/src/contents/impressum.tsx +++ b/src/contents/impressum.tsx @@ -4,33 +4,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Impressum() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/interviews.tsx b/src/contents/interviews.tsx index 416cd9f5b5c9d105df86b6fd122117ddb72ab64a..bd29e2c381aad2a9b870e620fa44dcc1861fa0d4 100644 --- a/src/contents/interviews.tsx +++ b/src/contents/interviews.tsx @@ -5,33 +5,32 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Ints() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); + useEffect(() => { + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); - useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <br/> diff --git a/src/contents/judging.tsx b/src/contents/judging.tsx index 0007ca251324c97a39d1ef1d8b1982ebcd79dd96..f76b5675ca6ac68f5fe6aeae55a1ccb2c87cab2f 100644 --- a/src/contents/judging.tsx +++ b/src/contents/judging.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Judging() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/measurement.tsx b/src/contents/measurement.tsx index 82700df223fda6563c4d1ae78cdc58179aaf37b6..96ce8c7641ac3c0efcb2735882a1f0e04137b97a 100644 --- a/src/contents/measurement.tsx +++ b/src/contents/measurement.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Measurement() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/notebook.tsx b/src/contents/notebook.tsx index ebddc5b681690436f38cbb529b148ae1f0e01150..2bd71816a7c463e019f04a0b4d8ae9190680132e 100644 --- a/src/contents/notebook.tsx +++ b/src/contents/notebook.tsx @@ -4,33 +4,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Notebook() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/partners.tsx b/src/contents/partners.tsx index 2c9b56a358ac2811de93ccb11899f22ecdb569c8..5c5655015afe968a7585e2543f547b4782ff8784 100644 --- a/src/contents/partners.tsx +++ b/src/contents/partners.tsx @@ -4,33 +4,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Partners() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div id="sidebarbox" className="col-1 d-none d-lg-block"> </div> diff --git a/src/contents/parts.tsx b/src/contents/parts.tsx index 7db443794a64888515c333b434f295431a4d63f0..ad144cd24c585d31e98be11892db4ac6b24e6259 100644 --- a/src/contents/parts.tsx +++ b/src/contents/parts.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Parts() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/proof.tsx b/src/contents/proof.tsx index 2f6b4ddb920d9cacdee1ddcd177baffcfc5aed0f..bf36aaab8815ea78651a8f860ee25177065e4474 100644 --- a/src/contents/proof.tsx +++ b/src/contents/proof.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Proof() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <section id="prelim-2000"> diff --git a/src/contents/results.tsx b/src/contents/results.tsx index 97a9d7ac898faee00802b2f750af372de29cc374..2a731c53f5d354683322d75e543f2cca8b62d809 100644 --- a/src/contents/results.tsx +++ b/src/contents/results.tsx @@ -4,16 +4,18 @@ import { openFromOtherPage } from "../components/Buttons"; export function Results() { const location = useLocation(); + useEffect(() => { - // Scroll to the section specified by the collapseId in the URL const params = new URLSearchParams(location.search); const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + // Scroll to the section specified by collapseId if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; const scrollPosition = elementTop - offset; window.scrollTo({ @@ -22,16 +24,14 @@ export function Results() { }); } } - }, [location.search]); - useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + // Open the tab specified by tabId if (tabId) { openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); } }, [location.search]); + return ( <> <div className="row mt-4"> diff --git a/src/contents/safety.tsx b/src/contents/safety.tsx index 43322cfee51040d257079f929873ff1064241115..9564c503d0efc91386f3a4314af3e07a7e1cfa74 100644 --- a/src/contents/safety.tsx +++ b/src/contents/safety.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Safety() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); + useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/supplementary-material.tsx b/src/contents/supplementary-material.tsx index cc461197d25147a289d2a29a6431a408b6c572cb..be01e0b939451102d9578b780261e18cb732b7dd 100644 --- a/src/contents/supplementary-material.tsx +++ b/src/contents/supplementary-material.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Supplementary() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row"> diff --git a/src/contents/survey.tsx b/src/contents/survey.tsx index 315775e2db65d7f6ba3592323950ae9272d96e80..8169e7ed928b0b8a33223e1fc665e2f329108b29 100644 --- a/src/contents/survey.tsx +++ b/src/contents/survey.tsx @@ -3,33 +3,33 @@ import { useLocation } from "react-router-dom"; import { openFromOtherPage } from "../components/Buttons"; export function Survey() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row mt-4"> diff --git a/src/contents/team.tsx b/src/contents/team.tsx index c9281eede9a055fd25fe7ca70700588b17c18d1e..1e2f2674b144bc4137e2f35f042d2c9d93339f0b 100644 --- a/src/contents/team.tsx +++ b/src/contents/team.tsx @@ -4,33 +4,33 @@ import { openFromOtherPage } from "../components/Buttons"; export function Team() { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> diff --git a/src/contents/wiki.tsx b/src/contents/wiki.tsx index 3eea3be9b7f7a47f2223e73fa447dae9d367ab29..79312d8fb39adae3910b612bbfb1886e70dc7fc3 100644 --- a/src/contents/wiki.tsx +++ b/src/contents/wiki.tsx @@ -7,33 +7,33 @@ import { openFromOtherPage } from "../components/Buttons"; import React from "react"; export function Wiki () { const location = useLocation(); - useEffect(() => { - // Scroll to the section specified by the collapseId in the URL - const params = new URLSearchParams(location.search); - const collapseId = params.get('collapseId'); - if (collapseId) { - const element = document.getElementById(collapseId); - if (element) { - const elementTop = element.getBoundingClientRect().top + window.pageYOffset; - const offset = window.innerHeight / 2 - element.offsetHeight / 2; - const scrollPosition = elementTop - offset; - - window.scrollTo({ - top: scrollPosition, - behavior: 'smooth', - }); - } - } - }, [location.search]); useEffect(() => { - const params = new URLSearchParams(location.search); - const tabId = params.get('tab'); + const params = new URLSearchParams(location.search); + const collapseId = params.get('collapseId'); + const tabId = params.get('tab'); + + // Scroll to the section specified by collapseId + if (collapseId) { + const collapseElement = document.getElementById(collapseId); + if (collapseElement) { + const elementTop = collapseElement.getBoundingClientRect().top + window.pageYOffset; + const offset = window.innerHeight / 2 - collapseElement.offsetHeight / 2; + const scrollPosition = elementTop - offset; + + window.scrollTo({ + top: scrollPosition, + behavior: 'smooth', + }); + } + } + + // Open the tab specified by tabId + if (tabId) { + openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); + } + }, [location.search]); - if (tabId) { - openFromOtherPage(tabId)({ currentTarget: document.getElementById(tabId)! }); - } - }, [location.search]); return ( <> <div className="row">