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

fix: email editing, data portal option display #1349

Merged
merged 6 commits into from
Jul 29, 2024

Conversation

JoeKarow
Copy link
Member

@JoeKarow JoeKarow commented Jul 29, 2024

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

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Enhanced the ServiceSelect component to only display categories with available services and added visual indicators for active/inactive states.
    • Introduced a checkbox in the AttributeModalBody to toggle the visibility of inactive attributes, improving user interaction and filtering capabilities.
  • Bug Fixes

    • Updated error handling in the data queries to ensure robust behavior when certain input parameters are not provided.
  • Documentation

    • Added new migration jobs for updating address visibility and adding service tags, expanding database functionalities.
  • Refactor

    • Improved the logic in the attributesByCategory function to enhance robustness and prevent runtime errors.

Copy link

vercel bot commented Jul 29, 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 Jul 29, 2024 9:10pm

Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

The recent updates enhance data handling and user interactions across various components. Key modifications include improved query logic to include inactive entities, new state management for visibility toggling, and refined UI components for better user experience. These changes aim to increase robustness, usability, and maintainability while ensuring accurate data retrieval based on active statuses.

Changes

File Path Change Summary
packages/api/router/component/query.ServiceSelect.handler.ts
packages/api/router/fieldOpt/query.attributesByCategory.handler.ts
Adjustments to query handling for active status fields, allowing retrieval of all entities regardless of their active status, enhancing data scope.
packages/api/router/fieldOpt/query.attributesByCategory.schema.ts Introduction of attributeActive and categoryActive properties to the schema, enabling better filtering and state management for attributes and categories.
packages/api/router/orgEmail/mutation.update.handler.ts Improved handling of the description field in updates, ensuring structured data assignment only when valid input is provided, enhancing data integrity.
packages/db/client/index.ts Modifications to logging configuration and error handling in PrismaClient, introducing dynamic error format based on the environment for better performance.
packages/db/prisma/data-migrations/* New migration jobs added for updating address visibility and adding new service tags, enhancing data management capabilities within the database.
packages/ui/components/data-portal/ServiceSelect/index.tsx Enhanced rendering logic in the ServiceSelect component to prevent displaying empty categories and provide visual cues for active/inactive states.
packages/ui/modals/dataPortal/Attributes/* New functionality for managing attribute visibility with state tracking and checkbox for toggling inactive attributes, improving user interactivity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant API
    participant DB
    
    User->>UI: Toggle "Show Inactive Attributes"
    UI->>API: Fetch Attributes with filter
    API->>DB: Retrieve attributes based on active states
    DB-->>API: Return filtered attributes
    API-->>UI: Send back attributes
    UI-->>User: Display updated list of attributes
Loading

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.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

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.

@github-actions github-actions bot added automerge Enable Kodiak auto-merge kodiak: merge.method = 'squash' Kodiak will squash merge this PR. labels Jul 29, 2024
@JoeKarow JoeKarow added the bugfix Inconsistencies or issues which will cause a problem for users or implementors. label Jul 29, 2024
Copy link

sonarcloud bot commented Jul 29, 2024

Copy link

relativeci bot commented Jul 29, 2024

#1032 Bundle Size — 3.5MiB (+0.01%).

fba5d23(current) vs 36f6277 dev#1029(baseline)

Warning

Bundle contains 5 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#1032
     Baseline
#1029
Regression  Initial JS 3.07MiB(+0.01%) 3.07MiB
No change  Initial CSS 9.54KiB 9.54KiB
Change  Cache Invalidation 32.24% 39.4%
No change  Chunks 64 64
No change  Assets 77 77
No change  Modules 2056 2056
No change  Duplicate Modules 340 340
No change  Duplicate Code 9.43% 9.43%
No change  Packages 209 209
No change  Duplicate Packages 5 5
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#1032
     Baseline
#1029
Regression  JS 3.39MiB (+0.01%) 3.39MiB
No change  Fonts 94.54KiB 94.54KiB
No change  CSS 9.54KiB 9.54KiB
No change  Other 9.09KiB 9.09KiB
No change  IMG 8.57KiB 8.57KiB

Bundle analysis reportBranch JoeKarow/email-update-crowdin-tw...Project dashboard

Copy link
Contributor

📦 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 Jul 29, 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 fba5d23. This comment will update as new commits are pushed.

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

Outside diff range, codebase verification and nitpick comments (1)
packages/db/prisma/data-migrations/2024-07-29_new-service-tags.ts (1)

4-11: LGTM! Consider adding a description.

The job definition is correct and follows the required format. The description is optional but can provide additional context.

-	description: undefined,
+	description: 'This job creates new service tags for self-advocacy and community organizing.',
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36f6277 and fba5d23.

Files selected for processing (13)
  • packages/api/router/component/query.ServiceSelect.handler.ts (1 hunks)
  • packages/api/router/fieldOpt/query.attributesByCategory.handler.ts (1 hunks)
  • packages/api/router/fieldOpt/query.attributesByCategory.schema.ts (1 hunks)
  • packages/api/router/orgEmail/mutation.update.handler.ts (1 hunks)
  • packages/db/client/index.ts (3 hunks)
  • packages/db/prisma/data-migrations/2024-07-29_address-visibility-update.ts (1 hunks)
  • packages/db/prisma/data-migrations/2024-07-29_new-service-tags.ts (1 hunks)
  • packages/db/prisma/data-migrations/index.ts (1 hunks)
  • packages/db/prisma/migrations/20240729192332_update_view/migration.sql (1 hunks)
  • packages/db/prisma/schema.prisma (1 hunks)
  • packages/ui/components/data-portal/ServiceSelect/index.tsx (2 hunks)
  • packages/ui/modals/dataPortal/Attributes/SelectionItem.tsx (2 hunks)
  • packages/ui/modals/dataPortal/Attributes/index.tsx (5 hunks)
Additional context used
Biome
packages/db/prisma/data-migrations/2024-07-29_address-visibility-update.ts

[error] 24-24: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

packages/db/prisma/data-migrations/2024-07-29_new-service-tags.ts

[error] 21-21: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

Additional comments not posted (42)
packages/db/prisma/data-migrations/index.ts (2)

10-10: LGTM!

The export statement for 2024-07-29_address-visibility-update is correct and consistent with the existing structure.


11-11: LGTM!

The export statement for 2024-07-29_new-service-tags is correct and consistent with the existing structure.

packages/db/prisma/migrations/20240729192332_update_view/migration.sql (1)

1-33: LGTM! But verify the view creation.

The SQL query to create or replace the view public.attributes_by_category is correct and efficient.

However, ensure that the view creation does not introduce any potential issues.

packages/api/router/component/query.ServiceSelect.handler.ts (4)

16-16: LGTM!

Adding the active field to the selection criteria for service categories is correct and aligns with the intended functionality.


22-27: LGTM!

Adding the active field to the selection criteria for services and service tags is correct and aligns with the intended functionality.


19-19: Verify the impact of commenting out the active filter.

Ensure that commenting out the active: true filter aligns with the intended functionality and does not introduce any potential issues.


9-9: Verify the impact of commenting out the active filter.

Ensure that commenting out the active: true filter aligns with the intended functionality and does not introduce any potential issues.

packages/ui/modals/dataPortal/Attributes/SelectionItem.tsx (2)

7-7: LGTM! The addition of the active prop is clear and straightforward.

The active prop has been added to the destructured parameters, which aligns with the intended functionality enhancements.


42-42: LGTM! The active property has been appropriately added to the SelectionItemProps interface.

The addition aligns with the changes made to the component and ensures type safety.

packages/api/router/fieldOpt/query.attributesByCategory.schema.ts (1)

9-10: LGTM! The attributeActive and categoryActive properties have been appropriately added to the schema.

These additions enhance the schema by allowing the representation of the active state of attributes and categories.

packages/api/router/fieldOpt/query.attributesByCategory.handler.ts (1)

18-18: LGTM! The destructuring of the input parameter with default values is a robust improvement.

This change ensures that attributeActive and categoryActive are always defined, preventing potential runtime errors.

packages/db/client/index.ts (5)

15-23: LGTM!

The function getErrorFormat enhances configurability by allowing different error formats for local development and Vercel environments.


40-42: LGTM!

The errorFormat property in clientOptions is now assigned dynamically using getErrorFormat, enhancing configurability.


59-61: LGTM!

The error and warning event handlers remain intact, ensuring that errors and warnings are still logged appropriately.


3-3: Verify the impact of commenting out createPrismaQueryEventHandler.

Commenting out this import indicates a shift in how query logging is managed. Ensure that this change does not affect other parts of the codebase that rely on createPrismaQueryEventHandler.

Verification successful

The impact of commenting out createPrismaQueryEventHandler is limited to packages/db/client/index.ts and does not affect other parts of the codebase.

  • The function is only referenced in the file where it was imported, and both the import and its usage are commented out.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `createPrismaQueryEventHandler` in the codebase.

# Test: Search for the function usage. Expect: No occurrences of the function.
rg --type js --type ts 'createPrismaQueryEventHandler'

Length of output: 235


Script:

#!/bin/bash
# Description: Verify the usage of `createPrismaQueryEventHandler` in the entire codebase.

# Test: Search for the function usage in the entire codebase. Expect: No occurrences of the function outside `packages/db/client/index.ts`.
rg 'createPrismaQueryEventHandler'

Length of output: 215


48-57: Verify the impact of commenting out verbose logging logic.

Commenting out the verbose logging logic suggests that detailed query logging might be temporarily disabled. Ensure that this change does not affect debugging and monitoring.

packages/db/prisma/data-migrations/2024-07-29_address-visibility-update.ts (6)

1-6: LGTM!

The import statements include necessary modules for file operations, path resolution, and database migrations.


7-14: LGTM!

The job metadata is defined with properties such as jobId, title, createdBy, and description, which are essential for identifying and describing the migration job.


18-19: LGTM!

The job export includes the job metadata and the task function, which are necessary for the migration runner to execute the job.


20-64: LGTM!

The task function includes the main logic for the data migration, including logging, updating the database, and logging the results. The function is well-structured and includes necessary steps for the migration.

Tools
Biome

[error] 24-24: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


64-64: LGTM!

Logging the results of the migration is essential for tracking the success of the migration.


66-71: LGTM!

Calling the job post-runner to register the successful completion of the migration is necessary to ensure that the migration is recorded as completed.

packages/api/router/orgEmail/mutation.update.handler.ts (2)

53-53: LGTM!

The description field is now conditionally assigned based on the presence of updateDescriptionText, enhancing the robustness of the code.


Line range hint 1-60:
LGTM!

The update function handles the updating of email records, including description, title, and location linking. The function is well-structured and includes necessary steps for updating the email records.

packages/db/prisma/data-migrations/2024-07-29_new-service-tags.ts (4)

1-2: LGTM!

The import statements are correct and necessary for the functionality of the file.


12-17: LGTM!

The job export is correct and follows the required format.


18-21: LGTM!

The logging setup is correct and necessary for tracking the job's progress.

Tools
Biome

[error] 21-21: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


76-85: LGTM!

The job post-runner is correct and necessary for tracking the job's completion.

packages/ui/components/data-portal/ServiceSelect/index.tsx (6)

Line range hint 1-8:
LGTM!

The import statements are correct and necessary for the functionality of the file.


Line range hint 9-20:
LGTM!

The useStyles function is correct and follows the required format.


Line range hint 21-45:
LGTM!

The initial setup of the ServiceSelect component is correct and follows the required format.


46-76: LGTM!

The rendering logic is correct and improves the component's efficiency and user experience.


Line range hint 77-101:
LGTM!

The Drawer component setup is correct and follows the required format.


Line range hint 102-104:
LGTM!

The ServiceSelectProps interface is correct and follows the required format.

packages/ui/modals/dataPortal/Attributes/index.tsx (6)

Line range hint 1-15:
LGTM!

The import statements are correct and necessary for the functionality of the file.


Line range hint 16-67:
LGTM!

The initial setup of the AttributeModalBody component is correct and follows the required format.


Line range hint 68-87:
LGTM!

The memoization of attributeCategories is correct and improves the component's performance.


Line range hint 88-213:
LGTM!

The handlers are correct and follow the required format. The toggleShowInactiveAttribs handler is a new addition and enhances the component's functionality.


Line range hint 214-273:
LGTM!

The rendering logic is correct and follows the required format.


Line range hint 274-283:
LGTM!

The AttributeModalProps interface is correct and follows the required format.

packages/db/prisma/schema.prisma (2)

2365-2365: Addition of attributeActive field is approved.

The new field attributeActive enhances the model's capability to manage and filter attributes based on their active state.


2366-2366: Addition of categoryActive field is approved.

The new field categoryActive enhances the model's capability to manage and filter categories based on their active state.

@kodiakhq kodiakhq bot merged commit fc0ea10 into dev Jul 29, 2024
34 of 35 checks passed
@kodiakhq kodiakhq bot deleted the JoeKarow/email-update-crowdin-tweaks branch July 29, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 api automerge Enable Kodiak auto-merge bugfix Inconsistencies or issues which will cause a problem for users or implementors. 📦 db kodiak: merge.method = 'squash' Kodiak will squash merge this PR. 📦 ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants