diff --git a/src/components/DecentSampler/Group/Dialogs/EditGroupItemDialog.jsx b/src/components/DecentSampler/Group/Dialogs/EditGroupItemDialog.jsx
index f0b217c..32db7ea 100644
--- a/src/components/DecentSampler/Group/Dialogs/EditGroupItemDialog.jsx
+++ b/src/components/DecentSampler/Group/Dialogs/EditGroupItemDialog.jsx
@@ -1,21 +1,49 @@
// Dependencies
-import { Fragment, useState } from "react";
+import { Fragment, useRef, useState } from "react";
// Material UI
-import { FormControlLabel, FormHelperText, Icon, Switch } from "@mui/material";
+import { FormControl, FormControlLabel, FormHelperText, Icon, Switch } from "@mui/material";
import { Folder, FolderOff, MiscellaneousServices, SettingsInputSvideo, ShowChart } from "@mui/icons-material";
// Template
import { DefaultTextField } from "@/components/Template/DefaultTextField";
import { DefaultItemDialog } from "@/components/Template/DefaultItemDialog";
import DefaultTagsField from "@/components/Template/DefaultTagsField";
+import { DefaultSelectList } from "@/components/Template/DefaultSelectList";
+
+// Classes
+import { Group } from "@/classes/Group";
+
+// Data
+import glideModes from "@/data/glideModes";
+import triggerOptions from "@/data/trigger";
export function EditGroupItemDialog({ groupItem, open, onClose }) {
+ const previewItem = useRef(new Group(groupItem));
const [enabled, setEnabled] = useState(groupItem.enabled !== "0");
- const [tags, setTags] = useState(groupItem.tags);
+
+ function handleEnabledOnChange(event) {
+ setEnabled(event.target.checked);
+ previewItem.current.enabled = event.target.checked ? "1" : "0";
+ }
function handleTagsOnChange(tags) {
- setTags(tags);
+ previewItem.current.tags = tags;
+ }
+
+ function getPreviewItemValue(name) {
+ return previewItem?.current?.[name] || "";
+ }
+
+ function setPreviewItemValue(event) {
+ const fieldName = event.target.name;
+ const fieldValue = event.target.value;
+ previewItem.current[fieldName] = fieldValue;
+ }
+
+ function handleOnClose() {
+ previewItem.current = new Group(groupItem);
+ onClose();
}
const tabs = [
@@ -24,33 +52,37 @@ export function EditGroupItemDialog({ groupItem, open, onClose }) {
label: "GENERAL",
children: (
- setEnabled(event.target.checked)}
- inputProps={{ "aria-label": "controlled" }}
- color="primary"
- />
- }
- label="Enabled"
- />
-
- Whether or not this group is enabled. Possible values: true, false. Default: true
-
+
+
+ }
+ label="Enabled"
+ />
+
+ Whether or not this group is enabled. Possible values: true, false. Default: true
+
+
+
+
+
)
},
@@ -80,26 +132,30 @@ export function EditGroupItemDialog({ groupItem, open, onClose }) {
@@ -132,42 +191,67 @@ export function EditGroupItemDialog({ groupItem, open, onClose }) {
{
icon: ,
label: "MIDI",
- children: Midi test
+ children: (
+
+
+ level. Default:-1 (off)`}
+ />
+ level. Default:-1 (off)`}
+ />
+ level. Default:-1 (off)`}
+ />
+ level. Default:-1 (off)`}
+ />
+
+ )
}
];
- function onSubmit(event) {
- const formData = new FormData(event.currentTarget);
- const formJson = Object.fromEntries(formData.entries());
-
- groupItem.enabled = enabled ? "1" : "0";
- groupItem.tags = tags;
- groupItem.volume = formJson.volume;
- groupItem.ampVelTrack = formJson.ampVelTrack;
- groupItem.groupTuning = formJson.groupTuning;
-
- groupItem.attack = formJson.attack;
- groupItem.decay = formJson.decay;
- groupItem.sustain = formJson.sustain;
- groupItem.release = formJson.release;
- groupItem.attackCurve = formJson.attackCurve;
- groupItem.decayCurve = formJson.decayCurve;
- groupItem.releaseCurve = formJson.releaseCurve;
- }
-
const dialogIcon = {enabled ? : };
-
const dialogTitle = "Edit group";
-
return (
);
}