Skip to content

Commit

Permalink
Fix style of workgroup select and bulkedit form after changing textfi… (
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Oct 22, 2024
2 parents 320ea36 + 3e025ec commit 6d5493d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,12 @@ export const BulkEditForm = ({ selected, loadBoreholes }: BulkEditFormProps) =>

const renderInput = useCallback(
(field: BulkEditFormField) => {
if (field.type === FormValueType.Workgroup) return;
if (field.type === FormValueType.Domain) {
return (
<FormDomainSelect
canReset={false}
fieldName={field.api ?? field.fieldName}
label={field.fieldName}
label=""
schemaName={field?.domain ?? field.api ?? field.fieldName}
onUpdate={e => {
onFieldValueChange(field, e);
Expand All @@ -169,25 +168,35 @@ export const BulkEditForm = ({ selected, loadBoreholes }: BulkEditFormProps) =>
<FormBooleanSelect
canReset={false}
fieldName={field.api ?? field.fieldName}
label={field.fieldName}
label=""
onUpdate={e => {
onFieldValueChange(field, e);
}}
/>
);
}
if (field.fieldName === FormValueType.Workgroup) {
return (
<WorkgroupSelect
workgroupId={workgroupId}
enabledWorkgroups={enabledWorkgroups}
setWorkgroupId={setWorkgroupId}
hideLabel={true}
/>
);
}
return (
<FormInput
fieldName={field.api ?? field.fieldName}
label={field.fieldName}
label=""
type={field.type}
onUpdate={e => {
onFieldValueChange(field, e);
}}
/>
);
},
[onFieldValueChange],
[onFieldValueChange, workgroupId, enabledWorkgroups],
);

return (
Expand Down Expand Up @@ -235,18 +244,9 @@ export const BulkEditForm = ({ selected, loadBoreholes }: BulkEditFormProps) =>
</Typography>
</Stack>
</AccordionSummary>
<AccordionDetails sx={{ pl: 5, pr: 3 }}>
<AccordionDetails sx={{ pl: 5, pr: 3, mt: -4 }}>
<StackFullWidth>
<>
{renderInput(field)}
{field.fieldName === FormValueType.Workgroup && (
<WorkgroupSelect
workgroupId={workgroupId}
enabledWorkgroups={enabledWorkgroups}
setWorkgroupId={setWorkgroupId}
/>
)}
</>
<>{renderInput(field)}</>
</StackFullWidth>
</AccordionDetails>
</Accordion>
Expand Down
2 changes: 1 addition & 1 deletion src/client/src/pages/overview/boreholeTable/bottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const BottomBar = ({
workgroupId={workgroup}
enabledWorkgroups={enabledWorkgroups}
setWorkgroupId={setWorkgroup}
sx={{ pt: 4, pb: 3 }}
sx={{ pt: 6, pb: 3 }}
/>,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface WorkgroupSelectProps {
workgroupId: number | null;
enabledWorkgroups: Workgroup[];
setWorkgroupId: React.Dispatch<React.SetStateAction<number | null>>;
hideLabel?: boolean;
sx?: SxProps;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Box, FormControl, InputLabel, MenuItem, Select } from "@mui/material/";
import { theme } from "../../../../AppTheme.ts";
import { WorkgroupSelectProps } from "./actionsInterfaces.ts";

const WorkgroupSelect = ({ workgroupId, enabledWorkgroups, setWorkgroupId, sx }: WorkgroupSelectProps) => {
const WorkgroupSelect = ({ workgroupId, enabledWorkgroups, setWorkgroupId, sx, hideLabel }: WorkgroupSelectProps) => {
const { t } = useTranslation();
return (
<>
<Box sx={{ ...sx, backgroundColor: theme.palette.background.default }}>
<Box sx={{ pt: 2, backgroundColor: theme.palette.background.default, ...sx }}>
{(() => {
const wg = enabledWorkgroups;
if (wg === undefined) {
Expand All @@ -27,7 +27,7 @@ const WorkgroupSelect = ({ workgroupId, enabledWorkgroups, setWorkgroupId, sx }:
}));
return (
<FormControl variant="outlined" sx={{ width: "100%" }}>
<InputLabel id="workgroup-label">{t("workgroup")}</InputLabel>
{!hideLabel && <InputLabel id="workgroup-label">{t("workgroup")}</InputLabel>}
<Select
size="small"
label={t("workgroup")}
Expand Down

0 comments on commit 6d5493d

Please sign in to comment.