mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Show on the desktop app's taskbar when Plan2Code needs you
AI Assisted
This commit is contained in:
1 parent
765d2b3536
commit
c602dfed57
25 files changed
+1038
-112
No files matched your search
@@ -23,6 +23,19 @@ export function linkLeavesPage(href, origin) {
|
||||
return (url.protocol === "http:" || url.protocol === "https:") && url.origin !== origin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call `handler(data)` for each `{ plan2code: kind, ... }` message the frame's
|
||||
* parent sends, and for nothing from anywhere else (another frame, the page
|
||||
* itself). The app's only answer today is `taskbar-state`.
|
||||
*/
|
||||
export function onAppMessage(kind, handler) {
|
||||
window.addEventListener("message", (event) => {
|
||||
if (!framed() || event.source !== window.parent) return;
|
||||
const data = event.data;
|
||||
if (data && typeof data === "object" && data.plan2code === kind) handler(data);
|
||||
});
|
||||
}
|
||||
|
||||
/** Post `message` to the frame's parent, as `{ plan2code: kind, ...extra }`; nothing outside a frame. */
|
||||
export function tellApp(kind, extra = {}) {
|
||||
if (!framed()) return;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<div id="banner" class="banner" role="status" hidden></div>
|
||||
|
||||
<!-- Planny's wake-up on a freshly opened dashboard: a large copy of the
|
||||
rail drawing that powers on centre stage, then glides into the rail.
|
||||
rail drawing that powers on center stage, then glides into the rail.
|
||||
Hidden unless boot.js is playing it; placed entirely by app.css,
|
||||
because the CSP refuses style attributes. -->
|
||||
<div class="wake" id="wake" hidden>
|
||||
@@ -97,7 +97,7 @@
|
||||
<span class="badge" id="badge">Pathfinder</span>
|
||||
<h1 id="title">Plan2Code Console</h1>
|
||||
<!-- The session meter: how much this console session has done. The
|
||||
ring fills with the points (full at 15); the colour is the
|
||||
ring fills with the points (full at 15); the color is the
|
||||
level. Hidden until a frame carries `meter`. -->
|
||||
<span class="meter-slot">
|
||||
<button
|
||||
@@ -812,7 +812,7 @@
|
||||
Four boxes in a row, each talking both ways with the next: you in
|
||||
your browser, this page, a small program on 127.0.0.1, and
|
||||
Plan2Code in your terminal. A dashed outline around all four is
|
||||
labelled "Your machine only".
|
||||
labeled "Your machine only".
|
||||
</desc>
|
||||
<defs>
|
||||
<marker id="hd-about-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="5" markerHeight="5" orient="auto-start-reverse">
|
||||
@@ -930,7 +930,7 @@
|
||||
</li>
|
||||
<li class="help-row">
|
||||
<dl>
|
||||
<dt>You see</dt><dd><strong>Not running</strong> (Planny grey and still).</dd>
|
||||
<dt>You see</dt><dd><strong>Not running</strong> (Planny gray and still).</dd>
|
||||
<dt>Likely cause</dt><dd>Plan2Code has not checked in for a few minutes.</dd>
|
||||
<dt>Do this</dt><dd class="for-browser">Look at the terminal. If it is idle, type <code>continue</code> there.</dd><dd class="for-app">Look at the terminal panel. If it is idle, press <strong>continue</strong> in the line beside Planny, which types it there for you.</dd>
|
||||
</dl>
|
||||
@@ -998,7 +998,7 @@
|
||||
<h4>Not running, or not connected?</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Not running</strong> (Planny grey and still): this page is
|
||||
<strong>Not running</strong> (Planny gray and still): this page is
|
||||
fine, but Plan2Code in the terminal has not checked in for
|
||||
<span data-fact="adriftMinutes">3</span> minutes. It may have finished
|
||||
its turn, hit an error, or be waiting on you there.
|
||||
@@ -1386,7 +1386,7 @@
|
||||
<p id="help-planny-done-text">A green star and both arms up. The session is finished. You can close the tab.</p>
|
||||
<h4>Not running</h4>
|
||||
<p>
|
||||
Grey, still, arms down out of sight. This page is fine, but Plan2Code has not checked in
|
||||
Gray, still, arms down out of sight. This page is fine, but Plan2Code has not checked in
|
||||
for <span data-fact="adriftMinutes">3</span> minutes. Anything you answer
|
||||
is still saved.
|
||||
</p>
|
||||
@@ -1762,7 +1762,7 @@
|
||||
<strong>Start from scratch</strong> for a new idea. The one you pick is
|
||||
what a step works on, and it decides which cards make sense: a spec
|
||||
that is half built has no use for Pathfinder, and a new idea cannot be
|
||||
implemented yet. Cards that do not fit are greyed out with the reason
|
||||
implemented yet. Cards that do not fit are grayed out with the reason
|
||||
why.
|
||||
</p>
|
||||
<p>
|
||||
@@ -2026,7 +2026,7 @@
|
||||
<h4>While something is running</h4>
|
||||
<ul>
|
||||
<li>
|
||||
Everything greys out except switching tabs, searching and opening
|
||||
Everything grays out except switching tabs, searching and opening
|
||||
folds, so nothing queues up behind the running command.
|
||||
</li>
|
||||
<li>What is running shows where the next step usually sits.</li>
|
||||
@@ -2049,7 +2049,7 @@
|
||||
<strong>Done with git</strong> ends the board. If anything happened, the
|
||||
last screen lists the commits, pushes and branches created or deleted,
|
||||
with <strong>Back to the dashboard</strong>; if nothing did, the page
|
||||
goes straight back to the dashboard. It greys while a command runs and
|
||||
goes straight back to the dashboard. It grays while a command runs and
|
||||
comes back when it is done; if Plan2Code stops checking in,
|
||||
<strong>Stop session</strong> in the top bar ends the session instead.
|
||||
While a question of Plan2Code's waits, it cancels that question and
|
||||
@@ -2423,7 +2423,7 @@
|
||||
</li>
|
||||
<li>
|
||||
<strong>Highlight color</strong>: one of
|
||||
<span data-fact="accentCount">32</span>, ocean blue to begin with. It marks
|
||||
<span data-fact="accentCount">38</span>, ocean blue to begin with. It marks
|
||||
what is yours to do, and Planny's star uses it while he works.
|
||||
</li>
|
||||
<li>
|
||||
@@ -2664,6 +2664,16 @@
|
||||
<span class="help" id="agents-status" role="status"></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!-- Only inside the desktop app (framed()): the app saves the switch in its own app.json. -->
|
||||
<fieldset class="modal-ranges looks-desktop" id="looks-desktop" hidden>
|
||||
<legend>Desktop app</legend>
|
||||
<label><input type="checkbox" id="looks-taskbar" checked /> <span>Show on the taskbar when Plan2Code needs me</span></label>
|
||||
<p class="help">
|
||||
Windows: a colored dot on the taskbar button (green on your move, red when it
|
||||
needs you) and a short burst of flashes. macOS: a red badge on the dock icon when it needs
|
||||
you, and a bounce. Linux: depends on your desktop.
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="btn ghost" id="looks-reset">Back to default</button>
|
||||
|
||||
@@ -1044,6 +1044,16 @@ function continueButton() {
|
||||
return btn;
|
||||
}
|
||||
|
||||
// The favicon state last told to the app (attention.rs turns it into the
|
||||
// taskbar's dot). Told only when it changes, never on every status redraw.
|
||||
let lastAttention = null;
|
||||
|
||||
function tellAttention(state) {
|
||||
if (state === lastAttention) return;
|
||||
lastAttention = state;
|
||||
tellApp("attention", { state });
|
||||
}
|
||||
|
||||
export function renderStatus() {
|
||||
if (!page.S) return;
|
||||
const bot = $("planny");
|
||||
@@ -1089,8 +1099,11 @@ export function renderStatus() {
|
||||
tick.textContent = count || "";
|
||||
$("agent-spin").hidden = !spin;
|
||||
$("dock").classList.toggle("is-flying", Boolean(spin));
|
||||
// The tab icon's bar says the same thing from another tab (favicon.js).
|
||||
setFavicon(faviconState({ mood, spin, finished: Boolean(finish()) }));
|
||||
// The tab icon's bar says the same thing from another tab (favicon.js),
|
||||
// and the app's taskbar entry from another window.
|
||||
const icon = faviconState({ mood, spin, finished: Boolean(finish()) });
|
||||
setFavicon(icon);
|
||||
tellAttention(icon);
|
||||
};
|
||||
|
||||
// Before `gone`, deliberately. Once a session has finished, no server is the
|
||||
@@ -1311,7 +1324,7 @@ export function renderSidebar() {
|
||||
box.appendChild(head);
|
||||
for (const e of SKILL_CATALOG.filter((x) => x.group === g.id)) {
|
||||
const av = cardPresentation(e, scan(), selSpec(), menu);
|
||||
// Unavailable for the selected spec fades hard; the brief greying
|
||||
// Unavailable for the selected spec fades hard; the brief graying
|
||||
// while a launch is in flight or the server is away does not.
|
||||
const b = el(
|
||||
"button",
|
||||
@@ -1439,7 +1452,7 @@ function paintMain(main) {
|
||||
if (isDashboard() && !finish()) {
|
||||
if (page.local.launching) renderLaunching(main);
|
||||
else if (page.dashPick) {
|
||||
// A spec-switch under an open confirm can grey the pick out. Rather
|
||||
// A spec-switch under an open confirm can gray the pick out. Rather
|
||||
// than offer START on a card that cannot launch, drop back to the
|
||||
// menu — the picker's new selection speaks for itself there.
|
||||
if (cardAvailability(page.dashPick, scan(), selSpec()).on) renderConfirm(main, page.dashPick);
|
||||
@@ -1620,7 +1633,7 @@ export function renderFooter() {
|
||||
const hint = $("send-hint");
|
||||
hint.replaceChildren();
|
||||
hint.title = state.why;
|
||||
// Something is turning while the turn is not theirs. A line of grey text
|
||||
// Something is turning while the turn is not theirs. A line of gray text
|
||||
// saying "one moment" reads the same whether the agent is working on it or
|
||||
// has quietly died; a spinner is the difference between the two at a glance.
|
||||
// A spinner says "something is happening". Nothing is, once the other end
|
||||
@@ -1932,6 +1945,8 @@ export function wireChrome() {
|
||||
try {
|
||||
navigator.sendBeacon("/bye");
|
||||
} catch {}
|
||||
// A page that goes away leaves no dot on the app's taskbar behind it.
|
||||
tellAttention("plain");
|
||||
});
|
||||
|
||||
// Under the app, a link off the page goes to the default browser through
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ROLES, ROLE_NOT_SET, ROLE_NOT_SET_LABEL, needsRoleNudge, normalizeRole
|
||||
import { isDashboard } from "../selectors.js";
|
||||
import { el, lightDismiss } from "../render.js";
|
||||
import { page, redraw } from "../state.js";
|
||||
import { framed, onAppMessage, tellApp } from "../app-bridge.js";
|
||||
|
||||
const $ = (id) => document.getElementById(id);
|
||||
|
||||
@@ -552,4 +553,14 @@ export function wireLooks() {
|
||||
saveModels();
|
||||
renderModels();
|
||||
});
|
||||
|
||||
// Desktop app: the taskbar switch, kept by the app in its own app.json. The
|
||||
// app says what it holds once the page is up; checked until it does.
|
||||
if (framed()) {
|
||||
$("looks-desktop").hidden = false;
|
||||
onAppMessage("taskbar-state", (data) => {
|
||||
if (typeof data.on === "boolean") $("looks-taskbar").checked = data.on;
|
||||
});
|
||||
$("looks-taskbar").addEventListener("change", (e) => tellApp("taskbar", { on: e.target.checked }));
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@
|
||||
}
|
||||
|
||||
/* Folded-in sections. A page holds one card; what used to be cards of their
|
||||
own (the "all caught up" lull, the session notes) is a labelled section
|
||||
own (the "all caught up" lull, the session notes) is a labeled section
|
||||
inside it instead. */
|
||||
.card-lead { margin: 0 0 16px; }
|
||||
.card-extra { margin: 18px 0 0; }
|
||||
@@ -162,7 +162,7 @@
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
|
||||
}
|
||||
.sa-strength { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
/* A helper's strength and effort, coloured by rank: calm teal, amber, violet. */
|
||||
/* A helper's strength and effort, colored by rank: calm teal, amber, violet. */
|
||||
.sa-badge {
|
||||
--b: var(--ink-2);
|
||||
--b-soft: var(--panel);
|
||||
@@ -755,7 +755,10 @@ h4.md-h, h5.md-h, h6.md-h { font-size: 15px; }
|
||||
.modal.looks .modal-ranges + .modal-ranges { margin-top: 18px; }
|
||||
.looks-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
.looks-row .help { grid-column: 1 / -1; }
|
||||
/* The per-cue boxes sit under the master switch, greyed and locked while it
|
||||
/* The Desktop app group exists only inside the app; elsewhere it stays hidden
|
||||
in spite of the grid above. */
|
||||
.looks-desktop[hidden] { display: none; }
|
||||
/* The per-cue boxes sit under the master switch, grayed and locked while it
|
||||
is off rather than hidden, so the picks stay visible. */
|
||||
.looks-sound-events { display: grid; gap: 8px; }
|
||||
.looks-sound-events.is-off { opacity: 0.45; }
|
||||
|
||||
Reference in new issue
Block a user