Skip to content

Removed legacy settings upload components#29541

Merged
9larsons merged 3 commits into
mainfrom
codex/admin-settings-shade-uploads
Jul 22, 2026
Merged

Removed legacy settings upload components#29541
9larsons merged 3 commits into
mainfrom
codex/admin-settings-shade-uploads

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What changed

  • added a reusable Shade image-upload pattern built on Dropzone
  • expanded Dropzone with filled and button variants plus input accessibility/test hooks
  • migrated Settings image and file uploads, pasted dropzones, and Pintura file inputs to Shade
  • removed the legacy design-system ImageUpload and FileUpload components
  • fixed custom-integration modal overflow with long API keys
  • restored persistent profile-upload and cover-action backgrounds via Shade inverse-surface tokens

Why

This is Group 8 of the admin settings Shade migration. Upload behavior was duplicated across Settings and still depended on legacy design-system components. Centralizing image preview, edit, remove, and drop behavior in Shade lets those legacy components be deleted while preserving the existing flows.

Validation

  • Settings lint and unit tests: 20 files / 206 tests
  • Shade lint, unit tests, and build: 24 files / 229 tests
  • Admin acceptance tests: 51 files / 372 tests
  • Admin design-system build, tests, and lint
  • dependency-boundary validation
  • Storybook build
  • manual validation across Settings upload flows, including staff profile/cover controls and custom integrations

no ref

Settings uploads now share Shade primitives and image-preview behavior, allowing the legacy design-system upload implementations and their duplicated consumers to be removed.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9e576bd5-c230-4b2f-b0c4-25aaf1abd8fc

📥 Commits

Reviewing files that changed from the base of the PR and between abd397b and 9dcda57.

📒 Files selected for processing (1)
  • apps/shade/src/components/patterns/image-upload.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/shade/src/components/patterns/image-upload.tsx

Walkthrough

The change removes the admin design-system’s legacy FileUpload and ImageUpload components and stories. Shade gains composable image-upload primitives, expanded Dropzone variants and input attributes, Storybook coverage, tests, and theme tokens. Settings upload flows are migrated to Dropzone, while image fields use preview, action, and dropzone compositions for upload, editing, and removal.

Possibly related PRs

  • TryGhost/Ghost#29200: Updates the same beta-features Redirects/Routes upload UI with an inline editor flow.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches a real part of the changeset by highlighting removal of the legacy upload components.
Description check ✅ Passed The description is clearly related to the PR and accurately summarizes the Shade migration and legacy component removal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/admin-settings-shade-uploads

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 22, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 122a3c2

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 6m 21s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-d... ✅ Succeeded 4m 56s View ↗
nx run ghost-admin:test ✅ Succeeded 3m 9s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 23s View ↗
nx run-many -t lint -p @tryghost/admin-x-design... ✅ Succeeded 2m 10s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 58s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 44s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-22 19:04:46 UTC

no ref

The compact upload actions now share Shade's secondary button recipe with their adjacent Edit actions, keeping their size and visual hierarchy consistent.
@9larsons
9larsons marked this pull request as ready for review July 22, 2026 18:43
@9larsons
9larsons enabled auto-merge (squash) July 22, 2026 18:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/admin-x-settings/src/components/settings/advanced/labs/migration-options.tsx (1)

16-42: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Disable each Dropzone while its operation is pending.

The loading labels do not prevent another selection/drop. This can enqueue duplicate imports or overwrite a concurrent redirects/routes upload.

  • apps/admin-x-settings/src/components/settings/advanced/labs/migration-options.tsx#L16-L42: pass disabled={uploading} to Dropzone.
  • apps/admin-x-settings/src/components/settings/advanced/migration-tools/universal-import-modal.tsx#L29-L57: pass disabled={uploading} to Dropzone.
  • apps/admin-x-settings/src/components/settings/advanced/labs/beta-features.tsx#L83-L102: pass disabled={redirectsUploading} to Dropzone.
  • apps/admin-x-settings/src/components/settings/advanced/labs/beta-features.tsx#L113-L132: pass disabled={routesUploading} to Dropzone.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/admin-x-settings/src/components/settings/advanced/labs/migration-options.tsx`
around lines 16 - 42, Disable each Dropzone while its corresponding upload is
pending by passing disabled={uploading} in migration-options.tsx and
universal-import-modal.tsx, disabled={redirectsUploading} for the redirects
Dropzone in beta-features.tsx, and disabled={routesUploading} for the routes
Dropzone in beta-features.tsx.
apps/admin-x-settings/src/components/settings/email-design/header-image-field.tsx (1)

13-19: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Missing error handling on image upload.

