-
Notifications
You must be signed in to change notification settings - Fork 531
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: Replace InputWithError and InputErrors components with ShadCN’s components directly. #9847
Fix: Replace InputWithError and InputErrors components with ShadCN’s components directly. #9847
Conversation
WalkthroughThis pull request focuses on removing the custom Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this 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 (4)
src/pages/Organization/components/OrganizationSelector.tsx (2)
119-121
: Consider using shadcn's Input component for consistency.The current implementation uses a custom div for input styling. For better maintainability and consistency with the design system, consider using shadcn's Input component.
-<div className="flex items-center h-9 w-full rounded-md border border-gray-200 bg-white px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-gray-950 placeholder:text-gray-500 focus-visible:border-primary-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-gray-800 dark:file:text-gray-50 dark:placeholder:text-gray-400 dark:focus-visible:ring-gray-300"> - <div className="w-full text-nowrap overflow-x-auto"> - {level.name} - </div> -</div> +<Input + value={level.name} + readOnly + className="text-nowrap overflow-x-auto" +/>
147-158
: Consider adding aria-label for better accessibility.The Autocomplete component could benefit from an aria-label to improve accessibility.
<Autocomplete value="" + aria-label={t( + lastLevel + ? `SYSTEM__govt_org_type__${lastLevel.metadata?.govt_org_children_type || "default"}` + : "SYSTEM__govt_org_type__default", + )} options={getOrganizationOptions( selectedLevels.length === 0 ? getAllOrganizations?.results : currentLevelOrganizations?.results, )} onChange={(value: string) => handleLevelChange(value, selectedLevels.length) } onSearch={setSearchQuery} />src/components/Patient/PatientRegistration.tsx (2)
326-331
: Use optional chaining for error handling.Multiple instances of error handling can be simplified using optional chaining.
Example fix for one instance:
-{errors["name"] && - errors["name"].map((error, i) => ( +{errors["name"]?.map((error, i) => ( <div key={i} className="text-red-500 text-xs"> {error} </div> ))}Also applies to: 352-357, 397-402, 437-442, 464-469, 585-590, 620-625, 672-677, 709-714
🧰 Tools
🪛 Biome (1.9.4)
[error] 326-331: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
494-507
: Consider extracting date input logic into a reusable component.The date input logic is repeated for day, month, and year. This could be extracted into a reusable component to reduce code duplication.
interface DateInputProps { label: string; value: string; placeholder: string; min: number; max: number; onChange: (value: string) => void; } const DateInput: React.FC<DateInputProps> = ({ label, value, placeholder, min, max, onChange, }) => ( <div className="flex-1"> <Label className="mb-2"> {label} <span className="text-red-500">*</span> </Label> <Input placeholder={placeholder} type="number" value={value} maxLength={placeholder === "YYYY" ? 4 : 2} max={max} min={min} onChange={(e) => onChange(e.target.value)} /> </div> );Also applies to: 514-527, 534-547
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
public/locale/en.json
(1 hunks)src/components/Patient/PatientRegistration.tsx
(6 hunks)src/components/ui/errors.tsx
(0 hunks)src/components/ui/input-with-error.tsx
(0 hunks)src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx
(4 hunks)src/pages/Organization/components/OrganizationSelector.tsx
(2 hunks)
💤 Files with no reviewable changes (2)
- src/components/ui/errors.tsx
- src/components/ui/input-with-error.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Patient/PatientRegistration.tsx
[error] 326-331: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 352-357: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 397-402: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 437-442: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 464-469: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 585-590: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 620-625: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 672-677: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
[error] 709-714: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (4)
src/pages/Organization/components/OrganizationSelector.tsx (1)
114-117
: LGTM! Accessible label implementation.The Label component is properly used with required indicator and translation support.
src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx (2)
3-3
: LGTM! Proper i18n implementation.The useTranslation hook is correctly imported and used for internationalization.
Also applies to: 35-35
112-115
: LGTM! Accessible label with translation.The Label component is properly used with required indicator and translation support.
public/locale/en.json (1)
1635-1635
: LGTM! Translation key added.The new translation key "select_department" is properly added with its English translation.
@AdityaJ2305 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! 🙌 |
…components directly. (ohcnetwork#9847)
…components directly. (#9847)
* added patient home actions plugin hook * expose core app env in global scope * enable heatmap and fix appointments column size (#9713) * Fix: Forgot password error should be handled properly (#9707) * forgot password mutation * updated * Added no user assingned message (#9666) Co-authored-by: Rithvik Nishad <[email protected]> * Remove facility name from facility users page (#9746) * Enhance organization management by adding new organization types and updating related components. Refactor organization level retrieval to use metadata for improved localization. Remove deprecated organization levels constant and clean up unused code in various components. * Cancel button fix in Book Appointment screen (#9757) * Add public flag to facility (#9759) * Auto-Hide Sidebar on mobile (#9758) * Implement Permission Context and Update User Permissions Handling - Introduced a new PermissionContext to manage user permissions and super admin status across the application. - Updated AppRouter to utilize PermissionProvider for managing permissions. - Changed UserModel to store permissions as strings instead of objects. - Refactored OrganizationFacilities and OrganizationPatients components to use updated permission checks and organization identifiers. - Enhanced OrganizationLayout to conditionally render navigation items based on user permissions. This commit improves the permission management system and ensures consistent handling of user permissions throughout the application. * Replaced ButtonV2's with Button in entire codebase (#9736) * fixes overlapping text (#9767) * Care Loading icon in organization and facility users (#9723) * Clean up facility search in index * Add searchPostFix prop to ValueSetSelect and related components - Introduced a new `searchPostFix` prop in `ValueSetSelect` to allow appending a suffix to the search query. - Updated `MedicationRequestQuestion` and `MedicationStatementQuestion` components to utilize the `searchPostFix` prop with a default value of " clinical drug". - This change enhances search functionality by providing more context in search queries. * Clean up patient login * Fix cancel button in update encounter form (#9772) * disabled image build and deploy for care stagin (#9779) * Bump @tanstack/react-query-devtools from 5.62.11 to 5.62.15 (#9785) Bumps [@tanstack/react-query-devtools](https://github.com/TanStack/query/tree/HEAD/packages/react-query-devtools) from 5.62.11 to 5.62.15. - [Release notes](https://github.com/TanStack/query/releases) - [Commits](https://github.com/TanStack/query/commits/HEAD/packages/react-query-devtools) --- updated-dependencies: - dependency-name: "@tanstack/react-query-devtools" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Patient encounter notes (#9617) Co-authored-by: Bodhisha Thomas <[email protected]> Co-authored-by: Bodhish Thomas <[email protected]> * Fix Auto hide without hook (#9780) * Enhance encounter data handling by adding encounterId prop across multiple components (#9793) * Disable encounter create during save (#9795) * Enhance encounter data handling by adding encounterId prop across multiple components - Added `encounterId` prop to `ObservationChart`, `ObservationHistoryTable`, `ObservationsList`, `QuestionnaireResponsesList`, and `StructuredResponseView` components to improve data fetching and display related to specific encounters. - Updated query parameters in API calls to include `encounterId` for better data context. - Refactored `EncounterPlotsTab` and `EncounterUpdatesTab` to pass the new `encounterId` prop, ensuring consistent data handling across the application. This change improves the overall functionality and user experience by ensuring that encounter-specific data is accurately retrieved and displayed. * fix: disable encounter create button during save to prevent multiple submissions #9794 * Refactor PatientHome and EncounterShow components; update FacilityOrganizationSelector labels - Removed unused state and commented-out code in PatientHome for improved readability. - Enhanced patient data display by updating the last updated and created by fields to use `updated_by` instead of `modified_by`. - Updated date formatting functions to ensure consistent display of patient and encounter dates. - Changed labels in FacilityOrganizationSelector from "Organization" to "Select Department" and adjusted related text for clarity. These changes streamline the codebase and improve user interface clarity. * Partial Cleanup Public Router | Public Pages Header * Rewire enableWhen * Remove localStorage watch from AuthUserProvider * Implement immediate redirection after successful login * Fix: Update the value to Home Health in Create Encounter Form (#9806) * Update Questionnaire Styling * Update Questionnaire Styling * Update Auth Handling * Cleanup Patient Auth State * Handle Null created_by * Types for null patient.created_by * Bump i18next from 24.2.0 to 24.2.1 (#9818) Bumps [i18next](https://github.com/i18next/i18next) from 24.2.0 to 24.2.1. - [Release notes](https://github.com/i18next/i18next/releases) - [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md) - [Commits](i18next/i18next@v24.2.0...v24.2.1) --- updated-dependencies: - dependency-name: i18next dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump input-otp from 1.4.1 to 1.4.2 (#9819) Bumps [input-otp](https://github.com/guilhermerodz/input-otp/tree/HEAD/packages/input-otp) from 1.4.1 to 1.4.2. - [Changelog](https://github.com/guilhermerodz/input-otp/blob/master/CHANGELOG.md) - [Commits](https://github.com/guilhermerodz/input-otp/commits/HEAD/packages/input-otp) --- updated-dependencies: - dependency-name: input-otp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Rename dosage field to frequency in ongoing medication form (#9811) * feat: Add new fields to Question interface (#9824) * Cleanup Labels in Questionnaire * Allergy intolerance Cleanup (#9812) * cleanup CarePatientTokenKey (#9827) * changed the facility name (#9829) * Cleanup localStorage Management in Patient Login; Fix Time in Confirmation * Use PatientContext from Router when required * Cleanup Navbars * AllergyList: Add i18n; map key * Add Actions in Encounter * Remove Shortcut for Nursing Care * Update Crowdin configuration file * Update Crowdin configuration file * Fix: Replace InputWithError and InputErrors components with ShadCN’s components directly. (#9847) * fixed eslint errors caused while creating plugin map * refactored the patient registration form using react hook form * added patient registration form plugin hook * updated validations * added patient info card actions plugin hook * set same_phone_number to true by default in patient registration * set same_address to true and same_phone_number to false by default in patient registration --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Mohammed Nihal <[email protected]>
Proposed Changes
InputWithError
andInputErrors
component in favour of shadcn's components being used directly #9702@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
Release Notes
Localization
User Interface
InputWithError
component with more streamlined label and input structureInternationalization
These changes aim to improve the overall user experience by providing clearer input guidance and error messaging.