alert level has a complete form
+ alert level now has entry for country and volcano name + widget now has a submit button + now has a refresh button that only appears when something is submitted + adjusted number of columns in grid layout + other small sizing adjustments in canvas
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
import { IoIosArrowBack } from "react-icons/io";
|
||||
import { Menu, Portal } from "@chakra-ui/react";
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import AlertLevel from "./AlertLevelWidget";
|
||||
|
||||
export default function AddWidgetMenu({onAddWidget, widgetArray, setWidgetArray}) {
|
||||
function appendWidget(name) {
|
||||
const newID = uuid(); // could be replaced with something else like guid
|
||||
setWidgetArray([ // updating widget array containing info on the types of widgets
|
||||
...widgetArray,
|
||||
{i: newID, widget: name}
|
||||
]);
|
||||
onAddWidget(newID); // updating array containing info on layout of widgets
|
||||
}
|
||||
|
||||
export default function AddWidgetMenu({appendWidget}) {
|
||||
return (
|
||||
<Menu.Root>
|
||||
<Menu.TriggerItem>
|
||||
@@ -23,10 +13,22 @@ export default function AddWidgetMenu({onAddWidget, widgetArray, setWidgetArray}
|
||||
<Menu.Content>
|
||||
<Menu.Item
|
||||
value="AlertLevel"
|
||||
onClick={() => appendWidget(AlertLevel)}
|
||||
onClick={() => appendWidget(AlertLevel, 3, 6, 3, 6, 3, 6)} // width and height are passed through here for each widget
|
||||
>
|
||||
Alert Level
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
CO2
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
IVANS
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
Plume Heights
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
Alert Level Changes
|
||||
</Menu.Item>
|
||||
</Menu.Content>
|
||||
</Menu.Positioner>
|
||||
</Portal>
|
||||
|
||||
Reference in New Issue
Block a user