Skip to content

Commit

Permalink
fix: default selected key initiate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MXerFix committed Jul 28, 2024
1 parent a53acf2 commit 151b8e7
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions frontend/src/components/footbar/FootBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ const FootBar = () => {
const [searchParams, setSearchParams] = useSearchParams()

const onSelectionChange = (key: Key) => {
setSearchParams({
...parseSearchParams(searchParams),
logs_page: "closed",
settings: "closed",
})
setSettingsPage(false)
setLogsPage(false)
if (key === "Inspect") {
setLogsPage(true)
setSearchParams({
Expand All @@ -44,6 +37,24 @@ const FootBar = () => {
logs_page: "closed",
settings: "opened",
})
} else {
setSearchParams({
...parseSearchParams(searchParams),
logs_page: "closed",
settings: "closed",
})
setSettingsPage(false)
setLogsPage(false)
}
}

const findDefaultSelectedKey = () => {
if (settingsPage) {
return "Settings"
} else if (logsPage) {
return "Inspect"
} else {
return "Edit"
}
}

Expand All @@ -54,6 +65,7 @@ const FootBar = () => {
<div className='absolute w-full h-12 flex items-center justify-center'>
<Tabs
onSelectionChange={onSelectionChange}
defaultSelectedKey={findDefaultSelectedKey()}
variant='light'
className=''
classNames={{
Expand Down

0 comments on commit 151b8e7

Please sign in to comment.