-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: add dropdown for layout thoroughness selection #620
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,14 +28,15 @@ import { | |||||
ListItem, | ||||||
ListItemIcon, | ||||||
ListItemText, | ||||||
MenuItem, | ||||||
Select, | ||||||
ToggleButton, | ||||||
Tooltip, | ||||||
Typography, | ||||||
} from "@mui/material"; | ||||||
import { toPng } from "html-to-image"; | ||||||
import { getRectOfNodes, getTransformForBounds } from "reactflow"; | ||||||
|
||||||
import { NumberInput } from "@/web/common/components/NumberInput/NumberInput"; | ||||||
import { getDisplayNodes } from "@/web/topic/components/Diagram/externalFlowStore"; | ||||||
import { downloadTopic, uploadTopic } from "@/web/topic/loadStores"; | ||||||
import { useOnPlayground } from "@/web/topic/store/topicHooks"; | ||||||
|
@@ -342,35 +343,37 @@ export const MoreActionsDrawer = ({ | |||||
</ToggleButton> | ||||||
</ListItem> | ||||||
|
||||||
<ListItem disablePadding={false}> | ||||||
<ListItem disablePadding> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
<Typography variant="body2">Layout Thoroughness</Typography> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned here https://github.com/amelioro/ameliorate/pull/620/files#r1894997107, since we're using
Suggested change
|
||||||
<Tooltip | ||||||
title="Determines how much effort the layout algorithm puts into laying out nodes such that they efficiently use space. 1 = lowest effort, 100 = highest effort." | ||||||
enterTouchDelay={0} // allow touch to immediately trigger | ||||||
leaveTouchDelay={Infinity} // touch-away to close on mobile, since message is long | ||||||
title="Determines how much effort the layout algorithm puts into laying out nodes such that they efficiently use space. Low = minimal effort, High = maximum effort." | ||||||
enterTouchDelay={0} // Trigger immediately on touch | ||||||
leaveTouchDelay={Infinity} // Close on touch-away | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep "since message is long" in the comment here - it explains why we're using touch-away to close, rather than the default timeout for Mui Tooltips |
||||||
> | ||||||
<IconButton | ||||||
color="info" | ||||||
aria-label="Thoroughness info" | ||||||
sx={{ | ||||||
// Don't make it look like clicking will do something, since it won't. | ||||||
// Using a button here is an attempt to make it accessible, since the tooltip will show | ||||||
// on focus. | ||||||
cursor: "default", | ||||||
cursor: "default", // Maintain accessibility while preventing click actions | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment makes it seem like setting Side note: looking at this code again, it seems like we could just add a tabIndex to allow focus on the icon directly, instead of adding a button for that. I'm not sure why I didn't do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep the previous explanation here, it's still relevant |
||||||
alignSelf: "center", | ||||||
}} | ||||||
> | ||||||
<Info /> | ||||||
</IconButton> | ||||||
</Tooltip> | ||||||
<NumberInput | ||||||
min={1} | ||||||
max={100} | ||||||
<Select | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like with the watch dropdown, I would have used Mui's I think using |
||||||
value={layoutThoroughness} | ||||||
onChange={(_event, value) => { | ||||||
if (value) setLayoutThoroughness(value); | ||||||
onChange={(event) => setLayoutThoroughness(Number(event.target.value))} | ||||||
fullWidth // Use fullWidth for proper alignment | ||||||
size="small" // Smaller size for better fit | ||||||
sx={{ | ||||||
marginLeft: "16px", // Adjust spacing | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The dropdown is visually separated from the info icon already, so this |
||||||
}} | ||||||
/> | ||||||
> | ||||||
<MenuItem value={1}>Low</MenuItem> | ||||||
<MenuItem value={10}>Medium</MenuItem> | ||||||
<MenuItem value={100}>High</MenuItem> | ||||||
</Select> | ||||||
</ListItem> | ||||||
|
||||||
<Divider>Filter Config</Divider> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the changes in this file should be undone, unless you have particular reason for them.
The comment about type-safing still seems relevant to convey that the only reason it's not type-safe is because we didn't take the time for it.
The error is being thrown to be explicit that we've chosen not to handle a
null
value
.