Skip to content

Commit

Permalink
fix: Fix showing selected navigation item in UI sidebar (#4969)
Browse files Browse the repository at this point in the history
  • Loading branch information
peruukki authored Jan 26, 2025
1 parent dc2c1dc commit 8ac6a85
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions ui/src/pages/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,58 +55,60 @@ const SideNav = () => {
: ""
}`;

const baseUrl = `${process.env.PUBLIC_URL || ""}/p/${projectName}`;

const sideNav = [
{
name: "Home",
id: htmlIdGenerator("basicExample")(),
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/`);
navigate(`${baseUrl}/`);
},
items: [
{
name: dataSourcesLabel,
id: htmlIdGenerator("dataSources")(),
icon: <EuiIcon type={DataSourceIcon} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source`);
navigate(`${baseUrl}/data-source`);
},
isSelected: useMatchSubpath("data-source"),
isSelected: useMatchSubpath(`${baseUrl}/data-source`),
},
{
name: entitiesLabel,
id: htmlIdGenerator("entities")(),
icon: <EuiIcon type={EntityIcon} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity`);
navigate(`${baseUrl}/entity`);
},
isSelected: useMatchSubpath("entity"),
isSelected: useMatchSubpath(`${baseUrl}/entity`),
},
{
name: featureViewsLabel,
id: htmlIdGenerator("featureView")(),
icon: <EuiIcon type={FeatureViewIcon} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view`);
navigate(`${baseUrl}/feature-view`);
},
isSelected: useMatchSubpath("feature-view"),
isSelected: useMatchSubpath(`${baseUrl}/feature-view`),
},
{
name: featureServicesLabel,
id: htmlIdGenerator("featureService")(),
icon: <EuiIcon type={FeatureServiceIcon} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service`);
navigate(`${baseUrl}/feature-service`);
},
isSelected: useMatchSubpath("feature-service"),
isSelected: useMatchSubpath(`${baseUrl}/feature-service`),
},
{
name: savedDatasetsLabel,
id: htmlIdGenerator("savedDatasets")(),
icon: <EuiIcon type={DatasetIcon} />,
onClick: () => {
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-set`);
navigate(`${baseUrl}/data-set`);
},
isSelected: useMatchSubpath("data-set"),
isSelected: useMatchSubpath(`${baseUrl}/data-set`),
},
],
},
Expand Down

0 comments on commit 8ac6a85

Please sign in to comment.