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/fix editor sidepanel layout #631

Merged
merged 4 commits into from
Oct 10, 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
3 changes: 2 additions & 1 deletion public/locales/cs/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"autoLayoutToolTip": "Automatické uspořádání stromu poruch",
"exportToolTip": "Exportovat aktuální zobrazení",
"minimumOperationalHours": "Min. provozní doba",
"diagramOptions": "Možnosti diagramu",
"diagramOptions": "Akce diagramu",
"messages": {
"mohNewValue": "Nová hodnota, která se není použíta při vyhodnocování stromu chyb.",
"mohExperimental": "Hodnota se liší od min. hodnota provozní hodiny systému.",
Expand Down Expand Up @@ -140,6 +140,7 @@
"linkedComponent": "Propojená komponenta"
},
"faultEventMenu": {
"detailSectionTitle": "Podrobnosti o události",
"eventName": "Název události",
"criticality": "Kritičnost",
"fhaBasedFailureRate": "Intenzita poruch založená na FHA",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"autoLayoutToolTip": "Automatic arrangement of the fault tree",
"exportToolTip": "Export current view",
"minimumOperationalHours": "Min. operational hours",
"diagramOptions": "Diagram Options",
"diagramOptions": "Diagram Actions",
"messages": {
"mohNewValue": "New value, not used in fault tree evaluation.",
"mohExperimental": "Value is different from the system's min. operational hour value.",
Expand Down Expand Up @@ -140,6 +140,7 @@
"linkedComponent": "Linked Component"
},
"faultEventMenu": {
"detailSectionTitle": "Event Details",
"eventName": "Event name",
"criticality": "Criticality",
"fhaBasedFailureRate": "FHA based failure rate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import { Theme } from "@mui/material";
import { makeStyles } from "tss-react/mui";

const useStyles = makeStyles()((theme: Theme) => ({
menuTitle: {
backgroundColor: "#1976D256",
marginLeft: "-16px",
marginRight: "-16px",
paddingLeft: "8px",
borderBottom: "inset",
},
divForm: {
flexGrow: 1,
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/dialog/faultEvent/FaultEventCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ const FaultEventCreation = ({
}
return (
<>
<Typography variant="subtitle1" gutterBottom>
{`${t("newFtaModal.eventPlaceholder")}:`}
<Typography variant="h6" className={classes.menuTitle} gutterBottom>
{`${t("faultEventMenu.detailSectionTitle")}`}
</Typography>

<br />
<ControlledAutocomplete
control={control}
name="existingEvent"
Expand Down
2 changes: 1 addition & 1 deletion src/components/editor/faultTree/menu/SidebarMenuHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const SidebarMenuHeader: React.FC<SidebarMenuHeaderProps> = ({
const actionCall = useActionCall(isModified, setShowUnsavedChangesDialog);

return (
<Box padding={2}>
<Box padding={2} style={{ padding: "0px" }}>
<DiagramOptions
onExportDiagram={() => actionCall(onExportDiagram)}
onConvertToTable={() => actionCall(onConvertToTable)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ const FaultEventMenu = ({
{basedFailureRate && (
<Box className={classes.eventPropertyRow}>{fhaFailureRateComponent(basedFailureRate, null, null)}</Box>
)}
<Divider className={classes.divider} />
</>
)}

Expand All @@ -456,7 +455,6 @@ const FaultEventMenu = ({
{basedFailureRate && (
<Box className={classes.eventPropertyRow}>{fhaFailureRateComponent(basedFailureRate, null, null)}</Box>
)}
<Divider className={classes.divider} />
</>
)}

Expand Down Expand Up @@ -533,7 +531,6 @@ const FaultEventMenu = ({
onChange={(event) => handleManuallyDefinedFailureRateChange(event, NodeTypeWithManualFailureRate.External)}
inputProps={{ inputMode: "decimal" }}
/>
<Divider className={classes.divider} />
</Box>
)}

Expand All @@ -547,6 +544,9 @@ const FaultEventMenu = ({
{shapeToolData && (
<EventFailureModeProvider eventIri={shapeToolData?.iri}>
<Box>
{(criticality || ataSystem || partNumber || stock || quantity || schematicDesignation) && (
<Divider className={classes.divider} />
)}
{criticality && <Typography>{propertyWithValue("eventDescription.severity", criticality)}</Typography>}
{ataSystem && (
<Typography>
Expand Down
13 changes: 13 additions & 0 deletions src/components/editor/menu/DiagramOptions.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Theme } from "@mui/material";
import { makeStyles } from "tss-react/mui";

const useStyles = makeStyles()((theme: Theme) => ({
menuTitle: {
backgroundColor: "#1976D256",
marginRight: "-16px",
paddingLeft: "8px",
borderBottom: "inset",
},
}));

export default useStyles;
8 changes: 5 additions & 3 deletions src/components/editor/menu/DiagramOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as React from "react";
import { useTranslation } from "react-i18next";
import CircularProgress from "@mui/material/CircularProgress";
import { ENVVariable } from "@utils/constants";
import useStyles from "@components/editor/menu/DiagramOptions.styles";

export interface Props {
onApplyAutomaticLayout: () => void;
Expand All @@ -27,10 +28,11 @@ const DiagramOptions = ({
rendering,
}: Props) => {
const { t } = useTranslation();
const { classes } = useStyles();

return (
<React.Fragment>
<Typography variant="h5" gutterBottom>
<>
<Typography variant="h6" className={classes.menuTitle} gutterBottom>
{t("diagramSidePanel.diagramOptions")}
</Typography>
<div>
Expand Down Expand Up @@ -58,7 +60,7 @@ const DiagramOptions = ({
)}
</div>
<Divider />
</React.Fragment>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Theme } from "@mui/material";
import { makeStyles } from "tss-react/mui";

const useStyles = makeStyles()((theme: Theme) => ({
menuTitle: {
backgroundColor: "#1976D256",
marginLeft: "-16px",
marginRight: "-16px",
paddingLeft: "8px",
borderBottom: "inset",
},
emptyTitle: {
textAlign: "center",
fontStyle: "italic",
fontWeight: "bold",
color: theme.main.grey,
padding: theme.spacing(10, 2),
},
}));

// TODO jss-to-tss-react codemod: usages of this hook outside of this file will not be converted.
export default useStyles;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useForm } from "react-hook-form";
import { FailureModeProvider } from "@hooks/useFailureModes";
import { simplifyReferences } from "@utils/utils";
import { useTranslation } from "react-i18next";
import useStyles from "@components/editor/system/menu/component/ComponentSidebarMenu.styles";

interface Props {
component: Component;
Expand All @@ -24,6 +25,7 @@ interface Props {
const ComponentSidebarMenu = ({ component, onComponentUpdated, systemComponents }: Props) => {
const [showSnackbar] = useSnackbar();
const { t } = useTranslation();
const { classes } = useStyles();

const allowedComponents = filter(flatten([systemComponents]), (o) => o.iri !== component?.iri);

Expand Down Expand Up @@ -62,17 +64,19 @@ const ComponentSidebarMenu = ({ component, onComponentUpdated, systemComponents

return (
<React.Fragment>
<Typography variant="h5" gutterBottom>
{t("systemComponentMenu.editComponent")}
</Typography>
<Divider />
{component ? (
<ComponentEditMenu component={component} onComponentUpdated={onComponentUpdated} />
<>
<Typography variant="h6" className={classes.menuTitle} gutterBottom>
{t("systemComponentMenu.editComponent")}
</Typography>
<ComponentEditMenu component={component} onComponentUpdated={onComponentUpdated} />
</>
) : (
<Typography variant="subtitle1" gutterBottom>
<Typography className={classes.emptyTitle} variant="subtitle1" gutterBottom>
{t("systemComponentMenu.notSelected")}
</Typography>
)}
<Divider />

{component && (
<React.Fragment>
Expand Down
Loading