Skip to content

refactor: app category metadata to use Record<AppCategories, AppCategoryEntry> for exhaustive type safety#29558

Open
SinghaAnirban005 wants to merge 1 commit into
calcom:mainfrom
SinghaAnirban005:ref-apps
Open

refactor: app category metadata to use Record<AppCategories, AppCategoryEntry> for exhaustive type safety#29558
SinghaAnirban005 wants to merge 1 commit into
calcom:mainfrom
SinghaAnirban005:ref-apps

Conversation

@SinghaAnirban005

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR replaces the AppCategoryEntry[] array in getAppCategories with a
Record<AppCategories, AppCategoryEntry> as the canonical source of category metadata

and secondly removes the redundant icon mapping in installed-category-view.tsx

Video Demo (if applicable):

Screencast.from.2026-04-11.20-32-09.webm

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @SinghaAnirban005! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a centralized, typed configuration for app categories to standardize metadata across the codebase. packages/app-store/_utils/getAppCategories.ts now exports ActiveAppCategoryKeys (excluding video and web3), APP_CATEGORY_ENTRIES (a record mapping categories to icon and test-id values), and CATEGORY_ORDER (with compile-time exhaustiveness checks). The getAppCategories function was refactored to generate categories from this configuration instead of a hardcoded array. In apps/web/modules/apps/installed/[category]/installed-category-view.tsx, the empty-state handler now maps legacy categories to active ones via LEGACY_CATEGORY_MAP, resolves the effective variant through a typed helper, and fetches UI metadata from the centralized APP_CATEGORY_ENTRIES instead of local mappings, removing the previous hardcoded icon-name map.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main refactoring: replacing AppCategoryEntry[] with Record<AppCategories, AppCategoryEntry> for exhaustive type safety.
Description check ✅ Passed The description clearly explains the PR's purpose: replacing the array-based category metadata with a Record-based approach and removing redundant icon mapping.
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

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

🧹 Nitpick comments (1)
apps/web/modules/apps/installed/[category]/installed-category-view.tsx (1)

23-23: ⚡ Quick win

Use a type-only import for ActiveAppCategoryKeys (Line 23).

ActiveAppCategoryKeys is only used in type positions, so it should be imported with type to match repository TS rules.

Proposed fix
-import { APP_CATEGORY_ENTRIES, ActiveAppCategoryKeys } from "`@calcom/app-store/_utils/getAppCategories`";
+import { APP_CATEGORY_ENTRIES, type ActiveAppCategoryKeys } from "`@calcom/app-store/_utils/getAppCategories`";

As per coding guidelines: “Use import type { X } for TypeScript type imports”.

🤖 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/web/modules/apps/installed/`[category]/installed-category-view.tsx at
line 23, The import currently brings in ActiveAppCategoryKeys as a value; change
it to a type-only import by using the TypeScript `type` modifier — e.g. replace
the existing import of ActiveAppCategoryKeys with `type ActiveAppCategoryKeys`
(either inline: `import { APP_CATEGORY_ENTRIES, type ActiveAppCategoryKeys }
from "`@calcom/app-store/_utils/getAppCategories`";` or as a separate `import type
{ ActiveAppCategoryKeys } from "...";`) so the symbol is imported only for type
positions.

Source: Coding guidelines

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

Nitpick comments:
In `@apps/web/modules/apps/installed/`[category]/installed-category-view.tsx:
- Line 23: The import currently brings in ActiveAppCategoryKeys as a value;
change it to a type-only import by using the TypeScript `type` modifier — e.g.
replace the existing import of ActiveAppCategoryKeys with `type
ActiveAppCategoryKeys` (either inline: `import { APP_CATEGORY_ENTRIES, type
ActiveAppCategoryKeys } from "`@calcom/app-store/_utils/getAppCategories`";` or as
a separate `import type { ActiveAppCategoryKeys } from "...";`) so the symbol is
imported only for type positions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82924076-723c-4b7e-bfce-d75c37653323

📥 Commits

Reviewing files that changed from the base of the PR and between 9104545 and 962e644.

📒 Files selected for processing (2)
  • apps/web/modules/apps/installed/[category]/installed-category-view.tsx
  • packages/app-store/_utils/getAppCategories.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant