Skip to content

Redesign Image Source editor: hero preview + link-or-URL empty state#669

Merged
lucaslyl merged 4 commits into
mainfrom
eco-526-image-source-editor-ui-enhancement
Jul 23, 2026
Merged

Redesign Image Source editor: hero preview + link-or-URL empty state#669
lucaslyl merged 4 commits into
mainfrom
eco-526-image-source-editor-ui-enhancement

Conversation

@lucaslyl

Copy link
Copy Markdown
Contributor

linear: https://linear.app/cardstack/issue/ECO-526/image-source-field-editor-ui-enhancement-hero-link-or-url-redesign

Summary

Redesigns the shared fields/image-source edit UI and brings its styling into the catalog theming system. The data model is unchanged (url, file, sourceMode, resolvedUrl), so existing instances are unaffected.

Edit UI (replaces header + File/URL tabs + large dashed dropzone)

  • Empty state: a compact two-panel invitation — Add an image (soft accent icon tile + the standard linksTo Link Image button, which opens the card chooser with search and Create New ImageDef) | ○or○ | Add image URL (compact input with an Add suffix). Stacks to a single column in narrow hosts via container query.
  • With an image: a hero preview (object-fit: contain with minor padding) and a bordered ✕ remove button; removing clears both source references (the linked ImageDef itself is untouched) and returns to the empty state.
  • Picking a file via Link Image switches sourceMode to file (deferred to a microtask — render-time mutations are dropped by the renderer); adding a URL sets sourceMode to url.
  • All mutating handlers no-op when the contained field value is undefined (an unset contains() renders the editor with no model).

Theming

Every visual value resolves through three scopes: the --img-source-* family knob (shared with the upcoming Multi Image Source editor, so one override re-skins both) → semantic theme tokens (--card, --card-foreground, --border, --muted-foreground, --destructive, --font-sans) → boxel/literal fallbacks; resolved values live in --img-* aliases. The accent deliberately skips the app-global --primary (the boxel highlight green would otherwise take over every control) and --ring/--boxel-highlight are re-pointed locally so the input focus ring matches the accent.

Tests

image-source.test.gts rewritten from tab-based assertions to empty-state / hero / add-by-url / remove behaviors.

Testing

  • ember-template-lint + prettier clean
  • Catalog live tests: 124 tests — 70 pass / 54 skip / 0 fail (includes the 7 image-source tests)

Note for deploy

This field is imported by many listings; expect a large catalog-realm reindex fan-out when this lands.

The edit UI drops the header + File/URL tabs + large dashed dropzone in
favor of one surface with two moves:

- Empty: a two-panel invitation — "Add an image" (accent icon tile + the
  standard linksTo Link Image button) | or | "Add image URL" (compact
  input with an Add suffix). Stacks to one column in narrow hosts via
  container query.
- With an image: a hero preview (object-fit: contain with minor padding)
  and a bordered ✕ remove that returns to the empty state.
- Picking a file switches sourceMode to file (deferred to a microtask —
  render-time mutations are dropped); adding a URL sets sourceMode to url.
- All mutating handlers no-op when the contained field value is undefined
  (an unset contains() renders the editor with no model).

Styling now resolves through three scopes: the --img-source-* family knob
(shared with the Multi Image Source editor, so one override re-skins
both) → semantic theme tokens → boxel/literal fallbacks, with resolved
values in --img-* aliases. Accent deliberately skips the app-global
--primary, and --ring/--boxel-highlight are re-pointed locally so the
input focus ring matches the accent.

Tests rewritten from tab assertions to empty-state / hero / add-by-url /
remove behaviors.

Data model is unchanged (url, file, sourceMode, resolvedUrl).

linear: https://linear.app/cardstack/issue/ECO-526/image-source-field-editor-ui-enhancement-hero-link-or-url-redesign
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Staging Submissions Preview

This PR's content is pushed to the staging submissions realm: https://realms-staging.stack.cards/submissions/

Changed folders:

  • fields/

Updated at 2026-07-23 06:40:27 UTC for commit d7c1245. Shared realm: only this PR's changed files are pushed; files touched by multiple PRs reflect whichever pushed last, and deleted files are not removed.

@lucaslyl lucaslyl self-assigned this Jul 23, 2026
@lucaslyl
lucaslyl requested a review from a team July 23, 2026 04:36
…est selector

- The hero letterbox surface derives from the themed bg/text pair via
  color-mix instead of raw --boxel-100, so dark-themed hosts stay dark.
- adoptPickedFile's deferred mutation bails once the component is
  destroyed, and its comment now states the write-on-open self-heal for
  instances persisted as { file: set, sourceMode: 'url' }.
- The add-by-url test fills the input inside its own labeled group
  instead of "the only input in the editor".
@lucaslyl
lucaslyl force-pushed the eco-526-image-source-editor-ui-enhancement branch from bebe83b to 4d5966a Compare July 23, 2026 06:27
@lucaslyl
lucaslyl merged commit c254a69 into main Jul 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant