Skip to content

Extract modal types, utils#81

Merged
imnasnainaec merged 6 commits into
mainfrom
modal-util
May 21, 2026
Merged

Extract modal types, utils#81
imnasnainaec merged 6 commits into
mainfrom
modal-util

Conversation

@imnasnainaec
Copy link
Copy Markdown
Contributor

@imnasnainaec imnasnainaec commented May 21, 2026

This change is Reviewable

Summary by CodeRabbit

  • Refactor
    • Reorganized project-related type definitions and validation utilities into dedicated modules for improved code structure and maintainability.
    • Extracted shared type definitions from components to a centralized types module to promote better code reusability across the application.
    • Updated internal imports across components to reflect the new module structure.

Review Change Stack

@imnasnainaec imnasnainaec self-assigned this May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Warning

Rate limit exceeded

@imnasnainaec has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1691c80d-194c-49aa-a9c1-d4772665584d

📥 Commits

Reviewing files that changed from the base of the PR and between 377420a and 9f567d8.

📒 Files selected for processing (11)
  • AGENTS.md
  • jest.config.ts
  • src/__tests__/components/CreateProjectModal.test.tsx
  • src/__tests__/components/ProjectModals.test.tsx
  • src/__tests__/components/SelectInterlinearProjectModal.test.tsx
  • src/components/CreateProjectModal.tsx
  • src/components/InterlinearizerLoader.tsx
  • src/components/ProjectModals.tsx
  • src/components/SelectInterlinearProjectModal.tsx
  • src/types/interlinear-project-summary.ts
  • src/utils/interlinear-project-summary.ts
📝 Walkthrough

Walkthrough

This PR refactors shared types and utilities out of the SelectInterlinearProjectModal component into dedicated modules. Two new files introduce InterlinearProjectSummary and ActiveProjectState types, plus an isInterlinearProjectSummary type guard. All components and tests update their imports to use the new locations, and the modal no longer exports those symbols.

Changes

Type and utility extraction

Layer / File(s) Summary
Extract types to dedicated type module
src/types/interlinear-project-summary.ts
New module exports InterlinearProjectSummary and ActiveProjectState as Pick-based types derived from InterlinearProject.
Extract type guard to dedicated utility module
src/utils/interlinear-project-summary.ts
New module exports isInterlinearProjectSummary type guard that validates required and optional fields of the InterlinearProjectSummary shape.
Refactor SelectInterlinearProjectModal to use extracted modules
src/components/SelectInterlinearProjectModal.tsx
Modal component now imports types and type guard from dedicated modules instead of defining them locally; removes exports of InterlinearProjectSummary, ActiveProjectState, and isInterlinearProjectSummary.
Update component imports to use new type and utility locations
src/components/CreateProjectModal.tsx, src/components/InterlinearizerLoader.tsx, src/components/ProjectModals.tsx
Components update imports to reference types/interlinear-project-summary and utils/interlinear-project-summary modules instead of importing from SelectInterlinearProjectModal.
Update test imports and remove stale mock
src/__tests__/components/CreateProjectModal.test.tsx, src/__tests__/components/ProjectModals.test.tsx, src/__tests__/components/SelectInterlinearProjectModal.test.tsx
Test files update import paths to the new type module; CreateProjectModal.test.tsx removes its outdated jest.mock setup.
Exclude new utility from coverage collection
jest.config.ts
Coverage configuration excludes the new src/utils/interlinear-project-summary.ts utility file and updates the comment.

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • sillsdev/interlinearizer-extension#62: Refactors SelectInterlinearProjectModal-introduced ActiveProjectState/InterlinearProjectSummary and isInterlinearProjectSummary into shared type and utility modules, directly supporting the modal refactor that added those types.

Suggested labels

🟨Medium

Suggested reviewers

  • alex-rawlings-yyc

Poem

🐰 A rabbit reorganizes with care,
Types to their own cozy lair,
Utilities tucked in a dedicated place,
Components now import with proper grace,
Refactoring done with nary a spare!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Extract modal types, utils' accurately describes the main change: extracting modal-related types and utilities from SelectInterlinearProjectModal into separate shared modules (types and utils directories).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch modal-util

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 and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

@imnasnainaec made 1 comment and resolved 1 discussion.
Reviewable status: 0 of 11 files reviewed, 1 unresolved discussion (waiting on alex-rawlings-yyc and imnasnainaec).


src/types/interlinear-project-summary.ts at r1 (raw file):
@alex-rawlings-yyc Was there a reason we defined both these types when they're the same?

@imnasnainaec imnasnainaec added the 🟪Idea Idea-priority PR: can be closed... label May 21, 2026
@alex-rawlings-yyc
Copy link
Copy Markdown
Contributor

src/types/interlinear-project-summary.ts at r1 (raw file):

Previously, imnasnainaec (D. Ror.) wrote…

@alex-rawlings-yyc Was there a reason we defined both these types when they're the same?

I think at one point they were different and I just didn't realize that they had converged. They can be collapsed

Copy link
Copy Markdown
Contributor

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Choose a reason for hiding this comment

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

@alex-rawlings-yyc reviewed 11 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@imnasnainaec imnasnainaec merged commit ac655ea into main May 21, 2026
8 checks passed
@imnasnainaec imnasnainaec deleted the modal-util branch May 21, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🟪Idea Idea-priority PR: can be closed...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants