1
0
mirror of https://github.com/ragestudio/comty.git synced 2025-07-11 02:04:15 +00:00

improve key selection

This commit is contained in:
SrGooglo 2024-09-15 03:34:54 +00:00
parent 4fcadcd241
commit 4d91eccab2

@ -168,8 +168,10 @@ export default class Sidebar extends React.Component {
} }
calculateSelectedMenuItem = (path) => { calculateSelectedMenuItem = (path) => {
const items = [...this.state.topItems, ...this.state.bottomItems]
this.setState({ this.setState({
selectedMenuItem: [...this.state.topItems, ...this.state.bottomItems].find((item) => item.path === path) selectedMenuItem: items.find((item) => String(item.path).includes(path)),
}) })
} }
@ -352,7 +354,7 @@ export default class Sidebar extends React.Component {
} }
render() { render() {
const selectedKeyId = this.state.selectedMenuItem?.id ?? "home" const selectedKeyId = this.state.selectedMenuItem?.id
return <div return <div
className="app_sidebar_wrapper" className="app_sidebar_wrapper"