Skip to content

Comments

chore: ln support for inbox constants#6432

Merged
prateekshourya29 merged 10 commits intofeat-language-supportfrom
chore-ln-inbox-constants
Jan 27, 2025
Merged

chore: ln support for inbox constants#6432
prateekshourya29 merged 10 commits intofeat-language-supportfrom
chore-ln-inbox-constants

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented Jan 20, 2025

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Added internationalization support for inbox issue statuses.
    • Enhanced inbox issue filtering and sorting capabilities.
    • Introduced new constants and types for inbox issue management.
    • Added a new InboxStatusIcon component for rendering status icons.
  • Improvements

    • Updated translation files for multiple languages (English, Spanish, French, Japanese, Chinese).
    • Improved type safety for sorting and filtering operations.
  • Bug Fixes

    • Cleaned up duplicate import statements.
  • Chores

    • Reorganized type and constant imports across multiple files.
    • Removed deprecated constants and type definitions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces comprehensive changes to the inbox issue management system across multiple packages. The modifications include defining new enumerations, types, and constants for inbox issues, enhancing internationalization support, and reorganizing type imports. The changes span constants, translations, components, and services, focusing on improving the structure, localization, and type safety of inbox-related functionality.

Changes

File Change Summary
packages/constants/src/inbox.ts Added new enums, types, and constants for inbox issues
packages/constants/src/index.ts Added export for inbox module
packages/i18n/src/locales/*/translations.json Added translations for inbox issue statuses, sources, and sorting options in multiple languages
packages/types/src/inbox.d.ts Removed some enums and updated type signatures
web/core/components/inbox/* Updated imports, added internationalization, modified icon rendering
web/core/constants/inbox.tsx Removed file with inbox-related constants

Sequence Diagram

sequenceDiagram
    participant UI as Inbox UI
    participant Constants as Inbox Constants
    participant I18n as Internationalization
    participant Store as Inbox Store

    UI->>Constants: Retrieve inbox issue statuses
    Constants-->>UI: Return status definitions
    UI->>I18n: Request translations
    I18n-->>UI: Provide localized labels
    UI->>Store: Fetch and manage inbox issues
    Store-->>UI: Return inbox issue data
Loading

Possibly related PRs

Suggested Labels

🌟improvement, 🧹chore, 🐛bug

Suggested Reviewers

  • sriramveeraghanta
  • rahulramesha

Poem

🐰 Inbox issues, now refined and bright,
Translations dancing with delight!
Constants and types, a rabbit's glee,
Internationalized functionality!
Code hops forward with elegant grace 🌈


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (8)
web/core/components/inbox/inbox-filter/applied-filters/status.tsx (1)

35-35: Enhance null safety for optional chaining.

While the code works, the optional chaining on optionDetail?.title could be more robust.

Consider adding a fallback:

- <div className="text-xs truncate">{t(optionDetail?.title)}</div>
+ <div className="text-xs truncate">
+   {optionDetail?.title ? t(optionDetail.title) : t('common.unknown_status')}
+ </div>
web/core/components/inbox/inbox-filter/filters/status.tsx (1)

58-58: Maintain consistency with applied filters component.

The translation implementation here should match the approach used in the applied filters component for consistency.

Consider applying the same null safety pattern:

- title={t(status.title)}
+ title={status.title ? t(status.title) : t('common.unknown_status')}
packages/constants/src/inbox.ts (2)

1-53: Consider using an enum for status keys.

The status keys are currently hardcoded strings. Consider using an enum to ensure type safety and prevent typos.

+export enum EInboxStatusKey {
+  PENDING = "pending",
+  DECLINED = "declined",
+  SNOOZED = "snoozed",
+  ACCEPTED = "accepted",
+  DUPLICATE = "duplicate"
+}

 export const INBOX_STATUS: {
-  key: string;
+  key: EInboxStatusKey;
   title: string;
   description: () => string;
   textColor: (snoozeDatePassed: boolean) => string;
   bgColor: (snoozeDatePassed: boolean) => string;
 }[] = [
   {
-    key: "pending",
+    key: EInboxStatusKey.PENDING,
     // ... rest of the code
   },
   // ... rest of the statuses
 ];

57-70: Consider using an enum for order by keys.

Similar to status keys, consider using an enum for order by options to ensure type safety.

+export enum EInboxIssueOrderByKey {
+  CREATED_AT = "issue__created_at",
+  UPDATED_AT = "issue__updated_at",
+  SEQUENCE_ID = "issue__sequence_id"
+}

 export const INBOX_ISSUE_ORDER_BY_OPTIONS = [
   {
-    key: "issue__created_at",
+    key: EInboxIssueOrderByKey.CREATED_AT,
     label: "inbox_issue.order_by.created_at",
   },
   // ... rest of the options
 ];
web/helpers/inbox.helper.ts (1)

78-84: Consider using type-safe icon mappings.

The icon mappings could benefit from stronger type safety.

+type TInboxStatusIconMap = {
+  [K in keyof typeof INBOX_STATUS_KEYS]: LucideIcon;
+};

-const INBOX_STATUS_ICONS = {
+const INBOX_STATUS_ICONS: TInboxStatusIconMap = {
   pending: AlertTriangle,
   declined: XCircle,
   snoozed: Clock,
   accepted: CheckCircle2,
   duplicate: Copy,
 };
packages/i18n/src/locales/en/translations.json (1)

352-357: Consider enhancing sort direction descriptions.

While the current translations are correct, consider adding more context to help users understand the sorting direction (e.g., "A to Z" for ascending, "Z to A" for descending).

   "common": {
     "sort": {
-      "asc": "Ascending",
-      "desc": "Descending"
+      "asc": "Ascending (A to Z)",
+      "desc": "Descending (Z to A)"
     }
   }
packages/i18n/src/locales/es/translations.json (1)

352-357: Consider using more natural Spanish terms for sorting.

While "Ascendente/Descendente" are correct, consider using more natural Spanish UI terms.

   "common": {
     "sort": {
-      "asc": "Ascendente",
-      "desc": "Descendente"
+      "asc": "De menor a mayor",
+      "desc": "De mayor a menor"
     }
   }
packages/i18n/src/locales/fr/translations.json (1)

352-357: Consider using more natural French terms for sorting.

While "Croissant/Décroissant" are technically correct, consider using more natural French UI terms.

   "common": {
     "sort": {
-      "asc": "Croissant",
-      "desc": "Décroissant"
+      "asc": "Du plus petit au plus grand",
+      "desc": "Du plus grand au plus petit"
     }
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22836ea and 7c714c7.

📒 Files selected for processing (16)
  • packages/constants/src/inbox.ts (1 hunks)
  • packages/constants/src/index.ts (1 hunks)
  • packages/i18n/src/locales/en/translations.json (1 hunks)
  • packages/i18n/src/locales/es/translations.json (1 hunks)
  • packages/i18n/src/locales/fr/translations.json (1 hunks)
  • packages/i18n/src/locales/ja/translations.json (1 hunks)
  • packages/i18n/src/locales/zh-CN/translations.json (1 hunks)
  • packages/types/src/inbox.d.ts (1 hunks)
  • web/core/components/inbox/inbox-filter/applied-filters/status.tsx (2 hunks)
  • web/core/components/inbox/inbox-filter/filters/status.tsx (3 hunks)
  • web/core/components/inbox/inbox-filter/sorting/order-by.tsx (5 hunks)
  • web/core/components/inbox/inbox-issue-status.tsx (3 hunks)
  • web/core/components/stickies/layout/stickies-list.tsx (1 hunks)
  • web/core/constants/empty-state.tsx (1 hunks)
  • web/core/constants/inbox.tsx (0 hunks)
  • web/helpers/inbox.helper.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • web/core/constants/inbox.tsx
✅ Files skipped from review due to trivial changes (3)
  • web/core/constants/empty-state.tsx
  • packages/types/src/inbox.d.ts
  • web/core/components/stickies/layout/stickies-list.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
packages/constants/src/index.ts (1)

17-17: LGTM! Export addition follows established pattern.

The new export for the inbox module is consistent with the existing export structure.

web/core/components/inbox/inbox-issue-status.tsx (1)

5-5: Verify translation key structure and fallbacks.

The translation implementation looks good, but consider adding fallback handling for missing translations to ensure graceful degradation.

Add a fallback mechanism:

- const { t } = useTranslation();
+ const { t } = useTranslation({
+   fallbackLng: 'en',
+   returnNull: false,
+ });

Also applies to: 8-8, 20-20

web/core/components/inbox/inbox-filter/sorting/order-by.tsx (1)

6-8: Great improvements to the component!

The changes enhance the component by:

  1. Adding proper type safety through type casting
  2. Implementing internationalization support
  3. Using centralized constants for better maintainability

Also applies to: 19-19, 37-37, 52-52, 54-54, 63-63, 65-65

packages/i18n/src/locales/zh-CN/translations.json (1)

319-356: Well-structured translations for inbox functionality!

The translations are comprehensive and properly organized, covering all necessary strings for inbox statuses, sources, and sorting options.

packages/i18n/src/locales/ja/translations.json (2)

320-351: LGTM: Inbox issue translations are well-structured and accurate.

The Japanese translations for inbox issues are semantically correct and maintain proper hierarchy. The translations accurately convey the meaning of each status, source, and sorting option.


352-357: LGTM: Common sorting translations are consistent.

The Japanese translations for common sorting options (昇順/降順) are accurate and commonly used terms in Japanese UIs.

packages/i18n/src/locales/en/translations.json (1)

320-351: LGTM: Base English translations are clear and well-structured.

The English translations serve as a good reference for other languages, with clear and concise terms for each status, source, and sorting option.

packages/i18n/src/locales/es/translations.json (1)

320-351: LGTM: Spanish translations are accurate and well-structured.

The Spanish translations for inbox issues maintain proper semantic meaning and use commonly accepted terms in Spanish UIs.

packages/i18n/src/locales/fr/translations.json (1)

320-351: LGTM: French translations are accurate and well-structured.

The French translations for inbox issues maintain proper semantic meaning and use commonly accepted terms in French UIs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
web/core/components/inbox/inbox-issue-status.tsx (1)

43-43: Consider extracting the conditional rendering logic.

The ternary operation could be made more readable by extracting it into a separate function or variable.

+ const getStatusText = (status: number, snoozedTill: string | null, description: string, title: string) => {
+   return status === 0 && snoozedTill ? description : title;
+ };

- {inboxIssue?.status === 0 && inboxIssue?.snoozed_till ? description : t(inboxIssueStatusDetail.title)}
+ {getStatusText(inboxIssue?.status, inboxIssue?.snoozed_till, description, t(inboxIssueStatusDetail.title))}
web/helpers/inbox.helper.ts (1)

86-92: Consider using an enum map for type safety.

The status keys mapping could be more type-safe by using a mapped type from the enum.

- const INBOX_STATUS_KEYS = {
-   pending: EInboxIssueStatus.PENDING,
-   declined: EInboxIssueStatus.DECLINED,
-   snoozed: EInboxIssueStatus.SNOOZED,
-   accepted: EInboxIssueStatus.ACCEPTED,
-   duplicate: EInboxIssueStatus.DUPLICATE,
- };
+ const INBOX_STATUS_KEYS: Record<keyof typeof INBOX_STATUS_ICONS, EInboxIssueStatus> = {
+   pending: EInboxIssueStatus.PENDING,
+   declined: EInboxIssueStatus.DECLINED,
+   snoozed: EInboxIssueStatus.SNOOZED,
+   accepted: EInboxIssueStatus.ACCEPTED,
+   duplicate: EInboxIssueStatus.DUPLICATE,
+ };
packages/i18n/src/locales/en/translations.json (1)

320-357: Well implemented pluralization for English translations.

The English translations correctly handle pluralization for the "days to go" message using the ICU message format.

Consider adding a zero case for better user experience:

- "description": "{days, plural, one{# day} other{# days}} to go"
+ "description": "{days, plural, =0{Today} one{# day} other{# days}} to go"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c714c7 and 38aa93e.

📒 Files selected for processing (7)
  • packages/i18n/src/locales/en/translations.json (1 hunks)
  • packages/i18n/src/locales/es/translations.json (1 hunks)
  • packages/i18n/src/locales/fr/translations.json (1 hunks)
  • packages/i18n/src/locales/ja/translations.json (1 hunks)
  • packages/i18n/src/locales/zh-CN/translations.json (1 hunks)
  • web/core/components/inbox/inbox-issue-status.tsx (3 hunks)
  • web/helpers/inbox.helper.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (9)
web/core/components/inbox/inbox-issue-status.tsx (2)

5-5: LGTM! Good refactoring of imports.

The reorganization of imports improves code organization by:

  • Moving INBOX_STATUS to a dedicated helper file
  • Adding proper i18n support
  • Including a specialized date-time helper

Also applies to: 7-7, 9-9


28-30: Well implemented translation with interpolation.

The translation implementation correctly handles dynamic content by using interpolation for the days value, which is better than string concatenation.

web/helpers/inbox.helper.ts (2)

78-84: LGTM! Well-organized icon mappings.

The icon mappings are well-structured and provide a centralized way to manage icons for different inbox statuses.


94-106: LGTM! Well-typed status configuration.

The INBOX_STATUS type definition and mapping provide good type safety and maintainability.

packages/i18n/src/locales/zh-CN/translations.json (1)

319-356: LGTM! Well-structured Chinese translations.

The translations are well-organized and maintain consistency with other language files.

packages/i18n/src/locales/ja/translations.json (1)

319-357: LGTM! Well-structured Japanese translations.

The translations are accurate and maintain consistency with other language files.

packages/i18n/src/locales/es/translations.json (1)

319-357: Well-structured translations with proper localization practices!

The Spanish translations for inbox functionality are well-implemented with:

  • Proper handling of pluralization in the "snoozed" status description
  • Consistent terminology throughout the translations
  • Natural and grammatically correct Spanish language usage
packages/i18n/src/locales/fr/translations.json (2)

319-357: Well-implemented French translations with proper localization practices!

The French translations for inbox functionality are well-implemented with:

  • Proper handling of pluralization in the "snoozed" status description
  • Consistent terminology throughout the translations
  • Natural and grammatically correct French language usage

319-357: Excellent implementation of internationalization across both files!

The implementation demonstrates high-quality localization practices across both Spanish and French translations:

  • Consistent structure and naming conventions between language files
  • Proper handling of pluralization rules for each language
  • Natural language usage specific to each locale
  • Complete coverage of all required translations

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Color is not getting applied to this icon

Copy link
Member

Choose a reason for hiding this comment

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

@gakshita is this a bug?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
packages/types/src/inbox.d.ts (2)

Line range hint 13-13: Import missing for TInboxIssueStatus

The type TInboxIssueStatus is referenced in TInboxIssueFilter but is neither defined in this file nor imported. Please import TInboxIssueStatus from its new location to ensure type correctness.

Apply this diff to fix the issue:

+import { TInboxIssueStatus } from "@plane/constants/src/inbox";

Line range hint 41-41: Import missing for TInboxIssue

The type TInboxIssue is used in TInboxIssueWithPagination but is not imported or defined in this file. Ensure that TInboxIssue is properly imported from its new location.

Apply this diff to fix the issue:

+import { TInboxIssue } from "@plane/constants/src/inbox";
🧹 Nitpick comments (3)
packages/constants/src/inbox.ts (2)

41-41: Simplify the description functions by removing unnecessary template literals

The description functions are returning string literals without any variable interpolation. Replacing the template literals with regular string literals improves readability.

Apply this diff to simplify the code:

- description: () => `inbox_issue.status.pending.description`,
+ description: () => 'inbox_issue.status.pending.description',

Repeat this change for the description functions in all statuses.

Also applies to: 51-51, 61-61, 71-71, 81-81


22-22: Use optional property syntax for properties that can be undefined

In TypeScript, it's idiomatic to declare properties that may be absent using the optional property syntax (?). This enhances code clarity and type safety.

Apply this diff to update the type definitions:

- duplicate_to: string | undefined;
+ duplicate_to?: string;

- duplicate_issue_detail: TInboxDuplicateIssueDetails | undefined;
+ duplicate_issue_detail?: TInboxDuplicateIssueDetails;

Also applies to: 26-26

web/core/components/inbox/inbox-issue-status.tsx (1)

42-42: Consider improving readability.

The conditional rendering logic could be more readable. Consider extracting the condition and message selection into a separate function.

+ const getStatusMessage = () => {
+   if (inboxIssue?.status === 0 && inboxIssue?.snoozed_till) {
+     return description;
+   }
+   return t(inboxIssueStatusDetail.title);
+ };

  <div className="flex items-center gap-1">
    <InboxStatusIcon type={inboxIssue?.status} size={iconSize} className="flex-shrink-0" />
    <div className="font-medium text-xs whitespace-nowrap">
-     {inboxIssue?.status === 0 && inboxIssue?.snoozed_till ? description : t(inboxIssueStatusDetail.title)}
+     {getStatusMessage()}
    </div>
  </div>

Also applies to: 44-44

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38aa93e and 593255d.

📒 Files selected for processing (10)
  • packages/constants/src/inbox.ts (1 hunks)
  • packages/types/src/inbox.d.ts (1 hunks)
  • web/core/components/inbox/inbox-filter/applied-filters/status.tsx (2 hunks)
  • web/core/components/inbox/inbox-filter/filters/status.tsx (3 hunks)
  • web/core/components/inbox/inbox-issue-status.tsx (3 hunks)
  • web/core/components/inbox/inbox-status-icon.tsx (1 hunks)
  • web/core/components/inbox/sidebar/root.tsx (1 hunks)
  • web/core/services/inbox/inbox-issue.service.ts (1 hunks)
  • web/core/store/inbox/inbox-issue.store.ts (1 hunks)
  • web/core/store/inbox/project-inbox.store.ts (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • web/core/components/inbox/sidebar/root.tsx
  • web/core/store/inbox/project-inbox.store.ts
  • web/core/services/inbox/inbox-issue.service.ts
  • web/core/store/inbox/inbox-issue.store.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/core/components/inbox/inbox-filter/applied-filters/status.tsx
  • web/core/components/inbox/inbox-filter/filters/status.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (4)
web/core/components/inbox/inbox-issue-status.tsx (3)

5-6: LGTM! Well-organized imports.

The imports are properly structured, with clear separation between constants, helpers, and components. The migration to @plane/constants and addition of i18n support aligns well with the PR objectives.

Also applies to: 8-8, 11-11


21-22: LGTM! Proper translation hook setup.

The translation hook is correctly initialized and follows React best practices.


29-31: LGTM! Well-implemented translation with dynamic content.

The description handling correctly uses translation interpolation with named parameters and separates date calculation logic into a helper function.

packages/types/src/inbox.d.ts (1)

24-24: LGTM: Simplified union type definition

The consolidation of TInboxIssueSortingOrderByKeys into a single line enhances code readability and maintains consistency.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
packages/constants/src/inbox.ts (5)

8-14: Consider using string literals for enum values.

The numeric values in EInboxIssueStatus (-2 to 2) are not self-documenting. Consider using string literals to make the code more maintainable and easier to debug.

 export enum EInboxIssueStatus {
-  PENDING = -2,
-  DECLINED = -1,
-  SNOOZED = 0,
-  ACCEPTED = 1,
-  DUPLICATE = 2,
+  PENDING = "PENDING",
+  DECLINED = "DECLINED",
+  SNOOZED = "SNOOZED",
+  ACCEPTED = "ACCEPTED",
+  DUPLICATE = "DUPLICATE",
 }

16-17: Consider removing redundant type aliases.

These type aliases don't provide additional type safety or documentation. They simply mirror the enums and could be removed to reduce code complexity.


18-27: Add JSDoc comments to document the type.

The TInboxIssue type would benefit from documentation explaining:

  • The purpose of each field
  • Why some fields are optional (undefined)
  • The relationship between duplicate_to and duplicate_issue_detail

Example:

/**
 * Represents an inbox issue in the system.
 */
