getting the new object interaction dialog filtering the components properly regarding devices being passed in, finished the display part for alert and notification

This commit is contained in:
csawatzky 2025-11-27 17:08:14 -06:00
parent 3cdddb928f
commit ce7c90f384
6 changed files with 314 additions and 101 deletions

View file

@ -1,10 +1,11 @@
import { ExpandMore } from "@mui/icons-material";
import { Accordion, AccordionDetails, AccordionSummary, Box, Grid2, List, ListItem, ListSubheader, Typography } from "@mui/material";
import { Add, ExpandMore } from "@mui/icons-material";
import { Accordion, AccordionDetails, AccordionSummary, Box, Grid2, IconButton, List, ListItem, ListSubheader, Typography } from "@mui/material";
import { Component } from "models";
import { describeMeasurement } from "pbHelpers/MeasurementDescriber";
import { pond, quack } from "protobuf-ts/pond";
import React, { useState } from "react";
import NewObjectInteraction from "./NewObjectInteraction";
import { Option } from "common/SearchSelect";
export interface Alert {
conditions: pond.InteractionCondition[];
@ -13,11 +14,12 @@ export interface Alert {
interface Props {
alerts: Alert[]
addNew?: () => void
}
export default function Alerts(props: Props){
const {alerts} = props
const [openNewAlert, setOpenNewAlert] = useState(false)
const {alerts, addNew} = props
// const [openNewAlert, setOpenNewAlert] = useState(false)
const readableCondition = (condition: pond.InteractionCondition) => {
let describer = describeMeasurement(condition.measurementType);
@ -62,9 +64,19 @@ export default function Alerts(props: Props){
return (
<React.Fragment>
<NewObjectInteraction open={openNewAlert} onClose={()=>{}}/>
{/* <NewObjectInteraction open={openNewAlert} onClose={(refresh)=>{
setOpenNewAlert(false)
if(refresh && refreshCallback) refreshCallback()
}} typeOptions={typeOptions} linkedComponents={linkedComponents}/> */}
<List style={{ margin: 5 }}>
<ListSubheader>Alerts</ListSubheader>
<ListSubheader sx={{paddingY: 1, display: "flex", justifyContent: "space-between", alignItems: "center"}}>
<Typography>
Alerts
</Typography>
{addNew &&
<IconButton onClick={()=>{addNew()}} color="primary"><Add /></IconButton>
}
</ListSubheader>
{alerts.map((alert, i) => (
<ListItem key={i}>{alertAccordion(alert)}</ListItem>
))}