fix: return board header to current dashboard (#7059)
Related to #7056. Keep the current board destination when returning from dashboard settings.
This commit is contained in:
1 parent
8c977dfd1f
commit
d1c88b6821
1 file changed
+6
-1
@@ -1,6 +1,7 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { UnstyledButton } from "@mantine/core";
|
||||
|
||||
import { useOptionalBoard } from "@homarr/boards/context";
|
||||
import { Link } from "@homarr/ui";
|
||||
|
||||
import classes from "./header-logo.module.css";
|
||||
@@ -13,11 +14,15 @@ interface HeaderLogoProps {
|
||||
}
|
||||
|
||||
export const HeaderLogo = ({ display, logo, logoWithTitle, label }: HeaderLogoProps) => {
|
||||
const board = useOptionalBoard();
|
||||
let href = "/";
|
||||
if (board) href = `/boards/${encodeURIComponent(board.name)}`;
|
||||
|
||||
let content = logo;
|
||||
if (display === "logoAndText") content = logoWithTitle;
|
||||
|
||||
return (
|
||||
<UnstyledButton component={Link} href="/" className={classes.root} data-display={display} aria-label={label}>
|
||||
<UnstyledButton component={Link} href={href} className={classes.root} data-display={display} aria-label={label}>
|
||||
{content}
|
||||
</UnstyledButton>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user