Skip to content
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

Codebase: Refactor from VisibilityPanel to ViewOptionsPanel #437

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type State = {
isOpen: boolean;
};

class RobotConfigPanel extends Component<Props, State> {
class ViewOptionsPanel extends Component<Props, State> {
static contextType = DocumentManagerContext;
declare context: React.ContextType<typeof DocumentManagerContext>;
state = {
Expand Down Expand Up @@ -54,7 +54,7 @@ class RobotConfigPanel extends Component<Props, State> {
const uiState = this.context.model.uiState;

return (
<div className={styles.VisibilityPanel}>
<div className={styles.ViewOptionsPanel}>
<Tooltip disableInteractive title="Zoom to fit trajectory">
{/* If there's no waypoints, then don't allow user to zoom to fit Waypoints */}
<IconButton
Expand Down Expand Up @@ -111,12 +111,12 @@ class RobotConfigPanel extends Component<Props, State> {
</div>
<IconButton
onClick={() => {
uiState.setVisibilityPanelOpen(!uiState.visibilityPanelOpen);
uiState.setViewOptionsPanelOpen(!uiState.isViewOptionsPanelOpen);
}}
>
{uiState.visibilityPanelOpen ? <Close /> : <Visibility />}
{uiState.isViewOptionsPanelOpen ? <Close /> : <Visibility />}
</IconButton>
{uiState.visibilityPanelOpen && (
{uiState.isViewOptionsPanelOpen && (
<div
style={{
display: "flex",
Expand Down Expand Up @@ -162,4 +162,4 @@ class RobotConfigPanel extends Component<Props, State> {
);
}
}
export default observer(RobotConfigPanel);
export default observer(ViewOptionsPanel);
2 changes: 1 addition & 1 deletion src/components/config/WaypointConfigPanel.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
justify-content: flex-start;
border-radius: 0 0 10px 0;
}
.VisibilityPanel {
.ViewOptionsPanel {
overflow-x: hidden;
position: absolute;
top: 0;
Expand Down
6 changes: 3 additions & 3 deletions src/components/field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ShapeLineIcon from "@mui/icons-material/ShapeLine";
import { CircularProgress, Tooltip } from "@mui/material";
import Box from "@mui/material/Box/Box";
import { IHolonomicWaypointStore } from "../../document/HolonomicWaypointStore";
import VisibilityPanel from "../config/VisibilityPanel";
import ViewOptionsPanel from "../config/ViewOptionsPanel";
import ConstraintsConfigPanel from "../config/ConstraintsConfigPanel";
import { IConstraintStore } from "../../document/ConstraintStore";
import "react-toastify/dist/ReactToastify.min.css";
Expand Down Expand Up @@ -76,8 +76,8 @@ export class Field extends Component<Props, State> {
marker={selectedSidebar as IEventMarkerStore}
></EventMarkerConfigPanel>
)}
<VisibilityPanel></VisibilityPanel>
<WaypointVisibilityPanel></WaypointVisibilityPanel>
<ViewOptionsPanel />
<WaypointVisibilityPanel />
<Tooltip
disableInteractive
placement="top-start"
Expand Down
8 changes: 4 additions & 4 deletions src/document/UIStateStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export type SelectableItemTypes =
| IEventMarkerStore
| undefined;

/* Visibility stuff */
/* ViewOptionsPanel items */
const ViewData = {
Field: {
index: 0,
Expand Down Expand Up @@ -255,7 +255,7 @@ export const UIStateStore = types
saveFileDir: types.maybe(types.string),
isGradleProject: types.maybe(types.boolean),
waypointPanelOpen: false,
visibilityPanelOpen: false,
isViewOptionsPanelOpen: false,
robotConfigOpen: false,
mainMenuOpen: false,
settingsTab: types.refinement(
Expand Down Expand Up @@ -387,8 +387,8 @@ export const UIStateStore = types
setWaypointPanelOpen(open: boolean) {
self.waypointPanelOpen = open;
},
setVisibilityPanelOpen(open: boolean) {
self.visibilityPanelOpen = open;
setViewOptionsPanelOpen(open: boolean) {
self.isViewOptionsPanelOpen = open;
},
setPathAnimationTimestamp(time: number) {
self.pathAnimationTimestamp = time;
Expand Down
Loading