consolidated ismobile
This commit is contained in:
1 parent
f99cb84658
commit
e4af85cdfa
14 files changed
+100
-106
No files matched your search
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,25 +1,32 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import Icon from "@mui/material/Icon";
|
import "./index.mobile.css";
|
||||||
import { CheckMarkIcon } from "components/Icons";
|
|
||||||
import { FC, useState } from "react";
|
import { FC, useState } from "react";
|
||||||
import { AutomationData } from "types/automations";
|
import { useCookies } from "react-cookie";
|
||||||
import { Modal } from "components/Modal";
|
import { ControlButton } from "react-flow-renderer";
|
||||||
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 Skeleton from "@mui/material/Skeleton";
|
import Skeleton from "@mui/material/Skeleton";
|
||||||
import LinearProgress from "@mui/material/LinearProgress";
|
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 { DAGDims } from "components/DAGGraph/elements/types";
|
||||||
import { DAGAutomationGraph } from "components/DAGGraph";
|
import { DAGAutomationGraph } from "components/DAGGraph";
|
||||||
import { InputList } from "components/Inputs/InputList";
|
import { InputList } from "components/Inputs/InputList";
|
||||||
import { InputTextView } from "components/Inputs/InputTextView";
|
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 {
|
interface Props {
|
||||||
automation?: AutomationData;
|
automation?: AutomationData;
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import "./index.mobile.css";
|
|
||||||
|
|
||||||
import { AutomationEditor } from "components/AutomationEditor";
|
import { AutomationEditor } from "components/AutomationEditor";
|
||||||
import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants";
|
import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants";
|
||||||
@@ -10,7 +9,6 @@ import {
|
|||||||
UseAutomationManagerStateArgs,
|
UseAutomationManagerStateArgs,
|
||||||
} from "./state";
|
} from "./state";
|
||||||
import Alert from "@mui/material/Alert";
|
import Alert from "@mui/material/Alert";
|
||||||
import useWindowSize from "utils/useWindowSize";
|
|
||||||
|
|
||||||
export type AutomationManagerLoadedProps = UseAutomationManagerStateArgs & {
|
export type AutomationManagerLoadedProps = UseAutomationManagerStateArgs & {
|
||||||
onAutomationDelete: (aid: string) => void;
|
onAutomationDelete: (aid: string) => void;
|
||||||
@@ -19,10 +17,9 @@ export const AutomationManagerLoaded: FC<
|
|||||||
PropsWithChildren<AutomationManagerLoadedProps>
|
PropsWithChildren<AutomationManagerLoadedProps>
|
||||||
> = ({ children, onAutomationDelete, ...args }) => {
|
> = ({ children, onAutomationDelete, ...args }) => {
|
||||||
const state = useAutomationManagerState(args);
|
const state = useAutomationManagerState(args);
|
||||||
const { isMobile } = useWindowSize();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={["automation-manager", isMobile ? "mobile" : ""].join(" ")}>
|
<div className="automation-manager">
|
||||||
{children}
|
{children}
|
||||||
<AutomationManagerSidebar
|
<AutomationManagerSidebar
|
||||||
automations={state.automations}
|
automations={state.automations}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.automation-manager--metadatabox.mobile .buttons {
|
.mobile .automation-manager--metadatabox .buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
|
|||||||
@@ -26,13 +26,11 @@ export type MetadataBoxProps = AutomationManagerAuto & {
|
|||||||
};
|
};
|
||||||
export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
||||||
const isValidState = ["on", "off"].includes(props.state);
|
const isValidState = ["on", "off"].includes(props.state);
|
||||||
const { isMobile } = useWindowSize();
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={[
|
className={[
|
||||||
"automation-manager--metadatabox",
|
"automation-manager--metadatabox",
|
||||||
props.isSelected ? "selected" : "",
|
props.isSelected ? "selected" : "",
|
||||||
isMobile ? "mobile" : "",
|
|
||||||
props.isNew ? "new" : "",
|
props.isNew ? "new" : "",
|
||||||
].join(" ")}
|
].join(" ")}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import "./index.mobile.css";
|
||||||
|
|
||||||
import { FC, useState } from "react";
|
import { FC, useState } from "react";
|
||||||
|
|
||||||
@@ -92,7 +93,14 @@ export const AutomationManagerSidebar: FC<AutomationManagerSidebarProps> = ({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="automation-manager--sidebar-box--bottom-buttons">
|
<div className="automation-manager--sidebar-box--bottom-buttons">
|
||||||
<Button onClick={onAutomationAdd} color="primary" className="add-btn">
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
onAutomationAdd();
|
||||||
|
setHidden(true);
|
||||||
|
}}
|
||||||
|
color="primary"
|
||||||
|
className="add-btn"
|
||||||
|
>
|
||||||
Add
|
Add
|
||||||
</Button>
|
</Button>
|
||||||
<ButtonIcon
|
<ButtonIcon
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
gap: 0.25em;
|
gap: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.automation-manager.mobile, .automation-manager.error {
|
.mobile .automation-manager, .automation-manager.error {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
.condition-node-base.mobile {
|
.mobile .condition-node-base {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.condition-node-base.mobile .condition-node-base--list {
|
.mobile .condition-node-base .condition-node-base--list {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.condition-node-base.mobile .condition-node-base--body {
|
.mobile .condition-node-base .condition-node-base--body {
|
||||||
min-height: 3em;
|
min-height: 3em;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.condition-node-base.mobile .condition-node-base--body.edit {
|
.mobile .condition-node-base .condition-node-base--body.edit {
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
}
|
}
|
||||||
@@ -84,11 +84,7 @@ export const ConditionNodeBase: FC<ConditionNodeBaseProps> = (props) => {
|
|||||||
// render
|
// render
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={[
|
className={["condition-node-base", isEdited ? "is-edited" : ""].join(" ")}
|
||||||
"condition-node-base",
|
|
||||||
isMobile ? "mobile" : "",
|
|
||||||
isEdited ? "is-edited" : "",
|
|
||||||
].join(" ")}
|
|
||||||
>
|
>
|
||||||
<div className="condition-node-base--list">
|
<div className="condition-node-base--list">
|
||||||
<InputList
|
<InputList
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import "./index.css";
|
|||||||
import MuiModal from "@mui/material/Modal";
|
import MuiModal from "@mui/material/Modal";
|
||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode } from "react";
|
||||||
import { Card, CardContent } from "@mui/material";
|
import { Card, CardContent } from "@mui/material";
|
||||||
|
import useWindowSize from "utils/useWindowSize";
|
||||||
|
|
||||||
export interface ModalStyleProps {
|
export interface ModalStyleProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -10,9 +11,10 @@ export interface Props extends ModalStyleProps {
|
|||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
export const Modal: FC<Props> = ({ children, open }) => {
|
export const Modal: FC<Props> = ({ children, open }) => {
|
||||||
|
const { isMobile } = useWindowSize();
|
||||||
return (
|
return (
|
||||||
<MuiModal open={open}>
|
<MuiModal open={open}>
|
||||||
<div className="modal--root">
|
<div className={["modal--root", isMobile ? "mobile" : ""].join(" ")}>
|
||||||
<Card variant="outlined">
|
<Card variant="outlined">
|
||||||
<CardContent>{children}</CardContent>
|
<CardContent>{children}</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import Button from "@mui/material/Button";
|
|||||||
import { useHAConnection } from "haService/connection";
|
import { useHAConnection } from "haService/connection";
|
||||||
import { ConfirmProvider } from "material-ui-confirm";
|
import { ConfirmProvider } from "material-ui-confirm";
|
||||||
import { Color } from "@mui/material";
|
import { Color } from "@mui/material";
|
||||||
|
import useWindowSize from "utils/useWindowSize";
|
||||||
|
|
||||||
const theme = createTheme({
|
const theme = createTheme({
|
||||||
palette: {
|
palette: {
|
||||||
@@ -27,6 +28,7 @@ export const InternalPage: FC<{
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const snackbar = useSnackbar();
|
const snackbar = useSnackbar();
|
||||||
const snackbarKeyHAConKey = useRef<SnackbarKey | null>(null);
|
const snackbarKeyHAConKey = useRef<SnackbarKey | null>(null);
|
||||||
|
const { isMobile } = useWindowSize();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (conn.status === "error") {
|
if (conn.status === "error") {
|
||||||
@@ -66,7 +68,7 @@ export const InternalPage: FC<{
|
|||||||
}, [conn, snackbar]);
|
}, [conn, snackbar]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="page">
|
<main className={["page", isMobile ? "mobile" : ""].join(" ")}>
|
||||||
<style>
|
<style>
|
||||||
{`:root {
|
{`:root {
|
||||||
${convertPaletteToCss(theme.palette)}
|
${convertPaletteToCss(theme.palette)}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
import { FC } from "react";
|
|
||||||
import useWindowSize from "utils/useWindowSize";
|
|
||||||
|
|
||||||
|
|
||||||
export const SizeModal: FC = () => {
|
|
||||||
const size = useWindowSize();
|
|
||||||
|
|
||||||
return <span style={{
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
background: 'white',
|
|
||||||
zIndex: 10,
|
|
||||||
}}>{size.width}/{size.height}={size.ratioWbh} ({size.isMobile ? 'm' : 'd'})</span>
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user