Skip to content

Commit

Permalink
Migrate frontend to MUI.
Browse files Browse the repository at this point in the history
- Settings
- Menubar

Partially addresses #9796.
  • Loading branch information
fniessink committed Sep 30, 2024
1 parent 14a220c commit 392eac5
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 292 deletions.
196 changes: 109 additions & 87 deletions components/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^6.1.1",
"@mui/lab": "^6.0.0-beta.10",
"@mui/material": "^6.1.1",
"crypto-js": "^4.2.0",
"fomantic-ui-css": "^2.9.3",
Expand All @@ -15,7 +16,6 @@
"react": "^18.3.1",
"react-datepicker": "^7.4.0",
"react-dom": "^18.3.1",
"react-focus-lock": "^2.13.0",
"react-grid-layout": "^1.4.4",
"react-hash-link": "1.0.2",
"react-is": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion components/frontend/src/AppUI.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ async function renderAppUI() {
it("resets all settings", async () => {
history.push("?date_interval=2")
await act(async () => await renderAppUI())
fireEvent.click(screen.getByLabelText("Reset reports overview settings"))
fireEvent.click(screen.getByText("Reset settings"))
expect(history.location.search).toBe("")
})
35 changes: 14 additions & 21 deletions components/frontend/src/header_footer/CollapseButton.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
import { Button, Icon } from "semantic-ui-react"
import UnfoldLessIcon from "@mui/icons-material/UnfoldLess"
import { Button, Tooltip } from "@mui/material"

import { Popup } from "../semantic_ui_react_wrappers"
import { stringsURLSearchQueryPropType } from "../sharedPropTypes"

export function CollapseButton({ expandedItems }) {
const label = "Collapse all headers and metrics"
return (
<Popup
on={["hover", "focus"]}
trigger={
<span // We need a span here to prevent the popup from becoming disabled whenever the button is disabled
<Tooltip title={"Collapse all headers and metrics"}>
<span>
<Button
color="inherit"
disabled={expandedItems.equals([])}
onClick={() => expandedItems.reset()}
startIcon={<UnfoldLessIcon />}
variant="outlined"
>
<Button
aria-label={label}
basic
disabled={expandedItems.equals([])}
icon
onClick={() => expandedItems.reset()}
inverted
>
<Icon name="angle double up" /> Collapse all
</Button>
</span>
}
content={label}
/>
Collapse all
</Button>
</span>
</Tooltip>
)
}
CollapseButton.propTypes = {
Expand Down
4 changes: 2 additions & 2 deletions components/frontend/src/header_footer/CollapseButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ it("resets the expanded items", () => {
const expandedItems = renderHook(() => useExpandedItemsSearchQuery())
expect(expandedItems.result.current.value).toStrictEqual(["tab"])
renderCollapseButton({ expandedItems: expandedItems.result.current })
fireEvent.click(screen.getByRole("button", { name: "Collapse all headers and metrics" }))
fireEvent.click(screen.getByRole("button", { name: "Collapse all" }))
expandedItems.rerender()
expect(expandedItems.result.current.value).toStrictEqual([])
})
Expand All @@ -28,7 +28,7 @@ it("doesn't change the expanded items if there are none", () => {
const expandedItems = renderHook(() => useExpandedItemsSearchQuery())
expect(expandedItems.result.current.value).toStrictEqual([])
renderCollapseButton({ expandedItems: expandedItems.result.current })
fireEvent.click(screen.getByRole("button", { name: "Collapse all headers and metrics" }))
fireEvent.click(screen.getByRole("button", { name: "Collapse all" }))
expandedItems.rerender()
expect(expandedItems.result.current.value).toStrictEqual([])
})
Loading

0 comments on commit 392eac5

Please sign in to comment.