mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Add a swaying question mark beside Ask for suggestions and a chevron before Send
AI Assisted
This commit is contained in:
1 parent
54b316cdf3
commit
97b5df61ea
7 files changed
+42
-1
No files matched your search
@@ -312,6 +312,7 @@ Built for a mixed product and engineering room reading one screen together.
|
||||
- **One box grows.** On the primary card, the answer box that is being typed in — a `text` question's box, a choice's *Something else* box once picked, or the note under a verdict / confirm / recap once shown — is `textarea.grow`, and the card takes the column's full height above the pager (`.card.is-primary.has-grow { flex: 1 1 auto; }`). `fitGrowBox()` in `app.js` writes the card's free height as the box's `min-height`, **never under 160px**; a `ResizeObserver` watches the main column rather than the box, so the box growing can never retrigger it, and it writes only on a change over 1px. `resize: vertical` with that moving floor makes the handle taller-only; past the fill the card scrolls. Every other box keeps its ordinary size, and the notes panel is untouched.
|
||||
- **A switch per sound.** Every cue is an event in `SOUND_EVENTS` (`palette.js`), each naming its file and rank: `startSkill` (`sounds/sound-14.mp3`, played once the dashboard's **Start** is accepted) 5, `bootup` 4, `sessionStart` (`sounds/sound-07.mp3`) / `sessionEnd` (`sounds/sound-15.mp3`) 3, `question` (`sounds/sound-14.mp3`) / `skillReady` (`sounds/sound-16.mp3`) / `chatReply` (`sounds/sound-06.mp3`) 2, `newTab` (`sounds/sound-05.mp3`) 1, `snore` (`sleeping.mp3`, looped by the wake-up outside the queue) 0. The queue, the held slot and the one-at-a-time rule in `app.js` work on events, one `Audio` per file shared by the events that use it. User Preferences shows a *Play sounds* master (`looks.sound`) over one box per event, saved flat as `sound<Event>` (`soundStartSkill`, …) because `looks.json` only holds flat values; `soundPrefs()` turns any missing or non-boolean switch on, so a file from before the switches keeps every sound. A cue plays only while the master and its own switch are both on; the master off grays the boxes but keeps their ticks, and ticking a box plays it. Seven cues (not `snore` or `bootup`) also keep a pick out of the 19 files in `public/sounds/`, saved flat as `soundFile<Event>` (`soundFileQuestion`); `soundFilePrefs()` validates it against `SOUND_FILES` and a missing or unknown value falls back to the event's default, `sound.js` plays it, and the picker's select and Play button call `previewSound()`, which cuts off what is playing and is dropped behind a still-audible ranked cue.
|
||||
- **Send breathes.** `#btn-send:not(:disabled)` runs `send-pulse`, a soft accent ring that spreads and fades every 2.4s; a disabled Send is still, and reduced motion switches it off.
|
||||
- **Two marks sway.** A `.nudge` is a small accent mark that slides 3px either side of rest (`nudge-sway`, 1.4s each way) just left of the button it points at: the chevron `#send-nudge` before Send, shown only while Send is the filled step (`sendIsStep` in `core.js`, hidden as a send starts, until the next footer render decides again), and the `?` before a live **Ask for suggestions** chip (`suggestNudge()` in `ask.js`, left out while the chip is disabled). The notes panel is redrawn often, so the `?` starts with a negative `animation-delay` taken from the clock and never jumps back to its first frame. Both are `aria-hidden`, and reduced motion holds them still.
|
||||
- **Per-tab scroll memory.** An in-memory `Map` keyed by view id holds the scroller's position (the main column on a document or the Overview, the card on the questions view, with the item it belonged to), restored when the tab comes back. Page-local, never persisted, cleared when the session turns into or out of the dashboard.
|
||||
- **The Overview tab.** Appears only while `GET /overview` returns a file for the session's spec (on the dashboard: the picker's spec; gone for *start from scratch*), fetched with `no-store` on load, on a spec change and on every tab click, so it always shows the file as it is on disk. On the dashboard, a spec with no overview gets a **Map** tab (`?file=map`, `pathfinder/map.md`) and a **Plan draft** tab (`?file=draft`, the live `PLAN-DRAFT-*.md`) in its place, each while its file exists, fetched and drawn the same way; away from the dashboard only the overview is read, since a session's own map or draft is the work already in front of it. Rendered through the same DOM-only markdown path as every doc, captioned read-only. It never becomes a doc: the page is not the record.
|
||||
- **The footer slot.** The workspace label sits centered in the footer's middle track, 12px and muted: `footerLabel()` in `public/workspace.js` builds `folder · branch` (from the workspace's original folder and `state.branch`), or `folder + N folders · branch` once folders are added, and `renderWhere()` steps down through its narrower tiers (`FOOTER_TIERS`) until the text fits. A warning dot marks a missing or unreadable folder. A click opens the Workspace dialog (`#workspace-modal`), where each folder has its own **Copy path**. The notification pill is fixed over the same spot and covers it while it shows, on purpose: nothing there needs pressing while the pill is up. The dashboard keeps the footer for this label alone: `renderFooter()` puts `is-dash` on it, which hides the summary and Send (and on a narrow screen keeps the label, the one thing left in the bar); the footer only disappears there when there is no label to show.
|
||||
|
||||
@@ -4234,6 +4234,9 @@
|
||||
<span class="hint" id="send-hint"></span>
|
||||
<button type="button" class="btn ghost" id="btn-clear" hidden>Clear</button>
|
||||
<button type="button" class="btn" id="btn-dashboard" hidden>Back to the dashboard</button>
|
||||
<span class="nudge send-nudge" id="send-nudge" aria-hidden="true" hidden>
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3l5 5-5 5" /></svg>
|
||||
</span>
|
||||
<button type="button" class="btn primary" id="btn-send" disabled>Send to Plan2Code</button>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -798,7 +798,11 @@ export function renderAside() {
|
||||
|
||||
const attached = noteImages(item.id);
|
||||
const row = attachRow(item.id, "Add files to this note");
|
||||
if (!loopDriving() && !isDashboard() && SUGGEST_KINDS.includes(item.kind)) row.appendChild(suggestChip(item));
|
||||
if (!loopDriving() && !isDashboard() && SUGGEST_KINDS.includes(item.kind)) {
|
||||
const chip = suggestChip(item);
|
||||
if (!chip.disabled) row.appendChild(suggestNudge());
|
||||
row.appendChild(chip);
|
||||
}
|
||||
wrap.appendChild(row);
|
||||
|
||||
if (attached.length) wrap.appendChild(attachTray(item.id, attached));
|
||||
@@ -851,6 +855,17 @@ function suggestChip(item) {
|
||||
return chip;
|
||||
}
|
||||
|
||||
// The question mark that sways beside a live Ask for suggestions chip, so the
|
||||
// chip is noticed. The panel is redrawn often, so the sway starts where the
|
||||
// clock says it should be: a fresh mark never jumps back to its first frame.
|
||||
const NUDGE_CYCLE_MS = 2800;
|
||||
function suggestNudge() {
|
||||
const mark = el("span", "nudge suggest-nudge", "?");
|
||||
mark.setAttribute("aria-hidden", "true");
|
||||
mark.style.animationDelay = `-${Math.round(performance.now() % NUDGE_CYCLE_MS)}ms`;
|
||||
return mark;
|
||||
}
|
||||
|
||||
// The label on a note that is sent and not yet picked up, with the page's small
|
||||
// ring in front so it is plain Plan2Code is still on it. Like the Ask reply
|
||||
// line, no ring once the agent has gone quiet: a turning ring would pass a
|
||||
|
||||
@@ -1936,6 +1936,8 @@ export function renderFooter() {
|
||||
const sendIsStep = !state.disabled && !unanswered().length;
|
||||
btn.classList.toggle("primary", state.disabled || sendIsStep);
|
||||
btn.classList.toggle("standby", !state.disabled && !sendIsStep);
|
||||
// The chevron before Send sways only while Send is the filled, live step.
|
||||
$("send-nudge").hidden = !sendIsStep;
|
||||
|
||||
const hint = $("send-hint");
|
||||
hint.replaceChildren();
|
||||
@@ -2173,6 +2175,7 @@ export async function send() {
|
||||
|
||||
const btn = $("btn-send");
|
||||
btn.disabled = true;
|
||||
$("send-nudge").hidden = true;
|
||||
btn.textContent = "Sending…";
|
||||
try {
|
||||
const res = await fetch("/submit", {
|
||||
|
||||
@@ -483,6 +483,22 @@ input[type="text"].invalid, .md-host.invalid { border-color: var(--warn); }
|
||||
100% { box-shadow: var(--glow), 0 0 0 6px transparent; }
|
||||
}
|
||||
#btn-send.primary:not(:disabled) { animation: send-pulse 2.4s ease-out infinite; }
|
||||
/* A small accent mark that sways toward the button on its right: the chevron
|
||||
before Send once Send is the step, the question mark before a live Ask for
|
||||
suggestions. One sway there and back is 2.8s (NUDGE_CYCLE_MS in ask.js);
|
||||
reduced motion holds it still. */
|
||||
.nudge {
|
||||
flex: none; display: inline-flex; align-items: center; justify-content: center;
|
||||
color: var(--accent); pointer-events: none; user-select: none;
|
||||
animation: nudge-sway 1.4s ease-in-out infinite alternate;
|
||||
}
|
||||
.nudge[hidden] { display: none; }
|
||||
@keyframes nudge-sway {
|
||||
from { transform: translateX(-3px); }
|
||||
to { transform: translateX(3px); }
|
||||
}
|
||||
.suggest-nudge { font-size: 15px; font-weight: 800; line-height: 1; }
|
||||
.send-nudge svg { width: 16px; height: 16px; display: block; }
|
||||
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
|
||||
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
|
||||
.btn.danger { border-color: var(--warn); color: var(--warn); }
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
still, the working star included. */
|
||||
.help-mood-bot, .help-mood-bot *, .help-mood-bot.is-work .eye { animation: none !important; }
|
||||
#btn-send { animation: none; }
|
||||
.nudge { animation: none; }
|
||||
}
|
||||
|
||||
/* User Preferences: action rows (Cleanup's scan/delete buttons share this
|
||||
|
||||
@@ -441,6 +441,8 @@ h1 {
|
||||
.attach-row { display: flex; align-items: center; margin: -4px 0 6px -13px; }
|
||||
.attach-row.is-under { margin: 6px 0 4px -13px; }
|
||||
.attach-row .suggest-chip { margin: 0 0 0 auto; }
|
||||
.attach-row .suggest-nudge { margin-left: auto; }
|
||||
.attach-row .suggest-nudge + .suggest-chip { margin-left: 9px; }
|
||||
.msg .suggest-tag {
|
||||
display: inline-block; margin-bottom: 4px;
|
||||
background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line);
|
||||
|
||||
Reference in new issue
Block a user