export type TInboxIssue = {
  /** Unique identifier for the inbox issue */
  id: string;
  /** Current status of the inbox issue */
  status: TInboxIssueStatus;
  /** Date until which the issue is snoozed, null if not snoozed */
  snoozed_till: Date | null;
  /** Reference to the original issue if this is marked as duplicate */
  duplicate_to: string | undefined;
  /** Source of the inbox issue */
  source: string;
  /** The actual issue details */
  issue: TIssue;
  /** User who created the inbox issue */
  created_by: string;
  /** Details of the original issue if this is marked as duplicate */
  duplicate_issue_detail: TInboxDuplicateIssueDetails | undefined;
};

41-41: Simplify i18n_description functions.

The i18n_description functions are unnecessarily wrapping string literals. They can be simplified to string properties.

-    i18n_description: () => `inbox_issue.status.pending.description`,
+    i18n_description: "inbox_issue.status.pending.description",

Also applies to: 51-51, 61-61, 71-71, 81-81


89-113: Add type safety for order and sort options.

Consider adding TypeScript types to ensure type safety for the option keys.

type OrderByKey = "issue__created_at" | "issue__updated_at" | "issue__sequence_id";
type SortByKey = "asc" | "desc";

interface OrderByOption {
  key: OrderByKey;
  i18n_label: string;
}

