Skip to content

refactor: consistent prop names in the upload components - #868

Open
nabalone wants to merge 5 commits into
developfrom
upload-prop-renames
Open

nabalone wants to merge 5 commits into
developfrom
upload-prop-renames

Conversation

@nabalone

@nabalone nabalone commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Pure renames from the prop audit of #853: props that changed name from one component to the next without a reason now keep one name. No behavior change intended.

Renames

From To
metadata metaData
submitRef controlsRef
mediaUploadControlsRef controlsRef
onOpen onClose
onVisible onClose
visible isOpen
performedBy speaker
onSpeakerChange onSpeaker
filename defaultFilename
markdownValue inValue
resourceReady ready
resourceUploadValidationMessage validationMessage
resourcePendingRestore pendingRestore
projMedia media
projIdentity items
projCandidate candidateItems
isAudioMode isAddingAudioResource
addCategorySaveRef categorySaveRef
catCommitRef categorySaveRef
commitRef categorySaveRef
editCatCommitRef editCategorySaveRef
commit() saveCategory()
committingRef savingRef
onPassResChange onResourceKindChange
handlePassRes handleResourceKind

PassRes dates from when the choice was a passage-vs-section boolean; it now sets the three-way resourceKind.

Other cleanup

  • Removed the now-unneeded wrappers: handleUploadVisible (several screens), Uploader's handleSpeakerChange, and the one-line handlePassRes in PassageDetailArtifacts / PassageDetailsArtifactsMobile (they pass setResourceKind directly). The wizard's handleResourceKind stays because it also switches the upload type.
  • MediaUploadContent's onClose is optional, which drops the onVisible={() => {}} no-ops.
  • Uploader still passes a no-op onSpeaker when the caller gives none on a vernacular media upload, so the speaker picker and its rights gate still show (as the old handleSpeakerChange wrapper did).
  • Left as-is on purpose: BigDialog's onOpen, MediaRecord's performedBy (it's the mediafile record field) and SpeakerName's name / onChange.

Test plan

  • npm run typecheck
  • jest: related suites pass
  • Devin: 0 bugs / 0 flags; Copilot: no open issues
  • Smoke: Add Resource wizard (upload, record, general resource → sections → configure, close; new category; section/passage/general radio), Upload on Audio tab / passage record / ScriptureTable (speaker picker + rights gate), Import dialog, graphic picker upload tab, title upload, discussion card and resource overview category save

🤖 Generated with Claude Code

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟢 Approval recommended

The change is a non-behavioral refactor that standardizes uploader APIs (e.g., isOpen/onClose, controlsRef, metaData) across components and updates the affected unit tests and call sites accordingly, with no remaining issues noted in the review evidence.

No open issues 🎉

What changed in this PR

Refactors the web upload-related components and Add Resource wizard to use consistent prop and return-value naming across the “upload family,” with no intended behavior change.

Changes:

  • Standardizes close semantics to onClose(): void (replacing onOpen(false) / onVisible(false)) and renames MediaUploadDialog.visible to isOpen.
  • Unifies upload controls ref naming to controlsRef across uploaders, wizard deferred upload flow, and graphic picker/upload.
  • Renames GraphicUploader metadata to metaData and aligns useAddResourceWizard return names with the props they feed downstream.
File Description
web/​src/​utils/​useCompression.ts Updates the compression hook to use an onClose callback naming/shape consistent with the upload components.
web/​src/​components/​Uploader.tsx Renames visibility callback usage to onClose() and updates MediaUploadDialog integration to the isOpen/onClose API.
web/​src/​components/​TitleUploader.tsx Switches uploader close handling to onClose() and forwards it into MediaUploadContent consistently.
web/​src/​components/​TitleTabs.tsx Updates the TitleUploader call site to pass onClose instead of prior visibility callback patterns.
web/​src/​components/​Sheet/​ScriptureTable.tsx Removes now-unneeded visibility wrapper logic and closes the uploader via an onClose callback.
web/​src/​components/​ProvideRights.tsx Simplifies uploader visibility handling by replacing wrapper setters with an onClose callback.
web/​src/​components/​PassageRecordPanel.tsx Normalizes deferred upload ref naming to controlsRef and removes no-op visibility callback usage.
web/​src/​components/​PassageDetail/​PassageDetailRecord.tsx Refactors upload close wiring to use onClose and drops redundant visibility wrapper functions.
web/​src/​components/​PassageDetail/​PassageDetailItem.tsx Refactors upload close wiring to use onClose and removes redundant wrapper handlers.
web/​src/​components/​PassageDetail/​Internalization/​useAddResourceWizard.ts Renames wizard hook return fields/refs to match the downstream component prop names used by the Add Resource flow.
web/​src/​components/​PassageDetail/​Internalization/​ResourceUploadStep.tsx Renames isAudioMode to isAddingAudioResource and updates the step to use the standardized onClose callback pattern.
web/​src/​components/​PassageDetail/​Internalization/​ResourceUploadStep.test.tsx Updates tests to match renamed ResourceUploadStep props and the adjusted naming conventions.
web/​src/​components/​PassageDetail/​Internalization/​ProjectResourceConfigure.tsx Updates configure-step close plumbing to use the standardized onClose callback naming.
web/​src/​components/​PassageDetail/​Internalization/​AddResourceWizard.tsx Wires the renamed wizard return values through the wizard steps and configure flow to keep naming consistent end-to-end.
web/​src/​components/​PassageDetail/​Internalization/​AddResourceWizard.test.tsx Updates wizard tests/mocks to reflect the controlsRef and onClose renames and related prop/return-name changes.
web/​src/​components/​MediaUploadDialog.tsx Renames dialog props from visible/onVisible to isOpen/onClose and forwards the new API into the content layer.
web/​src/​components/​MediaUploadContent.tsx Updates content close handling to an optional onClose() callback and aligns internal cancel/close behavior to that API.
web/​src/​components/​ImportTab.tsx Updates the import flow to use MediaUploadDialog’s isOpen/onClose props.
web/​src/​components/​GraphicUploader.tsx Renames uploader props to metaData, controlsRef, and onClose to match the rest of the upload components and hook usage.
web/​src/​components/​GraphicPicker.tsx Aligns graphic picker upload wiring to use controlsRef, metaData, and onClose consistently.
web/​src/​components/​GraphicPicker.test.tsx Updates graphic picker tests to match the renamed GraphicUploader prop surface (metaData, controlsRef, onClose).
web/​src/​components/​AudioTab/​AudioTab.tsx Updates the audio tab uploader integration to close via the standardized onClose callback.

Review effort: Balanced

Base automatically changed from remove-dead-upload-code to develop November 12, 2026 18:04
nabalone and others added 4 commits November 12, 2026 18:36
Rename props that changed name hop-to-hop without reason: GraphicUploader's
metadata -> metaData; submitRef/mediaUploadControlsRef -> controlsRef;
onOpen/onVisible (only ever called with false) -> onClose across the upload
family and ProjectResourceConfigure, with MediaUploadDialog's visible -> isOpen.
useAddResourceWizard's return names now match the child props they feed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename Uploader's performedBy/onSpeakerChange to speaker/onSpeaker, the names
MediaUploadDialog, MediaUploadContent and the wizard already use. performedBy
stays only as the useMediaUpload record field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ref that saves a typed (possibly new) category at form submission was
catCommitRef / editCatCommitRef / commitRef depending on the hop. Use
categorySaveRef (editCategorySaveRef) throughout, and rename
SelectArtifactCategory's commit()/committingRef to saveCategory()/savingRef.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PassRes dates from when the choice was a passage-vs-section boolean; it now
sets the three-way resourceKind. Rename ResourceData's onPassResChange to
onResourceKindChange and the wizard's handlePassRes to handleResourceKind; the
artifact screens' handlePassRes was a bare wrapper, so pass setResourceKind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟢 Approval recommended

The change is a broad, consistent prop/ref renaming and wiring standardization across affected upload components with corresponding updates in dependent code and tests, and no active issues are indicated in the provided review evidence.

No open issues 🎉

Review effort: Balanced

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🔵 Needs a closer look

This change makes broad, user-critical refactors across multiple upload-related dialog flows via prop renames, so manual smoke testing is needed to ensure close-path behavior hasn’t regressed beyond what typechecking can catch.

No open issues 🎉

Review effort: Balanced

@nabalone
nabalone marked this pull request as ready for review November 13, 2026 01:08
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.

2 participants