Skip to content

Commit d252f7c

Browse files
author
Codex
committed
Clean up reality check empty state
1 parent e95003f commit d252f7c

2 files changed

Lines changed: 27 additions & 10 deletions

File tree

reality-check.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,26 @@
7676

7777
function runChecks() {
7878
const text = normalize(input.value);
79+
const hasText = text.trim().length > 0;
7980
const results = checks.map((check) => ({
8081
...check,
81-
passed: text.length > 0 && check.terms.some((term) => text.includes(term))
82+
passed: hasText && check.terms.some((term) => text.includes(term))
8283
}));
8384
const score = results.filter((item) => item.passed).length;
84-
scoreEl.textContent = `${score}/${checks.length}`;
85-
verdictEl.textContent = verdict(score, text.length);
85+
scoreEl.textContent = hasText ? `${score}/${checks.length}` : "Start";
86+
verdictEl.textContent = verdict(score, hasText);
8687
renderAiLink();
87-
resultsEl.innerHTML = results.map((item) => `
88-
<article class="${item.passed ? "pass" : "miss"}">
89-
<span>${item.passed ? "Keyword found" : "Not found"}</span>
88+
resultsEl.innerHTML = results.map((item) => {
89+
const state = hasText ? (item.passed ? "pass" : "miss") : "neutral";
90+
const label = hasText ? (item.passed ? "Keyword found" : "Not found") : "Question";
91+
return `
92+
<article class="${state}">
93+
<span>${label}</span>
9094
<strong>${item.label}</strong>
9195
<p>${item.question}</p>
9296
</article>
93-
`).join("");
97+
`;
98+
}).join("");
9499
}
95100

96101
function redTeamPrompt() {
@@ -112,8 +117,8 @@
112117
aiLink.href = url.pathname + url.search;
113118
}
114119

115-
function verdict(score, length) {
116-
if (!length) return "Paste a pitch to start.";
120+
function verdict(score, hasText) {
121+
if (!hasText) return "Paste a pitch to start.";
117122
if (score <= 2) return "Keyword scan: few product basics found.";
118123
if (score <= 5) return "Keyword scan: partial coverage only.";
119124
if (score <= 7) return "Keyword scan: most basics mentioned.";

styles.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ blockquote {
22562256
margin-bottom: 14px;
22572257
}
22582258

2259-
.pitch-score span {
2259+
.pitch-score > span {
22602260
display: inline-flex;
22612261
width: 64px;
22622262
height: 64px;
@@ -2275,6 +2275,10 @@ blockquote {
22752275
line-height: 1.18;
22762276
}
22772277

2278+
.pitch-score strong > span {
2279+
display: block;
2280+
}
2281+
22782282
.pitch-score small {
22792283
display: block;
22802284
margin-top: 4px;
@@ -2313,6 +2317,10 @@ blockquote {
23132317
border-color: rgba(217, 155, 69, .28);
23142318
}
23152319

2320+
.pitch-check-grid article.neutral {
2321+
border-color: rgba(255, 255, 255, .1);
2322+
}
2323+
23162324
.pitch-check-grid span,
23172325
.reality-grid span {
23182326
display: block;
@@ -2328,6 +2336,10 @@ blockquote {
23282336
color: var(--pink);
23292337
}
23302338

2339+
.pitch-check-grid .neutral span {
2340+
color: var(--muted);
2341+
}
2342+
23312343
.pitch-check-grid strong,
23322344
.reality-grid h3,
23332345
.field-study-grid h3 {

0 commit comments

Comments
 (0)