interface SortByOption {
  key: SortByKey;
  i18n_label: string;
}

export const INBOX_ISSUE_ORDER_BY_OPTIONS: OrderByOption[] = [
  // ... existing options
];

export const INBOX_ISSUE_SORT_BY_OPTIONS: SortByOption[] = [
  // ... existing options
];
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 593255d and 3b0db1b.

📒 Files selected for processing (5)
  • packages/constants/src/inbox.ts (1 hunks)
  • web/core/components/inbox/inbox-filter/applied-filters/status.tsx (2 hunks)
  • web/core/components/inbox/inbox-filter/filters/status.tsx (3 hunks)
  • web/core/components/inbox/inbox-filter/sorting/order-by.tsx (5 hunks)
  • web/core/components/inbox/inbox-issue-status.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • web/core/components/inbox/inbox-issue-status.tsx
  • web/core/components/inbox/inbox-filter/sorting/order-by.tsx
  • web/core/components/inbox/inbox-filter/filters/status.tsx
  • web/core/components/inbox/inbox-filter/applied-filters/status.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)

@prateekshourya29 prateekshourya29 changed the base branch from preview to feat-language-support January 27, 2025 11:36
@prateekshourya29 prateekshourya29 merged commit eaf8ce0 into feat-language-support Jan 27, 2025
3 of 4 checks passed
@prateekshourya29 prateekshourya29 deleted the chore-ln-inbox-constants branch January 27, 2025 14:17
sriramveeraghanta added a commit that referenced this pull request Feb 6, 2025
* chore: ln support modules constants

