Skip to content

Commit

Permalink
cosmetic fix for the delete button for spectral windows and timing wi…
Browse files Browse the repository at this point in the history
…ndows
  • Loading branch information
DJWalker42 committed Oct 9, 2024
1 parent 08b8c79 commit b48a029
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {randomId} from "@mantine/hooks";
import '@mantine/dates/styles.css'
import AddButton from "src/commonButtons/add.tsx";
import { ObservationFormValues } from './edit.group.tsx';
import { AccordionDelete } from 'src/commonButtons/accordianControls.tsx';
import {AccordionRemove} from 'src/commonButtons/accordianControls.tsx';
import { ReactElement } from 'react';
import { TimingWindowGui } from './timingWindowGui.tsx';
import {fetchObservationResourceRemoveConstraint} from "src/generated/proposalToolComponents.ts";
Expand Down Expand Up @@ -118,10 +118,10 @@ export default function TimingWindowsForm(
let labelIndex = index + 1;
return (
<Accordion.Item value={labelIndex.toString()} key={tw.key}>
<AccordionDelete
<AccordionRemove
title={"Window " + labelIndex}
deleteProps={{
toolTipLabel: 'delete timing window ' + labelIndex,
removeProps={{
toolTipLabel: 'remove timing window ' + labelIndex,
onClick: () => {
tw.id === 0 ? form.removeListItem('timingWindows', index) :
confirmDeletion(index, tw.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import {TechnicalGoalValues} from "./edit.group.tsx";
import AddButton from "src/commonButtons/add.tsx";
import {UseFormReturnType} from "@mantine/form";
import {AccordionDelete} from "src/commonButtons/accordianControls.tsx";
import {AccordionRemove} from "src/commonButtons/accordianControls.tsx";
import {frequencyUnits} from "src/physicalUnits/PhysicalUnits.tsx";
import {NumberInputPlusUnit} from "src/commonInputs/NumberInputPlusUnit.tsx";
import {randomId} from "@mantine/hooks";
Expand Down Expand Up @@ -183,9 +183,9 @@ export default function SpectralWindowsSection(
let labelIndex = (mapIndex + 1).toString();
return (
<Accordion.Item value={labelIndex} key={sw.key}>
<AccordionDelete
<AccordionRemove
title={"Window " + labelIndex}
deleteProps={{
removeProps={{
toolTipLabel: "remove spectral window " + labelIndex,
onClick: () => {
sw.id === 0 ? form.removeListItem('spectralWindows', mapIndex) :
Expand Down
13 changes: 13 additions & 0 deletions src/main/webui/src/commonButtons/accordianControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ import ViewEditButton from "./viewEdit.tsx";
import CloneButton from "./clone.tsx";
import { ClickButtonInterfaceProps } from './buttonInterfaceProps.tsx';
import {SaveButton} from "./save.tsx";
import RemoveButton from "./remove.tsx";

/*
functions to simplify Accordion controls when we want to include
buttons/actions in the control header
*/

export function AccordionRemove(
props: {
title: string,
removeProps: ClickButtonInterfaceProps
}) {
return (
<Box style={{ display: 'flex', alignItems: 'center' }}>
<Accordion.Control>{props.title}</Accordion.Control>
<RemoveButton {...props.removeProps} />
</Box>
)
}

export function AccordionDelete(
props : {
Expand Down

0 comments on commit b48a029

Please sign in to comment.