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

fix: Remove additional Editor scroll #3734

Merged
merged 1 commit into from
Sep 30, 2024
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
11 changes: 2 additions & 9 deletions editor.planx.uk/.eslintrc
Copy link
Contributor Author

@DafyddLlyr DafyddLlyr Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hitting some linting issues here - the pre-commit hook was failing to run.

Next PR I'll look at this a bit deeper and see if I can find vitest specific replacements here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #3735

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"react-hooks",
"simple-import-sort",
"jsx-a11y",
"testing-library",
"jest"
"testing-library"
],
"extends": [
"eslint:recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:jest/recommended"
"prettier"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
Expand Down Expand Up @@ -89,11 +87,6 @@
],
"no-nested-ternary": "error"
},
"settings": {
"jest": {
"version": 27
}
},
"overrides": [
{
"files": [
Expand Down
3 changes: 3 additions & 0 deletions editor.planx.uk/src/components/TestEnvironmentBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import { visuallyHidden } from "@mui/utils";
import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";

import { HEADER_HEIGHT_EDITOR } from "./Header";

const TestEnvironmentWarning = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.paper,
color: theme.palette.text.primary,
justifyContent: "space-between",
alignItems: "center",
padding: "0.2em 0",
minHeight: HEADER_HEIGHT_EDITOR,
}));

const TestEnvironmentBanner: React.FC = () => {
Expand Down
17 changes: 14 additions & 3 deletions editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import Sidebar from "./components/Sidebar";
import { useStore } from "./lib/store";
import useScrollControlsAndRememberPosition from "./lib/useScrollControlsAndRememberPosition";

const EditorContainer = styled(Box)(() => ({
const EditorContainer = styled(Box, {
shouldForwardProp: (prop) => prop !== "isTestEnvBannerVisible",
})<{ isTestEnvBannerVisible?: boolean }>(({ isTestEnvBannerVisible }) => ({
display: "flex",
alignItems: "stretch",
overflow: "hidden",
flexGrow: 1,
maxHeight: `calc(100vh - ${HEADER_HEIGHT_EDITOR}px)`,
maxHeight: isTestEnvBannerVisible
? `calc(100vh - ${HEADER_HEIGHT_EDITOR * 2}px)`
: `calc(100vh - ${HEADER_HEIGHT_EDITOR}px)`,
}));

const FlowEditor = () => {
Expand All @@ -27,8 +31,15 @@ const FlowEditor = () => {
useScrollControlsAndRememberPosition(scrollContainerRef);
const showSidebar = useStore((state) => state.showSidebar);

const isTestEnvBannerVisible = useStore(
(state) => state.isTestEnvBannerVisible,
);

return (
<EditorContainer id="editor-container">
<EditorContainer
id="editor-container"
isTestEnvBannerVisible={isTestEnvBannerVisible}
>
<Box
sx={{
display: "flex",
Expand Down
2 changes: 0 additions & 2 deletions editor.planx.uk/src/pages/layout/AuthenticatedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Box from "@mui/material/Box";
import { containerClasses } from "@mui/material/Container";
import { styled } from "@mui/material/styles";
import EditorNavMenu from "components/EditorNavMenu";
import { HEADER_HEIGHT_EDITOR } from "components/Header";
import RouteLoadingIndicator from "components/RouteLoadingIndicator";
import React, { PropsWithChildren } from "react";
import { DndProvider } from "react-dnd";
Expand All @@ -23,7 +22,6 @@ const DashboardContainer = styled(Box)(({ theme }) => ({
display: "flex",
flexDirection: "row",
width: "100%",
minHeight: `calc(100vh - ${HEADER_HEIGHT_EDITOR}px)`,
overflow: "hidden",
[`& > .${containerClasses.root}`]: {
paddingTop: theme.spacing(3),
Expand Down
Loading