handleUpload has no try/catch, unlike every sibling implementation in this cohort (e.g. custom-integration-modal.tsx, global-settings.tsx, theme-setting.tsx, look-and-feel.tsx, user-detail-modal.tsx, seo-meta.tsx), which all wrap the uploadImage call and route failures through useHandleError. Here a rejected upload (bad file type, network failure) becomes an unhandled promise rejection with no toast/feedback to the user — the field just appears to do nothing.

🛠️ Proposed fix
+import {useHandleError} from '`@tryghost/admin-x-framework/hooks`';
+
 const HeaderImageField: React.FC<HeaderImageFieldProps> = ({value, onChange}) => {
     const {mutateAsync: uploadImage} = useUploadImage();
+    const handleError = useHandleError();

     const handleUpload = async (file: File) => {
-        const imageUrl = getImageUrl(await uploadImage({file}));
-        onChange(imageUrl);
+        try {
+            const imageUrl = getImageUrl(await uploadImage({file}));
+            onChange(imageUrl);
+        } catch (e) {
+            handleError(e);
+        }
     };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/admin-x-settings/src/components/settings/email-design/header-image-field.tsx`
around lines 13 - 19, Update HeaderImageField’s handleUpload to wrap the
uploadImage call and getImageUrl/onChange flow in try/catch, then route failures
through the existing useHandleError mechanism used by sibling components,
preserving the successful upload behavior and providing user feedback for
rejected uploads.
apps/admin-x-settings/src/components/settings/site/design-and-branding/global-settings.tsx (1)

1-1: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

Add image type restrictions to the remaining image dropzones.

ImageUploadDropzone spreads props through to Shade’s Dropzone, so the image upload dropzones can and should pass accept={{'image/*': [...]}} now instead of letting users drop files only to get a 415 after upload.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/admin-x-settings/src/components/settings/site/design-and-branding/global-settings.tsx`
at line 1, Update the remaining image upload dropzones in global-settings.tsx to
pass Shade Dropzone’s accept prop with an image/* restriction, using the
existing ImageUploadDropzone instances and preserving their current upload
behavior.
🧹 Nitpick comments (2)
apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-setting.tsx (1)

89-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Label not associated with the upload input.

FieldLabel has no htmlFor, so it isn't programmatically tied to the ImageUploadDropzone's file input (inputId={custom-${setting.key}}) — unlike header-image-field.tsx, which wires htmlFor to the matching inputId.

♿ Proposed fix
-            <FieldLabel>{humanizeSettingKey(setting.key)}</FieldLabel>
+            <FieldLabel htmlFor={`custom-${setting.key}`}>{humanizeSettingKey(setting.key)}</FieldLabel>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-setting.tsx`
around lines 89 - 109, The image setting’s FieldLabel is not associated with its
file input. In the `case 'image'` rendering within the settings component, set
`FieldLabel`’s `htmlFor` to the same `custom-${setting.key}` identifier used by
`ImageUploadDropzone`’s `inputId`, matching the pattern in
`header-image-field.tsx`.
apps/admin-x-settings/src/components/settings/advanced/integrations/custom-integration-modal.tsx (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add alt to the remaining ImageUploadImage previews.

ImageUploadImage defaults alt to an empty string unless passed explicitly, so these screens won’t announce raw src URLs. Provide a meaningful label, or an explicit empty alt only when the preview is decorative, at each site:

  • apps/admin-x-settings/src/components/settings/advanced/integrations/custom-integration-modal.tsx#L103
  • apps/admin-x-settings/src/components/settings/email/newsletters/newsletter-detail-modal.tsx#L303
  • apps/admin-x-settings/src/components/settings/general/seo-meta.tsx#L224 and #L279
  • apps/admin-x-settings/src/components/settings/general/user-detail-modal.tsx#L358
  • apps/admin-x-settings/src/components/settings/membership/portal/look-and-feel.tsx#L118
  • apps/admin-x-settings/src/components/settings/site/design-and-branding/global-settings.tsx#L182, #L212, and #L241
  • apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-setting.tsx#L95
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/admin-x-settings/src/components/settings/advanced/integrations/custom-integration-modal.tsx`
at line 1, Update every listed ImageUploadImage preview, including the instance
in custom-integration-modal.tsx and the corresponding instances in
newsletter-detail-modal.tsx, seo-meta.tsx, user-detail-modal.tsx,
look-and-feel.tsx, global-settings.tsx, and theme-setting.tsx, to pass an
explicit meaningful alt label or an empty alt value when the image is
decorative.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@apps/admin-x-settings/src/components/settings/advanced/labs/migration-options.tsx`:
- Around line 16-42: Disable each Dropzone while its corresponding upload is
pending by passing disabled={uploading} in migration-options.tsx and
universal-import-modal.tsx, disabled={redirectsUploading} for the redirects
Dropzone in beta-features.tsx, and disabled={routesUploading} for the routes
Dropzone in beta-features.tsx.

In
`@apps/admin-x-settings/src/components/settings/email-design/header-image-field.tsx`:
- Around line 13-19: Update HeaderImageField’s handleUpload to wrap the
uploadImage call and getImageUrl/onChange flow in try/catch, then route failures
through the existing useHandleError mechanism used by sibling components,
preserving the successful upload behavior and providing user feedback for
rejected uploads.

In
`@apps/admin-x-settings/src/components/settings/site/design-and-branding/global-settings.tsx`:
- Line 1: Update the remaining image upload dropzones in global-settings.tsx to
pass Shade Dropzone’s accept prop with an image/* restriction, using the
existing ImageUploadDropzone instances and preserving their current upload
behavior.

---

Nitpick comments:
In
`@apps/admin-x-settings/src/components/settings/advanced/integrations/custom-integration-modal.tsx`:
- Line 1: Update every listed ImageUploadImage preview, including the instance
in custom-integration-modal.tsx and the corresponding instances in
newsletter-detail-modal.tsx, seo-meta.tsx, user-detail-modal.tsx,
look-and-feel.tsx, global-settings.tsx, and theme-setting.tsx, to pass an
explicit meaningful alt label or an empty alt value when the image is
decorative.

In
`@apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-setting.tsx`:
- Around line 89-109: The image setting’s FieldLabel is not associated with its
file input. In the `case 'image'` rendering within the settings component, set
`FieldLabel`’s `htmlFor` to the same `custom-${setting.key}` identifier used by
`ImageUploadDropzone`’s `inputId`, matching the pattern in
`header-image-field.tsx`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd39759a-3692-4641-9083-d761c9d4525c

📥 Commits

Reviewing files that changed from the base of the PR and between bb14227 and abd397b.

📒 Files selected for processing (25)
  • apps/admin-x-design-system/src/global/form/file-upload.stories.tsx
  • apps/admin-x-design-system/src/global/form/file-upload.tsx
  • apps/admin-x-design-system/src/global/form/image-upload.stories.tsx
  • apps/admin-x-design-system/src/global/form/image-upload.tsx
  • apps/admin-x-design-system/src/index.ts
  • apps/admin-x-settings/src/components/settings/advanced/integrations/custom-integration-modal.tsx
  • apps/admin-x-settings/src/components/settings/advanced/integrations/pintura-modal.tsx
  • apps/admin-x-settings/src/components/settings/advanced/labs/beta-features.tsx
  • apps/admin-x-settings/src/components/settings/advanced/labs/migration-options.tsx
  • apps/admin-x-settings/src/components/settings/advanced/migration-tools/universal-import-modal.tsx
  • apps/admin-x-settings/src/components/settings/email-design/header-image-field.tsx
  • apps/admin-x-settings/src/components/settings/email/newsletters/newsletter-detail-modal.tsx
  • apps/admin-x-settings/src/components/settings/general/seo-meta.tsx
  • apps/admin-x-settings/src/components/settings/general/user-detail-modal.tsx
  • apps/admin-x-settings/src/components/settings/membership/portal/look-and-feel.tsx
  • apps/admin-x-settings/src/components/settings/site/design-and-branding/global-settings.tsx
  • apps/admin-x-settings/src/components/settings/site/design-and-branding/theme-setting.tsx
  • apps/admin-x-settings/src/components/settings/site/theme-modal.tsx
  • apps/shade/src/components/patterns/image-upload.stories.tsx
  • apps/shade/src/components/patterns/image-upload.tsx
  • apps/shade/src/components/ui/dropzone.stories.tsx
  • apps/shade/src/components/ui/dropzone.tsx
  • apps/shade/src/patterns.ts
  • apps/shade/tailwind.theme.css
  • apps/shade/test/unit/components/ui/dropzone.test.tsx
💤 Files with no reviewable changes (5)
  • apps/admin-x-design-system/src/global/form/image-upload.stories.tsx
  • apps/admin-x-design-system/src/global/form/file-upload.stories.tsx
  • apps/admin-x-design-system/src/global/form/image-upload.tsx
  • apps/admin-x-design-system/src/global/form/file-upload.tsx
  • apps/admin-x-design-system/src/index.ts

no ref

The Tailwind class order is now canonical so clean CI environments produce the same lint result as local development.
@9larsons
9larsons merged commit 35e8331 into main Jul 22, 2026
45 checks passed
@9larsons
9larsons deleted the codex/admin-settings-shade-uploads branch July 22, 2026 19:09
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.54%. Comparing base (bb14227) to head (9dcda57).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29541      +/-   ##
==========================================
- Coverage   74.75%   74.54%   -0.21%     
==========================================
  Files        1610     1609       -1     
  Lines      141605   141494     -111     
  Branches    17292    17269      -23     
==========================================
- Hits       105854   105479     -375     
- Misses      34680    34980     +300     
+ Partials     1071     1035      -36     
Flag Coverage Δ
admin-tests 55.62% <ø> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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