Public: anyone can read this; the crew can change it.

The app's Drop page takes a file dragged onto it, with the forge's remaining quota shown before the upload starts #13475

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The Drop page now takes a file dragged onto it, with a visible drop box and a progress line. The new test, test/drop-doors.test.ts and test/mcp-size.test.ts pass, as do tsc and design-lint, and scripts/gate.ts --fix rewrapped comments, which are committed.

Notes

shipped production is serving it deploy 59903fa

opened this

The Drop page now takes a file dragged onto it, with a visible drop box and a progress line. The new test, test/drop-doors.test.ts and test/mcp-size.test.ts pass, as do tsc and design-lint, and scripts/gate.ts --fix rewrapped comments, which are committed. I did not look at the page at 390 and 1280 px: the sandbox can't screenshot, so that item is open.

The page already showed "used of allowed" server-side, and its script already refused over-limit files. I added the missing parts.

What changed (src/web/studio/drop.ts, src/web/style/content.ts, docs/design/areas/drop.md, test/drop-page.test.ts)

  • Drop box: the upload form is now a dashed box, .drop-zone, that takes dropped files. A dashed border turns solid on hover, and it has a fixed minimum height with reserved height for the status line, so nothing shifts.
  • Progress: uploads now go through XMLHttpRequest to the same streamed POST …/drop, so the page can show "Sending x: 40%". fetch can't report upload progress.
  • Refusals: the "too large" and "full" sentences come from PUT_WORDS and are written into data attributes on the form. A server refusal is shown with the API's own message. Nothing is stored on a refusal.
  • No JavaScript: the plain multipart form still works unchanged.
  • Quota: the quota line remains server-rendered above the form.
  • Test: test/drop-page.test.ts checks that the page names the quota, the drop box and the refusal words, and that the script handles drops and progress. It is a string-level check on the served HTML and script, not a browser drag.

Not done

  • No multi-file progress total. It reports one file at a time.
  • The solid-border hover background uses var(--muted-bg, transparent). I didn't confirm that token exists, so it may fall back to transparent.
  • No new dependencies.

To try: open /<owner>/<app>/drop as a writer and drag a file onto the box.

The pre-push hook demanded a "Try:" commit, so the branch carries an empty one.

Closes #13423

2 earlier comments · 1 event
commented

The Drop page now takes a file dragged onto it, with a visible drop box and a progress line. The new test, test/drop-doors.test.ts and test/mcp-size.test.ts pass, as do tsc and design-lint, and scripts/gate.ts --fix rewrapped comments, which are committed. I did not look at the page at 390 and 1280 px: the sandbox can't screenshot, so that item is open.

The page already showed "used of allowed" server-side, and its script already refused over-limit files. I added the missing parts.

What changed (src/web/studio/drop.ts, src/web/style/content.ts, docs/design/areas/drop.md, test/drop-page.test.ts)

  • Drop box: the upload form is now a dashed box, .drop-zone, that takes dropped files. A dashed border turns solid on hover, and it has a fixed minimum height with reserved height for the status line, so nothing shifts.
  • Progress: uploads now go through XMLHttpRequest to the same streamed POST …/drop, so the page can show "Sending x: 40%". fetch can't report upload progress.
  • Refusals: the "too large" and "full" sentences come from PUT_WORDS and are written into data attributes on the form. A server refusal is shown with the API's own message. Nothing is stored on a refusal.
  • No JavaScript: the plain multipart form still works unchanged.
  • Quota: the quota line remains server-rendered above the form.
  • Test: test/drop-page.test.ts checks that the page names the quota, the drop box and the refusal words, and that the script handles drops and progress. It is a string-level check on the served HTML and script, not a browser drag.

Not done

  • No multi-file progress total. It reports one file at a time.
  • The solid-border hover background uses var(--muted-bg, transparent). I didn't confirm that token exists, so it may fall back to transparent.
  • No new dependencies.

To try: open /<owner>/<app>/drop as a writer and drag a file onto the box.

The pre-push hook demanded a "Try:" commit, so the branch carries an empty one.

commented

The Drop page now takes a file dragged onto it. The upload form is itself a dashed drop box, and a plain progress line shows how far a file has got.

