src/view/feedback.js
- import { downloadBlob } from "./download.js";
- export function submitFeedback(dialog, midiB64, parameters, report) {
- const data = new FormData(dialog.querySelector("form"));
- const stem = downloadBlob(midiB64);
- const lines = [
- "Please find the generated MIDI file attached.",
- "",
- `Occupation: ${data.get("occupation") || "-"}`,
- `Musical experience (1-5): ${data.get("experience") || "-"}`,
- `Overall impression (1-5): ${data.get("rating") || "-"}`,
- `Aspect ratings: ${JSON.stringify(report.aspects)}`,
- `Further questions: ${JSON.stringify({ human: data.get("human") ? "yes" : "no", reuse: data.get("reuse") ? "yes" : "no" })}`,
- `Comments: ${data.get("feedback") || "-"}`,
- "",
- "Parameters:",
- JSON.stringify(parameters, null, 2),
- ];
- const progression = (report.chordProgression || [])
- .map((p) => `${p.label}: ${(p.chords || []).join(" -> ")}`)
- .join("\n");
- if (progression) {
- lines.push("", "Chord progression:", progression);
- }
- const body = lines.join("\n");
- const url = `mailto:medinger@b-tu.de?subject=${encodeURIComponent(stem)}&body=${encodeURIComponent(body)}`;
- window.open(url, "_self");
- dialog.close();
- }