feat(right-manage): use last url segment to get right panel

This commit is contained in:
RadoslavDimchev 2024-03-23 16:50:53 +02:00 committed by Emil Ivanichkov
parent b5078be986
commit 0a0d83a989
1 changed files with 15 additions and 12 deletions

View File

@ -4,19 +4,22 @@ import ExitPanel from './Panels/ExitPanel'
import MigratePanel from './Panels/MigratePanel'
const RightManage = () => {
const isDefault = false
const isMigrate = false
const isDeposit = false
const isExit = true
const lastUrlSegment = window.location.pathname.split('/').pop()
return (
<div style={{ flexGrow: 1 }}>
{isDefault && <DefaultPanel />}
{isMigrate && <MigratePanel />}
{isDeposit && <DepositPanel />}
{isExit && <ExitPanel />}
</div>
)
const getPanel = () => {
switch (lastUrlSegment) {
case 'migrate':
return <MigratePanel />
case 'deposit':
return <DepositPanel />
case 'exit':
return <ExitPanel />
default:
return <DefaultPanel />
}
}
return <div style={{ flexGrow: 1 }}>{getPanel()}</div>
}
export default RightManage