Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: crowdin updating #1246

Merged
merged 34 commits into from
Apr 30, 2024
Merged

feat: crowdin updating #1246

merged 34 commits into from
Apr 30, 2024

Conversation

JoeKarow
Copy link
Member

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

Issue Number: IN-920

Does this introduce a breaking change?

  • Yes
  • No

Other information

Copy link

vercel bot commented Apr 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
inreach-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 6:23pm

Copy link
Contributor

coderabbitai bot commented Apr 24, 2024

Walkthrough

The recent updates across various modules primarily focus on refining API functionalities and integrating Crowdin for better localization management. Changes include refactoring database interaction patterns, enhancing schema definitions, and updating procedures related to phone and website data management. Additionally, transaction handling and Crowdin integration are emphasized to streamline operations and maintain consistency in text management across different entities.

Changes

File Path Change Summary
.github/renovate.json Updated key names and package rules in the configuration.
apps/app/lib/... Enhanced task definitions and options, and refactored translation keys generation.
apps/app/package.json Updated scripts for code generation to use pnpm with-env.
packages/api/router/orgPhone/...
packages/api/router/orgWebsite/...
Refactored phone and website functionalities, including CRUD operations, schema updates, and Crowdin integration.
packages/api/router/organization/...
packages/api/router/service/...
Updated organization and service handlers with new Crowdin integration, transaction handling, and functionality enhancements.
packages/crowdin/api/index.ts Added new functions and exports for Crowdin API interactions.

This table summarizes the key changes across different modules, highlighting the focus on improving API interactions and integrating external services for better data management and localization.


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9a1616c and 28db77e.
Files selected for processing (7)
  • apps/app/src/pages/api/i18n/load.ts (4 hunks)
  • packages/api/router/orgPhone/mutation.update.handler.ts (2 hunks)
  • packages/crowdin/cache/index.ts (5 hunks)
  • packages/crowdin/common/otaFns.ts (1 hunks)
  • packages/crowdin/constants.ts (1 hunks)
  • packages/crowdin/ota/edge.ts (1 hunks)
  • packages/crowdin/ota/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/api/router/orgPhone/mutation.update.handler.ts
Additional comments not posted (13)
packages/crowdin/common/otaFns.ts (3)

3-6: Method fetchCrowdinFile correctly sets the locale and fetches translations.


8-10: Method fetchCrowdinDbKey efficiently fetches and returns database strings.


11-13: Method crowdinDistTimestamp correctly fetches timestamps from multiple sources.

packages/crowdin/ota/edge.ts (2)

9-18: Client configuration in crowdinEdgeOta is set up correctly with appropriate options and a custom HTTP client.


20-23: Exported functions and constants are correctly set up and the global state is handled appropriately for non-production environments.

packages/crowdin/ota/index.ts (2)

9-22: Client configuration in crowdinOta is set up correctly with appropriate options and a conditional custom HTTP client based on the environment.


24-27: Exported functions and constants are correctly set up and the global state is handled appropriately for non-production environments.

apps/app/src/pages/api/i18n/load.ts (2)

20-21: Query parameter parsing using Zod is implemented correctly, providing robust validation and clear error handling.


Line range hint 37-70: Data fetching and caching logic in the handler function is implemented correctly, efficiently handling different data sources and caching scenarios.

packages/crowdin/constants.ts (2)

5-13: Function getValue correctly handles environment-specific configurations using a clear and effective conditional logic.


15-128: Constants for Crowdin integration are well-defined, using modern JavaScript features effectively for clarity and maintainability.

packages/crowdin/cache/index.ts (2)

Line range hint 25-51: Function redisReadCache is implemented correctly, efficiently handling cache reading and expiration with integrated tracing for enhanced observability.


Line range hint 94-148: Function redisWriteCache correctly handles cache writing operations with robust error handling and logging, ensuring data integrity and observability.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@github-actions github-actions bot added automerge Enable Kodiak auto-merge kodiak: merge.method = 'squash' Kodiak will squash merge this PR. 📦 crowdin 📦 db labels Apr 24, 2024
@JoeKarow JoeKarow added the new-feature New features or options. label Apr 24, 2024
Copy link

socket-security bot commented Apr 24, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@JoeKarow
Copy link
Member Author

@SocketSecurity ignore npm/[email protected]

Copy link

relativeci bot commented Apr 24, 2024

#284 Bundle Size — 3.32MiB (0%).

28db77e(current) vs 122f9b2 dev#273(baseline)

Bundle metrics  Change 1 change
                 Current
#284
     Baseline
#273
No change  Initial JS 2.95MiB 2.95MiB
No change  Initial CSS 9.54KiB 9.54KiB
Change  Cache Invalidation 30.17% 73.77%
No change  Chunks 65 65
No change  Assets 78 78
No change  Modules 1959 1959
No change  Duplicate Modules 280 280
No change  Duplicate Code 8.1% 8.1%
No change  Packages 205 205
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#284
     Baseline
