Skip to content

Commit

Permalink
[Fix #397] Remove event type when clicking create new button
Browse files Browse the repository at this point in the history
  • Loading branch information
kostobog authored and blcham committed Jun 11, 2024
1 parent 901babd commit fc576c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/dialog/faultEvent/FaultEventCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const FaultEventCreation = ({ useFormMethods, isRootEvent, eventValue, isEditedE
} = useFormMethods;

const faultEvents = useReusableFaultEvents();
const [newEvent, setNewEvent] = useState<String | null>(null);
const [selectedEvent, setSelectedEvent] = useState<FaultEvent | null>(null);
const [showCreateEvent, setShowCreateEvent] = useState(false);
const existingEventSelected = Boolean(selectedEvent);
Expand All @@ -52,10 +53,12 @@ const FaultEventCreation = ({ useFormMethods, isRootEvent, eventValue, isEditedE

const handleFilterOptions = (inputValue) => {
const filtered = faultEvents.filter((option) => option.name.toLowerCase().includes(inputValue.toLowerCase()));
setNewEvent(inputValue);
setFilteredOptions(filtered);
};

const handleOnCreateEventClick = (e: MouseEvent) => {
setSelectedEvent({ name: newEvent });
setShowCreateEvent(true);
};

Expand Down

0 comments on commit fc576c9

Please sign in to comment.