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

opened this

Merged 20d 4h ago, live in production

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

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
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.

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.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs