From b48a029980831814050b515a77fa178ef1dd1bda Mon Sep 17 00:00:00 2001 From: Darren Walker Date: Wed, 9 Oct 2024 14:58:33 +0100 Subject: [PATCH] cosmetic fix for the delete button for spectral windows and timing windows --- .../observations/timingWindows.form.tsx | 8 ++++---- .../technicalGoals/spectrum.form.tsx | 6 +++--- .../webui/src/commonButtons/accordianControls.tsx | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/webui/src/ProposalEditorView/observations/timingWindows.form.tsx b/src/main/webui/src/ProposalEditorView/observations/timingWindows.form.tsx index da7f963f..e0af55b8 100644 --- a/src/main/webui/src/ProposalEditorView/observations/timingWindows.form.tsx +++ b/src/main/webui/src/ProposalEditorView/observations/timingWindows.form.tsx @@ -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"; @@ -118,10 +118,10 @@ export default function TimingWindowsForm( let labelIndex = index + 1; return ( - { tw.id === 0 ? form.removeListItem('timingWindows', index) : confirmDeletion(index, tw.id); diff --git a/src/main/webui/src/ProposalEditorView/technicalGoals/spectrum.form.tsx b/src/main/webui/src/ProposalEditorView/technicalGoals/spectrum.form.tsx index 641a9865..836de733 100644 --- a/src/main/webui/src/ProposalEditorView/technicalGoals/spectrum.form.tsx +++ b/src/main/webui/src/ProposalEditorView/technicalGoals/spectrum.form.tsx @@ -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"; @@ -183,9 +183,9 @@ export default function SpectralWindowsSection( let labelIndex = (mapIndex + 1).toString(); return ( - { sw.id === 0 ? form.removeListItem('spectralWindows', mapIndex) : diff --git a/src/main/webui/src/commonButtons/accordianControls.tsx b/src/main/webui/src/commonButtons/accordianControls.tsx index ff8f6b50..668c98ed 100644 --- a/src/main/webui/src/commonButtons/accordianControls.tsx +++ b/src/main/webui/src/commonButtons/accordianControls.tsx @@ -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 ( + + {props.title} + + + ) +} export function AccordionDelete( props : {