* fix: translation key

* chore: empty state refactor (#6404)

* chore: asset path helper hook added

* chore: detailed and simple empty state component added

* chore: section empty state component added

* chore: language translation for all empty states

* chore: new empty state implementation

* improvement: add more translations

* improvement: user permissions and workspace draft empty state

* chore: update translation structure

* chore: inbox empty states

* chore: disabled project features empty state

* chore: active cycle progress empty state

* chore: notification empty state

* chore: connections translation

* chore: issue comment, relation, bulk delete, and command k empty state translation

* chore: project pages empty state and translations

* chore: project module and view related empty state

* chore: remove project draft related empty state

* chore: project cycle, views and archived issues empty state

* chore: project cycles related empty state

* chore: project settings empty state

* chore: profile issue and acitivity empty state

* chore: workspace settings realted constants

* chore: stickies and home widgets empty state

* chore: remove all reference to deprecated empty state component and constnats

* chore: add support to ignore theme in resolved asset path hook

* chore: minor updates

* fix: build errors

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>

* fix: language support fo profile (#6461)

* fix: ln support fo profile

* fix: merge changes

* fix: merge changes

* [WEB-3165]feat: language support for issues (#6452)

* * chore: moved issue constants to packages
* chore: restructured issue constants
* improvement: added translations to issue constants

* chore: updated translation structure

* * chore: updated chinese, spanish and french translation
* chore: updated translation for issues mobile header

* chore: updated spanish translation

* chore: removed translation for issue priorities

* fix: build errors

* chore: minor updates

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: migrated filters.ts to packages (#6459)

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: workspace drafts constant moved to plane constant package

* feat: home language support without stickies (#6443)

* feat: home language support without stickies

* fix: home sidebar

* fix: added missing keys

* fix: show all btn

* fix: recents empty state

* chore: translation update

* feat: workspace constant language support and refactor (#6462)

* chore: workspace constant language support and refactor

* chore: workspace constant language support and refactor

* chore: code refactor

* chore: code refactor

* merge conflict

* chore: code refactor

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: tab indices constant moved to plane package (#6464)

* chore: notification language support and refactor

* chore: ln support for inbox constants (#6432)

* chore: ln support for inbox constants

* fix: snooze duration

* fix: enum

* fix: translation keys

* fix: inbox status icon

* fix: status icon

* fix: naming

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* fix: ln support for views constants (#6431)

* fix: ln support for views constants

* fix: added translation

* fix: translation keys

* fix: access

* chore: code refactor

* chore: ln support workspace projects constants (#6429)

* chore: ln support workspace projects constants

* fix: translation key

* fix: removed state translation

* fix: removed state translation

* fi: added translations

* Chore: theme language support and refactor (#6465)

* chore: themes language support and refactor

* chore: theme language support and refactor

* fix

* [WEB-3173] chore: language support for cycles constant file (#6415)

* chore: ln support for cycles constant file

* fix: added chinese

* fix: lint

* fix: translation key

* fix: build errors

* minor updates

* chore: minor translation update

* chore: minor translation update

* refactor: move labels contants to packages

* refactor: move swr, file and error related constants to packages

* chore: timezones constant moved to plane package

* chore: metadata constant code refactor

* chore: code refactor

* fix: dashboard constants moved

* chore: code refactor (#6478)

* refactor: spreadsheet constants

* chore: drafts language support (#6485)

* chore: workspace drafts language support

* chore: code refactor

* feat: ln support for notifications (#6486)

* feat: ln support for notifications

* fix: translations

* * refactor: moved page constants to packages (#6480)

* fix: removed use-client

* chore: removed unnecessary commnets

* chore: workspace draft language support (#6490)

* chore: workspace drafts language support

* chore: code refactor

* chore: draft language support

* Feat constant event tracker (#6479)

* fix: event tracjer constants

* fix: constants event tracker

* feat: language translation  - projects list (#6493)

* feat: added translation to projects list page

* chore: restructured translation file

* chore: module language support (#6499)

* chore: module language support added

* chore: code refactor

* chore: workspace views language support (#6492)

* chore: workspace views language support

* chore: code refactor

* feat: custom analytics language support (#6494)

* feat: custom analytics language support

* fix: key

* fix: refactoring

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: minor improvements

* feat: language support for intake (#6498)

* feat: language support for intake

* fix: key name

* refactor: authentications related translations

* feat: language support issues  (#6501)

* enhancement: added translations for issue list view

* chore: added translations for issue detail widgets

* chore: added missing translations

* chore: modified issue to work items

* chore: updated translations

* Feat: workspace settings language support (#6508)

* feat: language support for workspace settings

* fix: lint

* fix: export title

* chore project settings language support (#6502)

* chore: project settings language support

* chore: code refactor

* refactor: workspace creation related translations

* chore: renamed issues to work items

* fix: build errors

* fix: lint

* chore: modified translations

* chore: remove duplicate

* improvement: french translation

* chore: chinese translation improvement

* fix: japanese translations

* chore: added spanish translation

* minor improvements

* fix: miscelleous language translations

* fix: clear_all key

* fix: moved user permission constants (#6516)

* feat: language support for  issues (#6513)

* chore: added language support to issue detail widgets

* improvement: added translation for issue detail

* enhancement: added language trasnlation to issue layouts

* chore: translation improvement (#6518)

* feat: language support description (#6519)

* enhancement: added language support for description

* fix: updated keys

* chore: renamed issue to work item (#6522)

* chore: replace missing issue occurances to work items

* fix: build errors

* minor improvements

* fix: profile links

* Feat ln cycles (#6528)

* feat: added language support for cycles

* feat: added language support for cycles

* chore: added core.json

* fix: translation keys

* fix: translation keys (#6530)

* fix: changed sidebar keys

* fix: removed extras

* fix: updated keys

* chore: optimize translation imports

* fix: updated keys (#6534)

* fix: updated keys

* fix-sub work items toasts

* chore: add missing translation and minor fixes

* chore: code refactor

* fix: language support keys (#6553)

* minor improvements

* minor fixes

* fix: remove lucide import from constants package

* chore: regenerate all translations

* chore: addded chinese and japanese translation files

* chore: remove all  from translations

* fix: added member

* fix: language support keys (#6558)

* fix: renamed keys

* fix: space app

* chore: renamed issues to work items

* chore: update site manifest

* chore: updated translations

* fix: lang keys

* chore: update translations

---------

Co-authored-by: gakshita <akshitagoyal1516@gmail.com>
Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Akshita Goyal <36129505+gakshita@users.noreply.github.com>
Co-authored-by: Vamsi Krishna <46787868+mathalav55@users.noreply.github.com>
Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
Co-authored-by: Vamsi krishna <matalav55@gmail.com>
Co-authored-by: Vamsi Krishna <46787868+vamsikrishnamathala@users.noreply.github.com>
aaryan610 added a commit that referenced this pull request Apr 9, 2025
* chore: ln support modules constants

* fix: translation key

* chore: empty state refactor (#6404)

* chore: asset path helper hook added

* chore: detailed and simple empty state component added

* chore: section empty state component added

* chore: language translation for all empty states

* chore: new empty state implementation

* improvement: add more translations

* improvement: user permissions and workspace draft empty state

* chore: update translation structure

* chore: inbox empty states

* chore: disabled project features empty state

* chore: active cycle progress empty state

* chore: notification empty state

* chore: connections translation

* chore: issue comment, relation, bulk delete, and command k empty state translation

* chore: project pages empty state and translations

* chore: project module and view related empty state

* chore: remove project draft related empty state

* chore: project cycle, views and archived issues empty state

* chore: project cycles related empty state

* chore: project settings empty state

* chore: profile issue and acitivity empty state

* chore: workspace settings realted constants

* chore: stickies and home widgets empty state

* chore: remove all reference to deprecated empty state component and constnats

* chore: add support to ignore theme in resolved asset path hook

* chore: minor updates

* fix: build errors

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>

* feat: extended language translations support

* fix: language support fo profile (#6461)

* fix: ln support fo profile

* fix: merge changes

* fix: merge changes

* [WEB-3137] refactor: empty states and add language support (#2235)

* chore: asset path helper hook added

* chore: detailed and simple empty state component added

* chore: section empty state component added

* chore: language translation for all empty states

* chore: new empty state implementation

* improvement: add more translations

* improvement: user permissions and workspace draft empty state

* chore: update translation structure

* chore: inbox empty states

* chore: disabled project features empty state

* chore: active cycle progress empty state

* chore: notification empty state

* chore: connections translation

* chore: issue comment, relation, bulk delete, and command k empty state translation

* chore: project pages empty state and translations

* chore: project module and view related empty state

* chore: remove project draft related empty state

* chore: project cycle, views and archived issues empty state

* chore: project cycles related empty state

* chore: project settings empty state

* chore: profile issue and acitivity empty state

* chore: workspace settings realted constants

* chore: stickies and home widgets empty state

* chore: remove all reference to deprecated empty state component and constnats

* chore: team related empty states refactor and translation

* chore: initiatives related empty states refactor and translation

* chore: workspace pages related empty states refactor and translation

* chore: epics related empty states refactor and translation

* chore: workspace and project cycles related empty states refactor and translation

* chore: command modal related empty states refactor and translation

* chore: projects related empty states refactor and translation

* chore: seperate out enterprise translations

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>

* [WEB-3165]feat: language support for issues (#6452)

* * chore: moved issue constants to packages
* chore: restructured issue constants
* improvement: added translations to issue constants

* chore: updated translation structure

* * chore: updated chinese, spanish and french translation
* chore: updated translation for issues mobile header

* chore: updated spanish translation

* chore: removed translation for issue priorities

* fix: build errors

* chore: minor updates

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: migrated filters.ts to packages (#6459)

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: workspace drafts constant moved to plane constant package

* feat: home language support without stickies (#6443)

* feat: home language support without stickies

* fix: home sidebar

* fix: added missing keys

* fix: show all btn

* fix: recents empty state

* chore: translation update

* feat: workspace constant language support and refactor (#6462)

* chore: workspace constant language support and refactor

* chore: workspace constant language support and refactor

* chore: code refactor

* chore: code refactor

* merge conflict

* chore: code refactor

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: tab indices constant moved to plane package (#6464)

* chore: notification language support and refactor

* [WEB-3165]feat:language support for issues. (#2282)

* * chore: moved issue constants to packages
* chore: restructured issue constants
* improvement: added translations to issue constants

* chore: updated translation structure

* * chore: updated chinese, spanish and french translation
* chore: updated translation for issues mobile header

* * chore: updated imports for constants
* improvemnt: added new translations

* chore: updated spanish translation

* chore: removed translation for issue priorities

* chore: minor updates

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: filters migration to packages (#2298)

* chore: migrated filter.ts to packages

* core: updated filter.ts imports to packages

* chore: added missing translation keys

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: ln support for inbox constants (#6432)

* chore: ln support for inbox constants

* fix: snooze duration

* fix: enum

* fix: translation keys

* fix: inbox status icon

* fix: status icon

* fix: naming

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* fix: ln support for views constants (#6431)

* fix: ln support for views constants

* fix: added translation

* fix: translation keys

* fix: access

* chore: code refactor

* feat: workspace constant language support and code refactor (#2305)

* chore: code refactor

* fix: workspace settings order

* chore: code refactor

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: ln support workspace projects constants (#6429)

* chore: ln support workspace projects constants

* fix: translation key

* fix: removed state translation

* fix: removed state translation

* fi: added translations

* Chore: theme language support and refactor (#6465)

* chore: themes language support and refactor

* chore: theme language support and refactor

* fix

* [WEB-3173] chore: language support for cycles constant file (#6415)

* chore: ln support for cycles constant file

* fix: added chinese

* fix: lint

* fix: translation key

* fix: build errors

* fix: build errors

* minor updates

* chore: english extended translations

* chore: minor translation update

* chore: minor translation update

* chore: minor translation update

* refactor: move labels contants to packages

* refactor: move swr, file and error related constants to packages

* chore: timezones constant moved to plane package

* chore: metadata constant code refactor

* chore: code refactor

* fix: dashboard constants moved

* chore: code refactor (#6478)

* refactor: spreadsheet constants

* chore: drafts language support (#6485)

* chore: workspace drafts language support

* chore: code refactor

* feat: ln support for notifications (#6486)

* feat: ln support for notifications

* fix: translations

* * refactor: moved page constants to packages (#6480)

* fix: removed use-client

* chore: removed unnecessary commnets

* chore: workspace draft language support (#6490)

* chore: workspace drafts language support

* chore: code refactor

* chore: draft language support

* Feat constant event tracker (#6479)

* fix: event tracjer constants

* fix: constants event tracker

* feat: language translation  - projects list (#6493)

* feat: added translation to projects list page

* chore: restructured translation file

* chore: module language support (#6499)

* chore: module language support added

* chore: code refactor

* chore: workspace views language support (#6492)

* chore: workspace views language support

* chore: code refactor

* feat: custom analytics language support (#6494)

* feat: custom analytics language support

* fix: key

* fix: refactoring

---------

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* fix: build errors

* chore: minor improvements

* feat: language support for intake (#6498)

* feat: language support for intake

* fix: key name

* refactor: authentications related translations

* feat: language support issues  (#6501)

* enhancement: added translations for issue list view

* chore: added translations for issue detail widgets

* chore: added missing translations

* chore: modified issue to work items

* chore: updated translations

* Feat: workspace settings language support (#6508)

* feat: language support for workspace settings

* fix: lint

* fix: export title

* chore project settings language support (#6502)

* chore: project settings language support

* chore: code refactor

* refactor: workspace creation related translations

* chore: renamed issues to work items

* fix: build errors

* fix: lint

* chore: modified translations

* chore: remove duplicate

* improvement: french translation

* chore: chinese translation improvement

* fix: japanese translations

* chore: added spanish translation

* add missing translations

* minor improvements

* add missing translations and build fixes

* fix: miscelleous language translations

* refactor: move all issue types related types, constants and helpers to packages (#2345)

* refactor: move all issue types related types, constants and helpers to packages

* remove unused imports

* fix: clear_all key

* chore: initiatives language support (#2341)

* chore: initiatives settings language support

* chore: initiatives list page language support

* chore: initiatives detail translation support

* fix: moved user permission constants (#6516)

* feat: language support for  issues (#6513)

* chore: added language support to issue detail widgets

* improvement: added translation for issue detail

* enhancement: added language trasnlation to issue layouts

* chore: translation improvement (#6518)

* feat: language support description (#6519)

* enhancement: added language support for description

* fix: updated keys

* chore: initiatives toasts language support (#2347)

* chore: initiatives settings language support

* chore: initiatives list page language support

* chore: initiatives detail translation support

* chore: initiatives translation support

* chore: code refactor

* refactor: change issue type to work item type and add translations (#2351)

* refactor: replace all occurances of issues and work items

* refactor: replace all occurances of issues and work items (#2354)

* chore: renamed issue to work item (#6522)

* chore: replace missing issue occurances to work items

* fix: build errors

* chore: minor translations update

* fix: build errors

* minor improvements

* fix: build errors

* chore: update teamspace empty states

* chore: work items

* fix: profile links

* Feat ln cycles (#6528)

* feat: added language support for cycles

* feat: added language support for cycles

* chore: added core.json

* fix: translation keys

* fix: translation keys (#6530)

* fix: changed sidebar keys

* fix: removed extras

* fix: updated keys

* chore: optimize translation imports

* fix: langugae support (#2358)

* fix: added missing keys

* fix: workspace settings

* chore: translation import optimization (#2360)

* chore: optimize translation imports

* fix: extended core

* fix: removed pro_trial

* fix: key fix

---------

Co-authored-by: gakshita <akshitagoyal1516@gmail.com>

* fix: updated keys (#6534)

* fix: updated keys

* fix-sub work items toasts

* fix: minor translations related bugs

* fix: build errors

* chore: add missing translation and minor fixes

* chore: code refactor

* chore: code refactor

* fix: language support keys (#6553)

* minor improvements

* minor fixes

* fix: remove lucide import from constants package

* fix: remove lucide import from constants package

* chore: regenerate all enterprise level translations

* chore: remove all  from translations

* chore: regenerate all translations

* chore: addded chinese and japanese translation files

* chore: remove all  from translations

* chore: dashboard translation

* fix: added member

* fix: language support keys (#6558)

* fix: renamed keys

* fix: space app

* chore: renamed issues to work items

* chore: update site manifest

* chore: updated translations

* fix: lang keys

* fix: fixed key names (#2413)

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* chore: update translations

---------

Co-authored-by: gakshita <akshitagoyal1516@gmail.com>
Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Akshita Goyal <36129505+gakshita@users.noreply.github.com>
Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
Co-authored-by: Vamsi Krishna <46787868+mathalav55@users.noreply.github.com>
Co-authored-by: Vamsi krishna <matalav55@gmail.com>
Co-authored-by: Vamsi Krishna <46787868+vamsikrishnamathala@users.noreply.github.com>
Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
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.

3 participants