-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
443 lines (400 loc) · 21.9 KB
/
index.html
File metadata and controls
443 lines (400 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="ngS8wu36B4P3ZyQBK7Q8rlwMd53-rFN55y8IFsFVApw" />
<title>ClearVoice — AI Communication Coach</title>
<meta name="description" content="AI-powered writing coach with tone heatmap, 3-variation rewrites, and coaching insights. Powered by Claude or GPT-4.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<!-- ═══════════════════════════════════════════════════════════
SETTINGS MODAL
═══════════════════════════════════════════════════════════ -->
<div class="overlay" id="settingsOverlay">
<div class="modal">
<div class="modal-title" id="settingsModalTitle">⚙ API Configuration</div>
<div class="modal-sub" id="settingsModalSub">Your key is saved in your browser only and is sent directly to the AI provider — never to any third-party server.</div>
<div class="form-row">
<div class="form-lbl">AI Provider</div>
<div class="provider-row">
<button class="prov-btn active" id="btnClaude" onclick="pickProvider('claude')">🟠 Claude (Anthropic)</button>
<button class="prov-btn" id="btnOpenAI" onclick="pickProvider('openai')">🟢 GPT-4 (OpenAI)</button>
</div>
</div>
<div class="form-row">
<label class="form-lbl" for="keyInp">API Key</label>
<input class="form-inp" id="keyInp" type="password" placeholder="sk-ant-api03-…" autocomplete="off">
<div class="form-hint" id="keyHint">Get your key at <a href="https://console.anthropic.com" target="_blank" rel="noopener">console.anthropic.com</a></div>
</div>
<div class="form-row">
<label class="form-lbl" for="modelSel">Model</label>
<select class="form-sel" id="modelSel">
<option value="claude-sonnet-4-5-20250929" selected>Claude Sonnet 4.5 — Recommended</option>
<option value="claude-opus-4-5-20251101">Claude Opus 4.5 — Most Capable</option>
<option value="claude-haiku-4-5-20251001">Claude Haiku 4.5 — Fastest</option>
</select>
</div>
<div class="modal-footer">
<button class="btn btn-ghost" onclick="closeSettings()">Cancel</button>
<button class="btn btn-accent" onclick="saveSettings()">💾 Save</button>
</div>
</div>
</div>
<!-- ═══════════════════════════════════════════════════════════
HEADER
═══════════════════════════════════════════════════════════ -->
<header class="header">
<div class="logo">
<div class="logo-mark">✦</div>
<span class="logo-name">ClearVoice</span>
<span class="logo-tag">AI Coach</span>
</div>
<div class="header-right">
<div class="api-pill" onclick="openSettings()" title="API Settings">
<span class="dot" id="apiDot"></span>
<span id="apiLabel">Not configured — click to set up</span>
</div>
<a class="icon-btn github-btn" href="https://github.com/Sushegaad/Professional-Writing-Wizard"
target="_blank" rel="noopener" title="View source on GitHub"
style="text-decoration:none;">
<svg height="18" viewBox="0 0 16 16" width="18" fill="currentColor" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38
0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13
-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66
.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15
-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27
.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12
.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48
0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8
c0-4.42-3.58-8-8-8z"/>
</svg>
</a>
<button class="icon-btn" id="themeBtn" onclick="toggleTheme()" title="Toggle Dark / Light Mode">🌙</button>
<button class="icon-btn" id="settingsIconBtn" onclick="openSettings()" title="Settings">⚙</button>
<button class="icon-btn" onclick="resetAll()" title="Clear All">↺</button>
</div>
</header>
<!-- ═══════════════════════════════════════════════════════════
STYLE MATRIX BAR
═══════════════════════════════════════════════════════════ -->
<div class="matrix-bar">
<span class="matrix-label">Style Matrix</span>
<div class="mx-sep"></div>
<div class="mx-group">
<div class="mx-sublabel">Your Persona</div>
<select class="mx-sel" id="selPersona">
<option value="executive">C-Suite / Executive</option>
<option value="senior">Senior Manager / Lead</option>
<option value="ic" selected>Individual Contributor</option>
<option value="freelancer">Creative / Freelancer</option>
<option value="student">Student / Entry-Level</option>
</select>
</div>
<div class="mx-group">
<div class="mx-sublabel">Audience</div>
<select class="mx-sel" id="selAudience">
<option value="board">Board / C-Suite</option>
<option value="manager">Direct Manager</option>
<option value="peers" selected>Peers / Teammates</option>
<option value="reports">Direct Reports</option>
<option value="client">External Client</option>
<option value="cold">Cold Lead</option>
<option value="public">Public / Social</option>
</select>
</div>
<div class="mx-sep"></div>
<div class="mx-group">
<div class="mx-sublabel">Goal</div>
<div class="pill-group" id="goalGroup">
<button class="pill-btn active" data-v="inform" onclick="pickPill(this,'goalGroup')">📢 Inform</button>
<button class="pill-btn" data-v="request" onclick="pickPill(this,'goalGroup')">🙏 Request</button>
<button class="pill-btn" data-v="deescalate" onclick="pickPill(this,'goalGroup')">🕊 De-escalate</button>
<button class="pill-btn" data-v="inspire" onclick="pickPill(this,'goalGroup')">🚀 Inspire</button>
</div>
</div>
<div class="mx-sep"></div>
<div class="mx-group">
<div class="mx-sublabel">Content Type</div>
<div class="pill-group" id="typeGroup">
<button class="pill-btn active" data-v="email" onclick="pickPill(this,'typeGroup')">📧 Email</button>
<button class="pill-btn" data-v="social" onclick="pickPill(this,'typeGroup')">📱 Social</button>
<button class="pill-btn" data-v="exec" onclick="pickPill(this,'typeGroup')">📊 Exec Summary</button>
<button class="pill-btn" data-v="narrative" onclick="pickPill(this,'typeGroup')">📖 Narrative</button>
<button class="pill-btn" data-v="general" onclick="pickPill(this,'typeGroup')">✏ General</button>
</div>
</div>
<div class="mx-sep"></div>
<div class="mx-group vibe-wrap">
<div class="mx-sublabel">Vibe</div>
<div class="vibe-ends">
<span id="vibeL" class="vibe-end-active">⚡ Succinct</span>
<span id="vibeR">📖 Narrative</span>
</div>
<input type="range" class="vibe" id="vibeSlider" min="0" max="100" value="30" oninput="onVibe(this)">
</div>
</div>
<!-- ═══════════════════════════════════════════════════════════
WORKSPACE — SPLIT EDITOR
═══════════════════════════════════════════════════════════ -->
<div class="workspace">
<!-- ── INPUT PANE ─────────────────────────────────────── -->
<div class="pane pane-input" id="inputPane">
<div class="pane-head">
<div class="pane-title">
<div class="status-dot" id="dotIn"></div>
Your Draft
</div>
<div class="pane-actions">
<span class="wc" id="wcBadge">0 words</span>
<button class="heat-toggle" id="heatBtn" onclick="toggleHeat()">
<span class="hdot"></span> Tone Map
</button>
</div>
</div>
<div class="pane-body">
<textarea class="draft" id="draftArea" oninput="onDraftInput()"
placeholder="Paste your draft here…
Examples to try:
• A work email you keep rewriting
• A LinkedIn post that feels flat
• A message to a difficult stakeholder
• A report executive summary
Configure your Style Matrix above, then click
✦ Analyze & Enhance (or press Ctrl/⌘ + Enter)"></textarea>
<div class="heatmap-layer" id="heatLayer"></div>
</div>
<div class="pane-foot">
<div style="display:flex;flex-direction:column;gap:6px;">
<div class="model-badge">
<span id="mbDot" style="width:6px;height:6px;border-radius:50%;background:var(--text-3);display:inline-block;transition:.2s;"></span>
<span id="mbText"></span>
</div>
<div class="pii-row">
<input type="checkbox" id="piiToggle" onchange="onPiiToggle()">
<label for="piiToggle">Redact PII before sending</label>
<span class="pii-badge" id="piiBadge" style="display:none;"></span>
</div>
</div>
<button class="btn btn-accent" id="analyzeBtn" onclick="runAnalysis()">
✦ Analyze & Enhance
</button>
</div>
</div>
<!-- ── DRAG DIVIDER ──────────────────────────────────── -->
<div class="pane-divider" id="paneDivider" title="Drag to resize panes">
<div class="pane-divider-handle"></div>
</div>
<!-- ── OUTPUT ROW: Enhanced Writing + Coaching Insights side-by-side ── -->
<div class="output-row" id="outputRow">
<!-- ── ENHANCED WRITING PANE ──────────────────────────── -->
<div class="pane" id="outputPane">
<div class="pane-head">
<div class="pane-title">
<div class="status-dot" id="dotOut"></div>
Enhanced Writing
</div>
<div class="pane-actions">
<div class="var-tabs" id="varTabs">
<button class="var-tab active" data-i="0" onclick="switchVar(this,0)">🤝 Negotiator</button>
<button class="var-tab" data-i="1" onclick="switchVar(this,1)">🔭 Visionary</button>
<button class="var-tab" data-i="2" onclick="switchVar(this,2)">⚡ Minimalist</button>
</div>
</div>
</div>
<div class="pane-body">
<!-- Loading overlay (scoped to output pane) -->
<div class="loading-mask" id="loadMask">
<div class="spinner"></div>
<div class="loading-msg" id="loadMsg">Analyzing your writing…</div>
</div>
<!-- Empty state (initial) -->
<div class="empty" id="emptyState" style="height:100%;">
<div class="empty-icon">✦</div>
<h3>Ready to Elevate Your Writing</h3>
<p>Set your Style Matrix above, paste your draft on the left, then click "Analyze & Enhance."</p>
</div>
<!-- Results container (shown after analysis) -->
<div id="outScroll" style="display:none;">
<div class="var-card show" id="vc0">
<div class="var-card-head">
<div class="var-card-name">🤝 The Negotiator</div>
<div class="var-card-tag">Persuasive, empathetic, and strategically warm</div>
</div>
<div class="var-text" id="vt0"></div>
</div>
<div class="var-card" id="vc1">
<div class="var-card-head">
<div class="var-card-name">🔭 The Visionary</div>
<div class="var-card-tag">Bold, inspiring, and forward-thinking</div>
</div>
<div class="var-text" id="vt1"></div>
</div>
<div class="var-card" id="vc2">
<div class="var-card-head">
<div class="var-card-name">⚡ The Minimalist</div>
<div class="var-card-tag">Direct, efficient, respects the reader's time</div>
</div>
<div class="var-text" id="vt2"></div>
</div>
</div>
</div>
<div class="pane-foot" id="outFoot" style="display:none;">
<div style="display:flex;gap:7px;">
<button class="btn btn-ghost" onclick="copyVar()">📋 Copy</button>
<button class="btn btn-ghost" onclick="exportInsights()">📥 Export Report</button>
</div>
<button class="btn btn-accent" onclick="acceptVar()">✓ Accept Version</button>
</div>
</div>
<!-- ── VERTICAL DRAG DIVIDER (col-resize) ─────────────── -->
<div class="pane-divider-x" id="outputDivider" title="Drag to resize · double-click to reset">
<div class="pane-divider-handle-x"></div>
</div>
<!-- ── COACHING INSIGHTS PANE ─────────────────────────── -->
<div class="pane pane-coaching why-panel" id="whyPanel">
<div class="pane-head">
<div class="pane-title" style="font-size:13px;gap:8px;">
🎓 Coaching Insights
<span class="why-badge" id="whyBadge">0 insights</span>
</div>
<div class="pane-actions">
<div class="score-preview" id="scorePreview"></div>
<button class="icon-btn coach-collapse-btn" id="coachCollapseBtn"
onclick="toggleCoachPanel()" title="Collapse coaching panel">◀</button>
</div>
</div>
<div class="why-body" id="whyBody">
<div class="scores-row" id="scoresRow"></div>
<div class="insights" id="insightsList">
<div class="empty-insights">Run an analysis to see coaching insights.</div>
</div>
</div>
</div>
</div><!-- end .output-row -->
</div><!-- end .workspace -->
<!-- ═══════════════════════════════════════════════════════════
HEATMAP LEGEND (shown only when Tone Map is active)
═══════════════════════════════════════════════════════════ -->
<div class="heat-legend" id="heatLegend">
<span class="hl-title">Tone Map</span>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-agg-bd);opacity:.6;"></div> Aggressive</div>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-pas-bd);opacity:.6;"></div> Too Passive</div>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-waf-bd);opacity:.6;"></div> Waffle / Hedge</div>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-jar-bd);opacity:.6;"></div> Jargon</div>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-vag-bd);opacity:.6;"></div> Vague</div>
<div class="hl-item"><div class="hl-dot" style="background:var(--ht-str-bd);opacity:.6;"></div> ✓ Strong</div>
</div>
<!-- ═══════════════════════════════════════════════════════════
TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════ -->
<div class="toast-zone" id="toastZone"></div>
<!-- ═══════════════════════════════════════════════════════════
SCRIPTS (load order matters: config → privacy → api → ui → app)
═══════════════════════════════════════════════════════════ -->
<script src="js/config.js"></script>
<script src="js/privacy.js"></script>
<script src="js/api.js"></script>
<script src="js/ui.js"></script>
<script src="js/app.js"></script>
<!-- ═══════════════════════════════════════════════════════════
PANE RESIZERS — Y-axis (input/output split) and
X-axis (enhanced writing / coaching split)
═══════════════════════════════════════════════════════════ -->
<script>
// ── Y-axis resizer: input pane vs output row ─────────────────
(function () {
const divider = document.getElementById('paneDivider');
const inputPane = document.getElementById('inputPane');
const workspace = divider.parentElement;
let dragging = false, startY = 0, startH = 0;
function clamp(h, total) { return Math.min(Math.max(h, 120), total - 120); }
divider.addEventListener('mousedown', function (e) {
dragging = true; startY = e.clientY;
startH = inputPane.getBoundingClientRect().height;
document.body.style.cursor = 'row-resize';
document.body.style.userSelect = 'none';
divider.classList.add('dragging'); e.preventDefault();
});
document.addEventListener('mousemove', function (e) {
if (!dragging) return;
const newH = clamp(startH + (e.clientY - startY), workspace.getBoundingClientRect().height);
inputPane.style.flex = 'none'; inputPane.style.height = newH + 'px';
});
document.addEventListener('mouseup', function () {
if (!dragging) return; dragging = false;
document.body.style.cursor = ''; document.body.style.userSelect = '';
divider.classList.remove('dragging');
});
divider.addEventListener('touchstart', function (e) {
dragging = true; startY = e.touches[0].clientY;
startH = inputPane.getBoundingClientRect().height;
divider.classList.add('dragging'); e.preventDefault();
}, { passive: false });
document.addEventListener('touchmove', function (e) {
if (!dragging) return;
const newH = clamp(startH + (e.touches[0].clientY - startY), workspace.getBoundingClientRect().height);
inputPane.style.flex = 'none'; inputPane.style.height = newH + 'px';
}, { passive: false });
document.addEventListener('touchend', function () { dragging = false; divider.classList.remove('dragging'); });
divider.addEventListener('dblclick', function () { inputPane.style.flex = '1'; inputPane.style.height = ''; });
})();
// ── X-axis resizer: enhanced writing vs coaching insights ─────
(function () {
const divider = document.getElementById('outputDivider');
const coachPane = document.getElementById('whyPanel');
const outputRow = document.getElementById('outputRow');
let dragging = false, startX = 0, startW = 0;
function clamp(w, total) { return Math.min(Math.max(w, 180), total - 280); }
divider.addEventListener('mousedown', function (e) {
if (coachPane.classList.contains('collapsed')) return;
dragging = true; startX = e.clientX;
startW = coachPane.getBoundingClientRect().width;
document.body.style.cursor = 'col-resize';
document.body.style.userSelect = 'none';
divider.classList.add('dragging'); e.preventDefault();
});
document.addEventListener('mousemove', function (e) {
if (!dragging) return;
const total = outputRow.getBoundingClientRect().width;
const newW = clamp(startW + (startX - e.clientX), total);
coachPane.style.width = newW + 'px';
});
document.addEventListener('mouseup', function () {
if (!dragging) return; dragging = false;
document.body.style.cursor = ''; document.body.style.userSelect = '';
divider.classList.remove('dragging');
});
divider.addEventListener('touchstart', function (e) {
if (coachPane.classList.contains('collapsed')) return;
dragging = true; startX = e.touches[0].clientX;
startW = coachPane.getBoundingClientRect().width;
divider.classList.add('dragging'); e.preventDefault();
}, { passive: false });
document.addEventListener('touchmove', function (e) {
if (!dragging) return;
const total = outputRow.getBoundingClientRect().width;
const newW = clamp(startW + (startX - e.touches[0].clientX), total);
coachPane.style.width = newW + 'px';
}, { passive: false });
document.addEventListener('touchend', function () { dragging = false; divider.classList.remove('dragging'); });
divider.addEventListener('dblclick', function () { coachPane.style.width = ''; });
})();
// ── Toggle coaching panel collapse ───────────────────────────
function toggleCoachPanel() {
const panel = document.getElementById('whyPanel');
const btn = document.getElementById('coachCollapseBtn');
const collapsed = panel.classList.toggle('collapsed');
if (btn) {
btn.textContent = collapsed ? '▶' : '◀';
btn.title = collapsed ? 'Expand coaching panel' : 'Collapse coaching panel';
}
// Keep divider visible so user can see the boundary of the collapsed strip
}
</script>
</body>
</html>