functioning profiles
This commit is contained in:
1 parent
8985312dd2
commit
d890c1aa64
17 files changed
+136
-78
No files matched your search
@@ -9,12 +9,15 @@ import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
|
||||
import SelectIcon from "@mui/icons-material/HighlightAltSharp";
|
||||
import RunIcon from "@mui/icons-material/RunCircleOutlined";
|
||||
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import Box from "@mui/material/Box";
|
||||
import Chip from "@mui/material/Chip";
|
||||
|
||||
import { InputTextView } from "components/Inputs/InputTextView";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
import { AutomationManagerAuto } from "../types";
|
||||
import { Tags } from "./Tags";
|
||||
import { TagDB } from "../TagDB";
|
||||
import { Chip, Tooltip } from "@mui/material";
|
||||
import { useLang } from "lang";
|
||||
|
||||
export type MetadataBoxProps = AutomationManagerAuto & {
|
||||
@@ -34,7 +37,7 @@ export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
||||
? langStore.get(`AUTOMATION_STATE_${props.state}`)
|
||||
: props.state;
|
||||
return (
|
||||
<div
|
||||
<Box
|
||||
className={[
|
||||
"automation-manager--metadatabox",
|
||||
props.isSelected ? "selected" : "",
|
||||
@@ -79,15 +82,18 @@ export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
||||
/>
|
||||
</Tooltip>
|
||||
</span>
|
||||
<Tooltip title={`ID=${props.id}, EntityID=${props.entityId}`}>
|
||||
<InputTextView
|
||||
className="title"
|
||||
placeholder={langStore.get("TITLE")}
|
||||
value={props.title}
|
||||
onChange={props.onTitleUpdate}
|
||||
disabled={props.isNew}
|
||||
/>
|
||||
</Tooltip>
|
||||
<InputTextView
|
||||
titleSlug="AUTOMATION_METADATA_TOOLTIP_SIMPLE"
|
||||
titleParams={{
|
||||
id: props.id,
|
||||
entityId: props.entityId,
|
||||
}}
|
||||
className="title"
|
||||
placeholder={langStore.get("TITLE")}
|
||||
value={props.title}
|
||||
onChange={props.onTitleUpdate}
|
||||
disabled={props.isNew}
|
||||
/>
|
||||
<InputTextView
|
||||
className="description"
|
||||
placeholder={langStore.get("DESCRIPTION")}
|
||||
@@ -106,24 +112,24 @@ export const MetadataBox: FC<MetadataBoxProps> = (props) => {
|
||||
</div>
|
||||
<div className="buttons">
|
||||
<ButtonIcon
|
||||
titleSlug="SELECT_AUTOMATION"
|
||||
className="select"
|
||||
icon={<SelectIcon />}
|
||||
onClick={props.onSelect}
|
||||
title={langStore.get("SELECT_AUTOMATION")}
|
||||
/>
|
||||
<ButtonIcon
|
||||
titleSlug="TRIGGER_AUTOMATION"
|
||||
className="run"
|
||||
icon={<RunIcon />}
|
||||
onClick={props.onRun}
|
||||
title={langStore.get("TRIGGER_AUTOMATION")}
|
||||
/>
|
||||
<ButtonIcon
|
||||
titleSlug="DELETE_AUTOMATION"
|
||||
className="delete"
|
||||
icon={<DeleteForeverIcon />}
|
||||
onClick={props.onDelete}
|
||||
title={langStore.get("DELETE_AUTOMATION")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -40,4 +40,11 @@
|
||||
.bottom-bar .settings svg {
|
||||
height: 0.5em;
|
||||
width: 0.5em;
|
||||
}
|
||||
|
||||
.user-profile {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 10em;
|
||||
min-height: 10em;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export const BottomBar: FC<BottomBarProps> = ({ api }) => {
|
||||
<span>version: {version}</span>
|
||||
<Button className="settings" onClick={() => setOpen(!isOpen)}>
|
||||
<SettingsSuggestOutlinedIcon />
|
||||
settings
|
||||
{lang.get("USER_PRERENCES")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import "./ButtonIcons.css";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { FC, ReactNode } from "react";
|
||||
import MuiIconButton, { IconButtonTypeMap } from "@mui/material/IconButton";
|
||||
import IconButton, { IconButtonTypeMap } from "@mui/material/IconButton";
|
||||
import { useLang } from "lang";
|
||||
|
||||
export type ButtonIconProps = {
|
||||
icon: ReactNode;
|
||||
@@ -10,21 +12,31 @@ export type ButtonIconProps = {
|
||||
disabled?: boolean;
|
||||
color?: IconButtonTypeMap["props"]["color"];
|
||||
borderless?: boolean;
|
||||
titleSlug?: string;
|
||||
titleParams?: Record<string, string>;
|
||||
};
|
||||
export const ButtonIcon: FC<ButtonIconProps> = (props) => {
|
||||
const langStore = useLang();
|
||||
return (
|
||||
<MuiIconButton
|
||||
className={[
|
||||
"icon-button",
|
||||
props.className ?? "",
|
||||
props.borderless ? "borderless" : "",
|
||||
].join(" ")}
|
||||
onClick={props.onClick}
|
||||
title={props.title}
|
||||
color={props.color}
|
||||
disabled={props.disabled}
|
||||
<Tooltip
|
||||
title={
|
||||
props.titleSlug ? langStore.get(props.titleSlug, props.titleParams) : ""
|
||||
}
|
||||
describeChild
|
||||
>
|
||||
{props.icon}
|
||||
</MuiIconButton>
|
||||
<IconButton
|
||||
className={[
|
||||
"icon-button",
|
||||
props.className ?? "",
|
||||
props.borderless ? "borderless" : "",
|
||||
].join(" ")}
|
||||
onClick={props.onClick}
|
||||
title={props.title}
|
||||
color={props.color}
|
||||
disabled={props.disabled}
|
||||
>
|
||||
{props.icon}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
@@ -4,6 +4,8 @@ import { FC, PropsWithChildren, useState } from "react";
|
||||
import CheckCircleOutlineOutlinedIcon from "@mui/icons-material/CheckCircleOutlineOutlined";
|
||||
import ModeEditOutlineOutlinedIcon from "@mui/icons-material/ModeEditOutlineOutlined";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useLang } from "lang";
|
||||
|
||||
export type InputTextViewProps = {
|
||||
className?: string;
|
||||
@@ -12,11 +14,15 @@ export type InputTextViewProps = {
|
||||
initialViewMode?: boolean;
|
||||
placeholder?: string;
|
||||
disabled?: boolean;
|
||||
borderless?: boolean;
|
||||
titleSlug?: string;
|
||||
titleParams?: Record<string, string>;
|
||||
};
|
||||
|
||||
export const InputTextView: FC<PropsWithChildren<InputTextViewProps>> = (
|
||||
props
|
||||
) => {
|
||||
const langStore = useLang();
|
||||
const [viewMode, setViewMode] = useState(props.initialViewMode ?? true);
|
||||
const [text, setText] = useState(props.value);
|
||||
const className = [
|
||||
@@ -27,24 +33,33 @@ export const InputTextView: FC<PropsWithChildren<InputTextViewProps>> = (
|
||||
|
||||
if (viewMode) {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
onClick={() => !props.disabled && setViewMode(false)}
|
||||
<Tooltip
|
||||
title={
|
||||
props.titleSlug
|
||||
? langStore.get(props.titleSlug, props.titleParams)
|
||||
: ""
|
||||
}
|
||||
describeChild
|
||||
>
|
||||
{!!props.value ? (
|
||||
<div className="input-text-view--text text-ellipsis">
|
||||
<span>{props.value}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="input-text-view--text input-text-view--placeholder text-ellipsis">
|
||||
<span>{props.placeholder}</span>
|
||||
</div>
|
||||
)}
|
||||
{!props.disabled && (
|
||||
<ModeEditOutlineOutlinedIcon className="input-text-view--edit" />
|
||||
)}
|
||||
{props.children}
|
||||
</div>
|
||||
<div
|
||||
className={className}
|
||||
onClick={() => !props.disabled && setViewMode(false)}
|
||||
>
|
||||
{!!props.value ? (
|
||||
<div className="input-text-view--text text-ellipsis">
|
||||
<span>{props.value}</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="input-text-view--text input-text-view--placeholder text-ellipsis">
|
||||
<span>{props.placeholder}</span>
|
||||
</div>
|
||||
)}
|
||||
{!props.disabled && (
|
||||
<ModeEditOutlineOutlinedIcon className="input-text-view--edit" />
|
||||
)}
|
||||
{props.children}
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user