#273
No change  JS 3.2MiB 3.2MiB
No change  Fonts 94.54KiB 94.54KiB
No change  CSS 9.54KiB 9.54KiB
No change  IMG 8.57KiB 8.57KiB
No change  Other 8.05KiB 8.05KiB

Bundle analysis reportBranch IN-920-update-crowdinProject dashboard

Copy link
Contributor

github-actions bot commented Apr 24, 2024

📦 Next.js Bundle Analysis for @weareinreach/app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link

alwaysmeticulous bot commented Apr 24, 2024

🤖 No test run has been triggered as your Meticulous project has been deactivated (since you haven't viewed any test results in a while). Click here to reactivate.

Last updated for commit 28db77e. This comment will update as new commits are pushed.

@JoeKarow
Copy link
Member Author

@coderabbitai review

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: 24

Out of diff range and nitpick comments (10)
packages/api/router/orgWebsite/mutation.update.handler.ts (1)

37-54: Refactor to simplify the conditional logic handling URL data.

Consider using a more streamlined approach to handle the URL data type check and the corresponding database operations.

packages/api/router/orgPhone/mutation.create.schema.ts (1)

Line range hint 1-60: Improve readability and maintainability of the schema transformation logic.

Refactor the transformation logic to separate concerns more clearly, possibly by extracting parts of the logic into smaller, more focused functions or by using helper functions to handle complex transformations.

packages/api/router/organization/mutation.attachAttribute.handler.ts (1)

Line range hint 1-51: Improve code readability and maintainability.

Refactor the function to separate concerns more clearly, possibly by extracting parts of the logic into smaller, more focused functions, especially the Crowdin integration part.

packages/db/prisma/common.ts (2)

Line range hint 25-45: Refactor downloadFromDatastore to improve error handling and robustness.

Consider adding more detailed error messages and handling specific error scenarios more gracefully in the downloadFromDatastore function. Additionally, ensure that the function adheres to security best practices when handling environment variables and external API calls.


Line range hint 1-45: Improve code readability and maintainability.

Refactor the file to separate concerns more clearly, possibly by organizing the functions into sections or files based on their functionality (e.g., error handling, data fetching, etc.).

packages/db/prisma/migrations/20240425151405_add_suggested_by/migration.sql (1)

1-57: Improve readability and maintainability of the SQL migration script.

Refactor the SQL script to improve readability, possibly by adding more comments to explain the purpose of each operation and by organizing the statements in a logical order.

packages/api/router/orgPhone/index.ts (2)

Line range hint 1-27: Optimize dynamic imports and handler integrations for performance and reliability.

Consider preloading some of the handlers if they are frequently used, or ensure that the dynamic imports do not introduce significant delays or reliability issues.


Line range hint 1-27: Improve readability and maintainability of the orgPhone router configuration.

Refactor the router configuration to improve readability, possibly by adding more comments to explain the purpose of each procedure and by organizing the configurations in a logical order.

packages/db/lib/generateFreeText.ts (1)

Line range hint 18-51: Consider adding error handling for the invariant function to manage potential failures gracefully, especially in cases where itemId might not be provided.

- invariant(itemId)
+ if (!itemId) {
+   throw new Error('Item ID is required for this type of free text generation.')
+ }
packages/db/prisma/schema.prisma (1)

154-154: Consider adding a comment to describe the purpose of the Suggestion model.

Adding a comment explaining the purpose and use of the Suggestion model can improve code readability and maintainability.

packages/db/prisma/schema.prisma Show resolved Hide resolved
packages/crowdin/constants.ts Show resolved Hide resolved
packages/crowdin/constants.ts Outdated Show resolved Hide resolved
packages/api/router/orgPhone/mutation.update.handler.ts Outdated Show resolved Hide resolved
packages/crowdin/common/apiFns.ts Show resolved Hide resolved
apps/app/lib/generators/translationKeys.ts Show resolved Hide resolved
apps/app/lib/generators/translationKeys.ts Show resolved Hide resolved
Copy link

sonarcloud bot commented Apr 30, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.1% Duplication on New Code

See analysis details on SonarCloud

@JoeKarow
Copy link
Member Author

@coderabbitai resolve

@kodiakhq kodiakhq bot merged commit 8c7352a into dev Apr 30, 2024
33 of 34 checks passed
@kodiakhq kodiakhq bot deleted the IN-920-update-crowdin branch April 30, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 api 📦 app automerge Enable Kodiak auto-merge 📦 crowdin 📦 db kodiak: merge.method = 'squash' Kodiak will squash merge this PR. new-feature New features or options. 📦 ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants