Accept pasted Scattermind concept maps
This commit is contained in:
+27
-2
@@ -51,6 +51,31 @@ function laneClass(lane) {
|
||||
return `lane-${lane?.id || 'defer'}`;
|
||||
}
|
||||
|
||||
function parsePastedJsonPayload(value) {
|
||||
const text = String(value || '').trim();
|
||||
if (!text.startsWith('{') || !text.endsWith('}')) return null;
|
||||
try {
|
||||
const parsed = JSON.parse(text);
|
||||
const looksLikeBridgePayload = parsed && typeof parsed === 'object' && !Array.isArray(parsed) && (
|
||||
parsed.schema || parsed.featureSet || parsed.conceptMap || parsed.lenses || parsed.reference_code || parsed.referenceCode || parsed.artifactId || parsed.ideaText
|
||||
);
|
||||
return looksLikeBridgePayload ? parsed : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function payloadFromForm(formPayload) {
|
||||
const ideaJson = parsePastedJsonPayload(formPayload.idea);
|
||||
const optionsJson = parsePastedJsonPayload(formPayload.optionsText);
|
||||
const embedded = ideaJson || optionsJson;
|
||||
if (!embedded) return formPayload;
|
||||
const merged = { ...embedded };
|
||||
if (!merged.mode && formPayload.mode) merged.mode = formPayload.mode;
|
||||
if (String(formPayload.context || '').trim() && !merged.context) merged.context = formPayload.context;
|
||||
return merged;
|
||||
}
|
||||
|
||||
function renderMetrics(metrics = {}) {
|
||||
const items = [
|
||||
['Value', metrics.value],
|
||||
@@ -227,8 +252,8 @@ function renderResults(data) {
|
||||
async function createFeedbackMap(event) {
|
||||
event.preventDefault();
|
||||
const submit = form.querySelector('button[type="submit"]');
|
||||
const payload = Object.fromEntries(new FormData(form).entries());
|
||||
if (!String(payload.optionsText || '').trim()) payload.optionsText = payload.idea;
|
||||
const payload = payloadFromForm(Object.fromEntries(new FormData(form).entries()));
|
||||
if (!String(payload.optionsText || '').trim() && !payload.conceptMap && !payload.featureSet && !payload.lenses) payload.optionsText = payload.idea;
|
||||
submit.disabled = true;
|
||||
submit.textContent = 'Judging…';
|
||||
try {
|
||||
|
||||
+5
-3
@@ -59,13 +59,15 @@
|
||||
<div class="tool-intro">
|
||||
<p class="eyebrow">MVP · feedback front door · no account · no dashboard swamp</p>
|
||||
<h2 id="try-title">Send a decision brief to the room</h2>
|
||||
<p>Paste the backlog, rough notes, feature dump, or possible next moves. Ranker will extract candidates when it can; use the optional candidate box only if you already have a cleaner list.</p>
|
||||
<p>Paste the backlog, rough notes, feature dump, possible next moves, or a raw Scattermind Concept Map JSON export. Ranker will extract candidates when it can; use the optional candidate box only if you already have a cleaner list.</p>
|
||||
</div>
|
||||
|
||||
<form class="rank-form" id="rankForm">
|
||||
<label>
|
||||
<span>Paste the messy backlog / idea dump <b>required</b></span>
|
||||
<textarea name="idea" rows="8" required placeholder="Example: I’m building a tool that helps freelancers package their services and decide what to sell first. Maybe offer critique, pricing calculator, proposal generator, landing page copywriter, client persona mapper, and some kind of dashboard later? I only have a week and want the fastest useful proof."></textarea>
|
||||
<span>Paste the messy backlog / idea dump / Concept Map JSON <b>required</b></span>
|
||||
<textarea name="idea" rows="8" required placeholder="Example: I’m building a tool that helps freelancers package their services and decide what to sell first. Maybe offer critique, pricing calculator, proposal generator, landing page copywriter, client persona mapper, and some kind of dashboard later? I only have a week and want the fastest useful proof.
|
||||
|
||||
Or paste a Scattermind Concept Map JSON object here; Ranker will preserve source provenance and extract the build order."></textarea>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
||||
Reference in New Issue
Block a user