From e4af85cdfadeb181b30663257ffd8aad0462e67f Mon Sep 17 00:00:00 2001 From: Ari Date: Fri, 29 Jul 2022 15:16:47 -0400 Subject: [PATCH] consolidated ismobile --- .../AutomationEditor/index.mobile.css | 23 ++++++++ .../src/components/AutomationEditor/index.tsx | 35 +++++++----- .../AutomationManager/Loaded/index.mobile.css | 57 ------------------- .../AutomationManager/Loaded/index.tsx | 5 +- .../MetadataBox/index.mobile.css | 2 +- .../AutomationManager/MetadataBox/index.tsx | 2 - .../Sidebar/index.mobile.css | 33 +++++++++++ .../AutomationManager/Sidebar/index.tsx | 10 +++- .../components/AutomationManager/index.css | 2 +- .../ConditionNodeBase.mobile.css | 8 +-- .../ConditionEditor/ConditionNodeBase.tsx | 6 +- webapp/src/components/Modal/index.tsx | 4 +- webapp/src/components/Page/index.tsx | 4 +- webapp/src/components/SizeModal.tsx | 15 ----- 14 files changed, 100 insertions(+), 106 deletions(-) create mode 100644 webapp/src/components/AutomationEditor/index.mobile.css delete mode 100644 webapp/src/components/AutomationManager/Loaded/index.mobile.css create mode 100644 webapp/src/components/AutomationManager/Sidebar/index.mobile.css delete mode 100644 webapp/src/components/SizeModal.tsx diff --git a/webapp/src/components/AutomationEditor/index.mobile.css b/webapp/src/components/AutomationEditor/index.mobile.css new file mode 100644 index 0000000..688f94c --- /dev/null +++ b/webapp/src/components/AutomationEditor/index.mobile.css @@ -0,0 +1,23 @@ +.mobile .automation-editor--flow-wrapper--toolbar { + align-items: center; +} + +.mobile .automation-editor--flow-wrapper--toolbar--title { + padding-left: 2.5em; + justify-content: center; + flex-direction: column; +} + +.mobile .automation-editor--flow-wrapper--toolbar--title--text .input-text-view.view span { + max-height: 1.25em; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; + word-wrap: break-word; +} + +.mobile .automation-editor--flow-wrapper--toolbar--title--text .id, +.mobile .automation-editor--flow-wrapper--toolbar--title .input-text-view.description, +.mobile .automation-editor--flow-wrapper--toolbar--edit-btn { + display: none; +} \ No newline at end of file diff --git a/webapp/src/components/AutomationEditor/index.tsx b/webapp/src/components/AutomationEditor/index.tsx index f07a8b7..5d846cc 100644 --- a/webapp/src/components/AutomationEditor/index.tsx +++ b/webapp/src/components/AutomationEditor/index.tsx @@ -1,25 +1,32 @@ import "./index.css"; -import Icon from "@mui/material/Icon"; -import { CheckMarkIcon } from "components/Icons"; +import "./index.mobile.css"; + import { FC, useState } from "react"; -import { AutomationData } from "types/automations"; -import { Modal } from "components/Modal"; -import { AutoInfoBox } from "./AutoInfoBox"; -import ModeEditOutlineTwoToneIcon from "@mui/icons-material/ModeEditOutlineTwoTone"; -import { Button } from "components/Inputs/Button"; -import { useAutomatioEditorState, EditorData } from "./state"; -import { MiniFailure } from "types/validators/helper"; -import InputYaml from "components/Inputs/InputYaml"; -import { TagDB } from "components/AutomationManager/TagDB"; +import { useCookies } from "react-cookie"; +import { ControlButton } from "react-flow-renderer"; + import Skeleton from "@mui/material/Skeleton"; import LinearProgress from "@mui/material/LinearProgress"; -import { useCookies } from "react-cookie"; + +import Edit from "@mui/icons-material/Edit"; +import Icon from "@mui/material/Icon"; +import ModeEditOutlineTwoToneIcon from "@mui/icons-material/ModeEditOutlineTwoTone"; +import { CheckMarkIcon } from "components/Icons"; + +import { Modal } from "components/Modal"; +import { Button } from "components/Inputs/Button"; +import InputYaml from "components/Inputs/InputYaml"; +import { TagDB } from "components/AutomationManager/TagDB"; import { DAGDims } from "components/DAGGraph/elements/types"; import { DAGAutomationGraph } from "components/DAGGraph"; import { InputList } from "components/Inputs/InputList"; import { InputTextView } from "components/Inputs/InputTextView"; -import { ControlButton } from "react-flow-renderer"; -import Edit from "@mui/icons-material/Edit"; + +import { AutomationData } from "types/automations"; +import { MiniFailure } from "types/validators/helper"; + +import { AutoInfoBox } from "./AutoInfoBox"; +import { useAutomatioEditorState, EditorData } from "./state"; interface Props { automation?: AutomationData; diff --git a/webapp/src/components/AutomationManager/Loaded/index.mobile.css b/webapp/src/components/AutomationManager/Loaded/index.mobile.css deleted file mode 100644 index 547de77..0000000 --- a/webapp/src/components/AutomationManager/Loaded/index.mobile.css +++ /dev/null @@ -1,57 +0,0 @@ -.automation-manager.mobile .automation-manager--sidebar.shown { - height: 100vh; - min-height: 100vh; - min-width: 100vw; -} - -.automation-manager.mobile .automation-manager--sidebar .automation-manager--sidebar-box--bottom-buttons .hide-btn { - transform: rotate(-90deg); - left: 0.5em; - background-color: var(--mui-background-paper); - height: 2em; - width: 2em; -} - -.automation-manager.mobile .automation-manager--sidebar.hidden { - height: 0; - min-height: 0; -} - -.automation-manager.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--nav, -.automation-manager.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--list { - display: none; -} - -.automation-manager.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons { - height: 0; -} - -.automation-manager.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons .hide-btn { - transform: rotate(90deg); - top: 1em; - z-index: 100; -} - -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar { - align-items: center; -} - -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar--title { - padding-left: 2.5em; - justify-content: center; - flex-direction: column; -} - -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar--title--text .input-text-view.view span { - max-height: 1.25em; - overflow: hidden; - text-overflow: ellipsis; - word-break: break-all; - word-wrap: break-word; -} - -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar--title--text .id, -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar--title .input-text-view.description, -.automation-manager.mobile .automation-editor--flow-wrapper--toolbar--edit-btn { - display: none; -} \ No newline at end of file diff --git a/webapp/src/components/AutomationManager/Loaded/index.tsx b/webapp/src/components/AutomationManager/Loaded/index.tsx index 5eba3e5..cb57885 100644 --- a/webapp/src/components/AutomationManager/Loaded/index.tsx +++ b/webapp/src/components/AutomationManager/Loaded/index.tsx @@ -1,5 +1,4 @@ import "./index.css"; -import "./index.mobile.css"; import { AutomationEditor } from "components/AutomationEditor"; import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants"; @@ -10,7 +9,6 @@ import { UseAutomationManagerStateArgs, } from "./state"; import Alert from "@mui/material/Alert"; -import useWindowSize from "utils/useWindowSize"; export type AutomationManagerLoadedProps = UseAutomationManagerStateArgs & { onAutomationDelete: (aid: string) => void; @@ -19,10 +17,9 @@ export const AutomationManagerLoaded: FC< PropsWithChildren > = ({ children, onAutomationDelete, ...args }) => { const state = useAutomationManagerState(args); - const { isMobile } = useWindowSize(); return ( -
+
{children} = (props) => { const isValidState = ["on", "off"].includes(props.state); - const { isMobile } = useWindowSize(); return (
diff --git a/webapp/src/components/AutomationManager/Sidebar/index.mobile.css b/webapp/src/components/AutomationManager/Sidebar/index.mobile.css new file mode 100644 index 0000000..cdfa248 --- /dev/null +++ b/webapp/src/components/AutomationManager/Sidebar/index.mobile.css @@ -0,0 +1,33 @@ +.mobile .automation-manager--sidebar.shown { + height: 100vh; + min-height: 100vh; + min-width: 100vw; +} + +.mobile .automation-manager--sidebar .automation-manager--sidebar-box--bottom-buttons .hide-btn { + transform: rotate(-90deg); + left: 0.5em; + background-color: var(--mui-background-paper); + height: 2em; + width: 2em; +} + +.mobile .automation-manager--sidebar.hidden { + height: 0; + min-height: 0; +} + +.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--nav, +.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--list { + display: none; +} + +.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons { + height: 0; +} + +.mobile .automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons .hide-btn { + transform: rotate(90deg); + top: 1em; + z-index: 100; +} \ No newline at end of file diff --git a/webapp/src/components/AutomationManager/Sidebar/index.tsx b/webapp/src/components/AutomationManager/Sidebar/index.tsx index 5b5a1cc..02d776a 100644 --- a/webapp/src/components/AutomationManager/Sidebar/index.tsx +++ b/webapp/src/components/AutomationManager/Sidebar/index.tsx @@ -1,4 +1,5 @@ import "./index.css"; +import "./index.mobile.css"; import { FC, useState } from "react"; @@ -92,7 +93,14 @@ export const AutomationManagerSidebar: FC = ({ ))}
- = (props) => { // render return (
= ({ children, open }) => { + const { isMobile } = useWindowSize(); return ( -
+
{children} diff --git a/webapp/src/components/Page/index.tsx b/webapp/src/components/Page/index.tsx index 8913a5a..6d6d93d 100644 --- a/webapp/src/components/Page/index.tsx +++ b/webapp/src/components/Page/index.tsx @@ -13,6 +13,7 @@ import Button from "@mui/material/Button"; import { useHAConnection } from "haService/connection"; import { ConfirmProvider } from "material-ui-confirm"; import { Color } from "@mui/material"; +import useWindowSize from "utils/useWindowSize"; const theme = createTheme({ palette: { @@ -27,6 +28,7 @@ export const InternalPage: FC<{ const theme = useTheme(); const snackbar = useSnackbar(); const snackbarKeyHAConKey = useRef(null); + const { isMobile } = useWindowSize(); useEffect(() => { if (conn.status === "error") { @@ -66,7 +68,7 @@ export const InternalPage: FC<{ }, [conn, snackbar]); return ( -
+