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

Add create questionnaire route and enhance questionnaire editor functionality #10363

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

bodhish
Copy link
Member

@bodhish bodhish commented Feb 2, 2025

This pull request introduces several enhancements and fixes to the QuestionnaireEditor component and related files. The most significant changes include adding support for creating new questionnaires, managing organizations within the editor, and updating various UI components for improved consistency.

Enhancements to QuestionnaireEditor:

  • Added a new route /questionnaire/create to support the creation of new questionnaires (src/Routers/routes/questionnaireRoutes.tsx).
  • Modified QuestionnaireEditor to handle both creation and editing of questionnaires, including initializing state for new questionnaires and adding a save handler that differentiates between creating and updating (src/components/Questionnaire/QuestionnaireEditor.tsx). [1] [2] [3]
  • Integrated organization management within the QuestionnaireEditor, allowing users to select and manage organizations associated with a questionnaire (src/components/Questionnaire/QuestionnaireEditor.tsx).

UI Component Updates:

  • Updated various UI components (Button, Input, Select, Textarea) to use a consistent border color (border-gray-200) instead of the previous border-gray-400/75 for a more uniform appearance across the application (src/components/ui/button.tsx, src/components/ui/input.tsx, src/components/ui/phone-input.tsx, src/components/ui/select.tsx, src/components/ui/textarea.tsx). [1] [2] [3] [4] [5]

These changes collectively enhance the functionality and appearance of the questionnaire management features within the application.

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated page for creating questionnaires.
    • Enhanced the questionnaire creation experience with organization management tools and unique URL identifier support.
  • Style

    • Updated the visual appearance of buttons, inputs, phone inputs, select menus, and textareas with a lighter, more consistent border.
    • Adjusted the questionnaire preview layout for improved content display.

@bodhish bodhish requested a review from a team as a code owner February 2, 2025 15:15
Copy link
Contributor

coderabbitai bot commented Feb 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request adds a new route ("/questionnaire/create") to serve a dedicated page for creating questionnaires. The QuestionnaireEditor component is enhanced to support new organization management features, including state handling for selected organization IDs and search queries. The component now supports questionnaire creation with appropriate toast notifications on save. Additionally, several UI components have their border styling updated to use a lighter shade (border-gray-200), and the preview tab in the questionnaire view is adjusted by removing a maximum width constraint.

Changes

File(s) Change Summary
src/Routers/routes/questionnaireRoutes.tsx Added new route "/questionnaire/create" rendering the QuestionnaireEditor component.
src/components/Questionnaire/QuestionnaireEditor.tsx Enhanced with new organization management features, optional id prop in QuestionnaireEditorProps, new state variables, updated query/mutation logic, toast notifications, and UI sections for organization search and questionnaire slug input.
src/components/Questionnaire/show.tsx Updated the TabsContent component by changing its class name from "max-w-3xl mx-auto" to "mx-auto".
src/components/ui/button.tsx, .../input.tsx, .../phone-input.tsx, .../select.tsx, .../textarea.tsx Updated border color in various UI elements from border-gray-400/75 to border-gray-200 for a consistent lighter visual style.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant R as Router
  participant Q as QuestionnaireEditor
  participant API as Questionnaire API

  U->>R: Navigate to "/questionnaire/create"
  R->>Q: Render QuestionnaireEditor Component
  Q->>API: Submit new questionnaire (with org data)
  API-->>Q: Return success/error
  Q->>U: Display toast notification with result
Loading

Possibly related PRs

Suggested labels

tested, reviewed, needs testing

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

Oh, I'm a rabbit of code and cheer,
Hopping through routes both far and near.
A new questionnaire is born today,
With org features in full display.
Colors are light with borders so bright,
Celebrating changes into the night!
🐇✨ Happy coding and delight!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b50dfa and 734592c.

📒 Files selected for processing (8)
  • src/Routers/routes/questionnaireRoutes.tsx (1 hunks)
  • src/components/Questionnaire/QuestionnaireEditor.tsx (12 hunks)
  • src/components/Questionnaire/show.tsx (1 hunks)
  • src/components/ui/button.tsx (1 hunks)
  • src/components/ui/input.tsx (1 hunks)
  • src/components/ui/phone-input.tsx (1 hunks)
  • src/components/ui/select.tsx (1 hunks)
  • src/components/ui/textarea.tsx (1 hunks)

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.

@bodhish bodhish merged commit 6d880c7 into develop Feb 2, 2025
9 of 10 checks passed
@bodhish bodhish deleted the create-questionnaire branch February 2, 2025 15:16
Copy link

github-actions bot commented Feb 2, 2025

@bodhish Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

Copy link

netlify bot commented Feb 2, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 734592c
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/679f8c1ec3b7cb0008e98b0d
😎 Deploy Preview https://deploy-preview-10363--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant