Skip to content

Commit

Permalink
Navigate to home when clicking on header (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
tschumpr authored Sep 12, 2024
2 parents 7a4956d + f3c7278 commit 4cbdf94
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- **BREAKING** Deleted _banner_ and _quickstart_ features.
- **BREAKING** Merged `application` and `vendor` properties in Client Settings:
- The application name is always _geopilot_. With `name` the application name can be extended, e.g. to _geopilot Test_.
- The url has been removed. As an alternative the link to the organisation can be added to the public files e.g. `info.md`.
- There is only one `logo` which is used for the header.
- Optionally a separate `faviconDark` can be defined for dark mode of the browser.

Expand Down
3 changes: 3 additions & 0 deletions src/Geopilot.Frontend/cypress/e2e/footer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ describe("Footer tests", () => {
});
cy.contains("project1");
cy.contains("projectA");

cy.get('[data-cy="header"]').click();
cy.get('[data-cy="upload-step"]').should("exist");
});

it("shows and navigates correctly between footer pages without content", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface ClientSettings {
authScopes: string[];
application: {
name?: string;
url: string;
logo: string;
favicon: string;
faviconDark?: string;
Expand Down
16 changes: 8 additions & 8 deletions src/Geopilot.Frontend/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ const Header: FC<HeaderProps> = ({ openSubMenu }) => {
flexDirection: "row",
justifyContent: "space-between",
}}>
<FlexRowBox sx={{ padding: "5px 0" }}>
<FlexRowBox
data-cy="header"
sx={{ padding: "5px 0", cursor: "pointer" }}
onClick={() => {
navigate("/");
}}>
<Box sx={{ display: { xs: "block", md: "none" }, flex: "0", marginRight: "10px" }}>
{hasSubMenu ? (
<IconButton
sx={{ paddingLeft: "0" }}
color="inherit"
onClick={() => {
onClick={e => {
e.stopPropagation();
openSubMenu();
}}>
<MenuIcon fontSize="large" />
Expand All @@ -78,9 +84,6 @@ const Header: FC<HeaderProps> = ({ openSubMenu }) => {
src={clientSettings?.application?.logo}
alt={`Logo of ${clientSettings?.application?.name}`}
style={{ maxHeight: "40px", cursor: "pointer" }}
onClick={() => {
window.open(clientSettings?.application?.url, "_blank");
}}
/>
</Box>
)
Expand All @@ -92,9 +95,6 @@ const Header: FC<HeaderProps> = ({ openSubMenu }) => {
src={clientSettings?.application?.logo}
alt={`Logo of ${clientSettings?.application?.name}`}
style={{ maxHeight: "40px", cursor: "pointer" }}
onClick={() => {
window.open(clientSettings?.application?.url, "_blank");
}}
/>
</Box>
)}
Expand Down
19 changes: 13 additions & 6 deletions src/Geopilot.Frontend/src/pages/admin/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ const Admin: FC<AdminProps> = ({ isSubMenuOpen, setIsSubMenuOpen }) => {
"& .MuiDrawer-paper": { width: drawerWidth, boxSizing: "border-box" },
}}>
<>
<FlexRowBox sx={{ padding: "8px 16px" }}>
<FlexRowBox
sx={{ padding: "8px 16px", cursor: "pointer" }}
onClick={() => {
navigate("/");
}}>
{clientSettings?.application?.logo && (
<Box>
<img
Expand All @@ -111,14 +115,17 @@ const Admin: FC<AdminProps> = ({ isSubMenuOpen, setIsSubMenuOpen }) => {
)}
<Box
sx={{
marginLeft: "20px",
display: "flex",
flexDirection: { xs: "column", md: "row" },
alignItems: { xs: "start", md: "center" },
flexDirection: "column",
alignItems: "start",
}}>
<Typography sx={{ typography: { xs: "h4", md: "h1" } }}>geopilot</Typography>
<Typography variant="h4" sx={{ margin: "0 !important" }}>
geopilot&nbsp;
</Typography>
{clientSettings?.application?.name && (
<Typography sx={{ typography: { xs: "h6", md: "h1" } }}>{clientSettings?.application?.name}</Typography>
<Typography variant="h6" sx={{ margin: "0 !important" }}>
{clientSettings?.application?.name}
</Typography>
)}
</Box>
</FlexRowBox>
Expand Down

0 comments on commit 4cbdf94

Please sign in to comment.