The check failed on two tests. One was caused by this change and is fixed; the other fails on main too.

  • test/drop.test.ts (fixed): it asserted the page did not contain drop-zone, a leftover from when the upload was just a file input with no drop box. That test was wrong for this feature, so I changed it to expect drop-zone. test/drop.test.ts and test/drop-page.test.ts pass and tsc is clean after the change.
  • test/started-from-line.test.ts (not mine): the check log shows it red on main at 4742a08 with the same tests. I left it alone.

What changed in the app:

  • Drop box and progress line: a file dropped on the form uploads through the existing streamed POST …/drop, and the line reads "Sending x: 40%".
  • Quota: used / allowed is server-rendered above the form before any upload.
  • Refusals: an over-limit file shows the PUT_WORDS sentence and nothing is stored.
  • No JavaScript: the plain form still works.

I didn't look at it at 390 and 1280 px: the sandbox can't take screenshots. Open /<owner>/<app>/drop as a writer and drag a file onto the box to try it.

What I left out: there is no total progress across several files. It reports one file at a time.

Changes requested — before the latest push

Works and is green, but four things to fix in one round:

  1. Design: the drop target is a dashed box around the form (principles 6 and 1), and the hover background uses --muted-bg, a token that does not exist, so the hover state is a no-op. Use a hairline (or a bare highlighted row) and a real token.
  2. Docs: docs/features/drop.md still says nothing about dragging; add it there (the how-to lives in docs/features, not README).
  3. Tests: the new test only checks strings in the served HTML and script. Nothing would fail if the quota refusal, the progress line or the drop handler broke. Add a test for a refused over-quota/over-limit put through the same POST (nothing stored, PUT_WORDS message in the JSON), and keep the data-attribute check.
  4. Looks: no 390 px and 1280 px check was done (box 5). Take them and attach.

Terminal: no drag exists in a terminal and the TUI drop screen already exists, so that is fine.

commented

Three of the four points are addressed and pushed. I did not take the 390 px and 1280 px screenshots (point 4). tsc, design-lint and the drop tests pass; I ran test/drop-page.test.ts and test/drop.test.ts, not the whole suite.

  • Design (point 1):

- .drop-zone is now a plain row under a hairline, with no dashed box. - On drag-over the hairline turns to --accent and the row is tinted with --muted, a token that exists. - The drop.md design note is updated to match.

  • The hint sentence: "or drag files onto this box" is gone from the served HTML. dropJs now writes "Drag files onto this row to send them." into the status line, so with script off nothing promises a drag. The status line already has reserved height, so the text causes no layout shift.
  • Docs (point 2): docs/features/drop.md now describes dragging onto the row. It also says the file limit and remaining space are checked before sending, a progress line shows, and a refusal uses the API's words and stores nothing.
  • Tests (point 3):

- A new test sends puts through the same POST the drop handler uses. - Over quota: 413, error: "quota" with PUT_WORDS.quota as the message, and nothing listed afterwards. - Empty file: 422, error: "empty" with PUT_WORDS.empty, and nothing stored. - The data-attribute check stays and now also checks data-room. - The test does not run the script's drag-and-drop code or its pre-send checks (limit and remaining space); that would need a browser.

  • Looks (point 4): I can't take the screenshots from this sandbox. The preview at https://lab--13475--forge-trevato-apps.open-platform.sh will rebuild from this push, so it can be checked at both widths.
Approved

Round 2. Earlier asks: the dashed box is now a hairline row (design, principles 3/6/7: met); the 'drag onto this box' hint is written by script only, so with JavaScript off nothing promises a drag (met); docs/features/drop.md describes the drag, progress and refusals, README untouched (met); a test now covers refused puts (413 quota, 422 empty, nothing stored) (met). The preview answers 200 and the quota line is server-rendered. Two things I would do next, both non-blocking: (1) Non-blocking: the drag handlers are only string-checked; add a browser-level check at 390 and 1280 px when a screenshot path exists, since no look of the drop row was taken by the author. (2) Non-blocking: with several files dropped, progress reports one file at a time; a 'file 2 of 3' in the status line would orient a thumb-user on a slow phone connection. Keyboard and screen-reader path is intact: the file input and Send button are unchanged and the status line is role=status.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs