Skip to content

feat: Add navigation bar #2490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

StancuFlorin
Copy link

@StancuFlorin StancuFlorin commented Mar 3, 2025


Homarr

Overview

This PR adds a navigation bar feature to Homarr that displays between the board logo and search bar. It allows users to quickly navigate between boards that have been configured to appear in the navigation.

Changes

  • Added showInNavigation field to board schema in both SQLite and MySQL databases
  • Created database migrations for the new field
  • Added translations for the new field in the English translation file
  • Updated board behavior settings to include a checkbox for toggling navigation visibility
  • Created a new NavigationBar component that displays boards with navigation enabled
  • Updated the header component to include the navigation bar
  • Added Docker Compose setup for local development with SQLite and Node.js 22

Screenshots

image

image

image

Related Issues

#2120 (comment)
#1994

@StancuFlorin StancuFlorin requested a review from a team as a code owner March 3, 2025 18:32
Copy link

deepsource-io bot commented Mar 3, 2025

Here's the code health analysis summary for commits 7caad6f..de08e2b. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@StancuFlorin StancuFlorin changed the title Add navigation bar feat: Add navigation bar Mar 3, 2025
@Meierschlumpf
Copy link
Member

Hey @StancuFlorin
Thank you for your contribution. We are currently discussing in the team if we want this feature to be part of Homarr.
We'll update you if we accept it and how we would suggest to adjust it

@StancuFlorin
Copy link
Author

Hey @StancuFlorin Thank you for your contribution. We are currently discussing in the team if we want this feature to be part of Homarr. We'll update you if we accept it and how we would suggest to adjust it

Hi @Meierschlumpf - any news?

@manuel-rw
Copy link
Member

Sorry @StancuFlorin for out late reply on this... We're finishing up the discussion. You'll hear from us until Friday. Thank you for your understanding and sorry for the inconvenience

@Meierschlumpf
Copy link
Member

Okay we are still in dicussion. Our idea would be to move the search bar to the end and to use a burger icon for smaller screens. Regarding the handling of marking a board as shown in the navbar we would suggest to restrict changing of this to the users with permission admin. Also it would make sense to show the navigation items not only on the board pages and rather globally. The following mockup shows how this would look like:

image

As said we haven't finally decided yet and I'll let you know once we have.

@StancuFlorin
Copy link
Author

StancuFlorin commented Mar 28, 2025

@Meierschlumpf - I think I did the requested changes

image
image

settings page for a user that is not admin
image

mobile view
image

@Meierschlumpf
Copy link
Member

Thanks, I'll take a look in one of the coming days

const pathname = usePathname();

// Filter boards that should be shown in navigation
const navigationBoards = boards.filter((board) => board.showInNavigation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a new route that returns only those from the navigation bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I would suggest, that we fetch this data on the server and pass it down to this component, then it does not need to make a roundtrip. THen we define it as initialData so we still can invalidate the values when adding one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need mobile support (Burger Icon or similar)

<Group h="100%" align="center" justify="end" style={{ flex: 1 }} wrap="nowrap">
<DesktopSearchInput />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal was to still have the search input at the same position when no navigation items are selected

Comment on lines +23 to +45
return (
<Group gap="xs" wrap="nowrap" style={{ overflow: 'auto', maxWidth: '100%' }}>
{navigationBoards.map((board) => {
const boardUrl = `/boards/${board.name}`;
const isActive = pathname === boardUrl;

return (
<NavLink
key={board.id}
component={Link}
href={boardUrl}
label={board.name}
active={isActive}
variant="subtle"
style={{
borderRadius: 5,
padding: '0 10px',
}}
/>
);
})}
</Group>
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently don't handle the overflow of them, so if you add to many links or you shrink your screen it looks not good

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also invalidate the query when updating the behaviour (onSettled of the savePartialSettings

@Meierschlumpf
Copy link
Member

Also I would suggest, that we make the search bar no longer static in it's width and rather let it shrink if necessary to about 100px

@StancuFlorin
Copy link
Author

Hi @Meierschlumpf - I am not using Homarr anymore, and at the moment, I’m lacking the motivation to implement the requested changes. If anyone else finds this feature useful, feel free to take over the PR.

@Meierschlumpf
Copy link
Member

Hey @StancuFlorin
Thanks for letting us know, I'll take care of the pr in the upcoming weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants