Eric Xu commited on
Show elapsed seconds on Auto-fill buttons while thinking
Browse files- web/static/index.html +7 -2
web/static/index.html
CHANGED
|
@@ -776,9 +776,13 @@ async function inferSpec() {
|
|
| 776 |
|
| 777 |
if (goalField.value.trim() && audienceField.value.trim()) return;
|
| 778 |
|
| 779 |
-
// Show loading state
|
| 780 |
const btns = document.querySelectorAll('#step1 button.secondary');
|
| 781 |
-
btns.forEach(b => { b.disabled = true; b.dataset.origText = b.textContent;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
if (!goalField.value.trim()) goalField.placeholder = 'Thinking...';
|
| 783 |
if (!audienceField.value.trim()) audienceField.placeholder = 'Thinking...';
|
| 784 |
|
|
@@ -794,6 +798,7 @@ async function inferSpec() {
|
|
| 794 |
} catch (e) {
|
| 795 |
// Restore placeholders on failure
|
| 796 |
} finally {
|
|
|
|
| 797 |
btns.forEach(b => { b.disabled = false; b.textContent = b.dataset.origText || 'Auto-fill'; });
|
| 798 |
if (!goalField.value.trim()) goalField.placeholder = "e.g. 'Increase conversion rate' or 'Get more interview callbacks'";
|
| 799 |
if (!audienceField.value.trim()) audienceField.placeholder = "e.g. 'Engineering managers at mid-stage startups' or 'US consumers aged 25-45'";
|
|
|
|
| 776 |
|
| 777 |
if (goalField.value.trim() && audienceField.value.trim()) return;
|
| 778 |
|
| 779 |
+
// Show loading state with elapsed timer
|
| 780 |
const btns = document.querySelectorAll('#step1 button.secondary');
|
| 781 |
+
btns.forEach(b => { b.disabled = true; b.dataset.origText = b.textContent; });
|
| 782 |
+
let elapsed = 0;
|
| 783 |
+
const tick = () => { elapsed++; btns.forEach(b => { b.textContent = `Thinking (${elapsed}s)`; }); };
|
| 784 |
+
tick();
|
| 785 |
+
const timer = setInterval(tick, 1000);
|
| 786 |
if (!goalField.value.trim()) goalField.placeholder = 'Thinking...';
|
| 787 |
if (!audienceField.value.trim()) audienceField.placeholder = 'Thinking...';
|
| 788 |
|
|
|
|
| 798 |
} catch (e) {
|
| 799 |
// Restore placeholders on failure
|
| 800 |
} finally {
|
| 801 |
+
clearInterval(timer);
|
| 802 |
btns.forEach(b => { b.disabled = false; b.textContent = b.dataset.origText || 'Auto-fill'; });
|
| 803 |
if (!goalField.value.trim()) goalField.placeholder = "e.g. 'Increase conversion rate' or 'Get more interview callbacks'";
|
| 804 |
if (!audienceField.value.trim()) audienceField.placeholder = "e.g. 'Engineering managers at mid-stage startups' or 'US consumers aged 25-45'";
|