diff --git a/src/components/mods/Geolosys.jsx b/src/components/mods/Geolosys.jsx index c68b047..6320cbf 100644 --- a/src/components/mods/Geolosys.jsx +++ b/src/components/mods/Geolosys.jsx @@ -1,12 +1,26 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { CSSTransition } from 'react-transition-group'; import About from './GeolosysComponents/About'; +import Datapacks from './GeolosysComponents/Datapacks'; import Config from './GeolosysComponents/Config'; import CT from './GeolosysComponents/CraftTweaker'; -import OreGen from './GeolosysComponents/OreGeneration'; + +const extractComponentName = () => { + const url = window.location.href; + if (url.includes('#')) { + return url.split('#')[1]; + } + + return 'about'; +}; export default () => { - const [component, setComponent] = useState('about'); + const [component, setComponent] = useState(extractComponentName()); + + useEffect(() => { + setComponent(extractComponentName()); + return () => { }; + }, []); return ( @@ -37,13 +51,13 @@ export default () => { {component === 'about' && ()} - {component === 'oreGen' && ()} + {component === 'datapacks' && ()} {component === 'config' && ()} {component === 'ct' && ()}