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

Upgrading old UI components with new ones #10049

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

NikhilA8606
Copy link
Contributor

@NikhilA8606 NikhilA8606 commented Jan 19, 2025

Replaced DateFormField with DatePicker ui component

  • Fixes Replacing older UI components with new UI components #10048
  • New Features
    • Introduced a new DatePicker component for date of birth selection in patient registration
  • Improvements
    • Simplified date handling logic in the patient registration form
    • Streamlined date input process with more direct date selection mechanism

image

These are the components to be replaced.

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

@rithviknishad

Summary by CodeRabbit

  • New Features

    • Introduced a new DateField component for streamlined date of birth input in the patient registration form.
    • Enhanced DatePicker component with new disabled functionality for improved date selection flexibility.
  • Bug Fixes

    • Simplified date of birth input handling in patient registration by consolidating multiple inputs into a single component.

@NikhilA8606 NikhilA8606 requested a review from a team as a code owner January 19, 2025 06:55
Copy link
Contributor

coderabbitai bot commented Jan 19, 2025

Walkthrough

The pull request introduces a new DateField component, replacing the previous DateFormField in the PatientRegistration component. This change simplifies the date input handling for the date of birth field by consolidating the input into a single component. Additionally, a new disabled property is added to the DatePicker component, allowing for more flexible date selection management. The overall form logic remains intact, ensuring the same validation rules apply.

Changes

File Change Summary
src/pages/PublicAppointments/PatientRegistration.tsx Replaced DateFormField with new DateField component for date of birth input. Simplified date handling logic.
src/components/ui/date-picker.tsx Introduced disabled prop to DatePicker, allowing for custom date disabling. Updated method signature and interface for DatePickerProps.
src/components/ui/datefield.tsx Added new DateField component for managing date input with three fields for day, month, and year.

Assessment against linked issues

Objective Addressed Explanation
Replace older UI components with ShadCN UI [#10048]

Possibly related PRs

  • DOB Values Limit in patient registration form #9735: The changes in this PR enhance the validation logic for the date of birth input in the PatientRegistration component, which is directly related to the changes made in the main PR that also modifies the PatientRegistration component to handle date inputs.
  • Enabled auto-switch feature for DOB input on the Patient Registration page #9870: This PR introduces an auto-switch feature for the date of birth input in the PatientRegistration component, which aligns with the main PR's focus on improving the date handling functionality within the same component.
  • Patient Registration form refactor #9854: This PR refactors the PatientRegistration component to utilize React Hook Form for managing form state and validation, which is relevant to the changes made in the main PR that also involves modifications to the PatientRegistration component.

Suggested labels

tested, reviewed

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 A DateField hops into view,
Replacing old fields with something new.
Smooth as a carrot, swift as can be,
UI components dance with glee!
Coding magic, watch it bloom! 🌱


📜 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 78c2c51 and 18776b1.

📒 Files selected for processing (1)
  • src/pages/PublicAppointments/PatientRegistration.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/PublicAppointments/PatientRegistration.tsx

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

netlify bot commented Jan 19, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 18776b1
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/678ea37ce3ce8a000888fdda
😎 Deploy Preview https://deploy-preview-10049--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.

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 (1)
src/pages/PublicAppointments/PatientRegistration.tsx (1)

Line range hint 89-89: Improve date validation in the schema.

The current schema validation for date_of_birth needs improvement:

  1. Remove the string type to maintain type consistency.
  2. Add validation for minimum date.

Apply this diff to improve the schema:

-date_of_birth: z.date().or(z.string()).optional(),
+date_of_birth: z.date()
+  .optional()
+  .refine(
+    (date) => {
+      if (!date) return true;
+      const minDate = new Date();
+      minDate.setFullYear(minDate.getFullYear() - 150);
+      return date >= minDate && date <= new Date();
+    },
+    { message: t("invalid_date_range") }
+  ),
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 206ee47 and cdc745e.

📒 Files selected for processing (1)
  • src/pages/PublicAppointments/PatientRegistration.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (2)
src/pages/PublicAppointments/PatientRegistration.tsx (2)

11-11: LGTM!

The import statement for the new DatePicker component follows the project's conventions.


Line range hint 193-193: Verify date formatting in form submission.

The dateQueryString utility is used to format the date, but there's no validation to ensure the date is properly formatted.

Run this script to verify the implementation of dateQueryString:

Comment on lines 322 to 326
<DatePicker
date={
field.value ? new Date(field.value) : undefined
}
onChange={(dateObj: {
name: string;
value: Date;
}) => {
if (dateObj?.value instanceof Date) {
field.onChange(dateObj.value.toISOString());
} else {
field.onChange(null);
}
}}
disableFuture
min={new Date(1900, 0, 1)}
className="-mb-6"
onChange={(date) => field.onChange(date)}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add date validation and improve type safety.

The DatePicker implementation needs several improvements:

  1. Add validation to prevent future dates (previously handled by disableFuture).
  2. Add type validation for the date conversion.
  3. Sanitize the date input before form mutation.
  4. Add accessibility attributes.

Apply this diff to address these issues:

 <DatePicker
-  date={field.value ? new Date(field.value) : undefined}
-  onChange={(date) => field.onChange(date)}
+  date={field.value ? new Date(field.value) : undefined}
+  onChange={(date) => {
+    if (date && date > new Date()) {
+      return;
+    }
+    field.onChange(date);
+  }}
+  disableFuture
+  aria-label={t("date_of_birth")}
 />

Committable suggestion skipped: line range outside the PR's diff.

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 (1)
src/components/ui/date-picker.tsx (1)

48-48: Consider adding aria-label for disabled dates.

The disabled prop is correctly passed to the Calendar component, but for better accessibility, consider adding an aria-label to explain why certain dates are disabled.

         <Calendar
           mode="single"
           selected={date}
           onSelect={(date) => {
             onChange?.(date);
             setOpen(false);
           }}
           initialFocus
-          disabled={disabled}
+          disabled={disabled}
+          disabledDayAriaLabel="This date is not available for selection"
         />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cdc745e and b4a49ef.

📒 Files selected for processing (2)
  • src/components/ui/date-picker.tsx (2 hunks)
  • src/pages/PublicAppointments/PatientRegistration.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/PublicAppointments/PatientRegistration.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (2)
src/components/ui/date-picker.tsx (2)

19-19: LGTM! Well-typed disabled prop.

The disabled prop is correctly typed as an optional function that takes a Date and returns a boolean, following TypeScript best practices.


Line range hint 22-51: Verify date handling in patient registration.

Since this component is replacing DateFormField in the patient registration process, ensure that:

  1. The date format matches the expected format in the backend API
  2. The disabled function correctly prevents selection of future dates for date of birth
  3. The component handles null/undefined values gracefully
✅ Verification successful

Date handling implementation verified successfully

The DatePicker component in the patient registration process correctly:

  • Prevents selection of future dates and dates before 1900
  • Handles null/undefined values with a "Pick a date" placeholder
  • Uses standard Date objects for API compatibility
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the date format and validation in the patient registration component
rg -A 10 "DatePicker.*date.*birth" --type ts --type tsx

# Check for any date format constants or utilities
rg "date.*format" --type ts --type tsx

Length of output: 154


Script:

#!/bin/bash
# Find DatePicker usage in components
ast-grep --pattern 'DatePicker date={$_} onChange={$_}'

# Find patient registration form components
rg -l "registration.*form|form.*registration"

# Look for Calendar component implementation
ast-grep --pattern 'Calendar mode="single" $_'

# Search for API calls with dates
rg -l "api.*patient|patient.*api"

Length of output: 444


Script:

#!/bin/bash
# Find DatePicker usage with broader pattern
rg -l "DatePicker"

# Check date formats in API files
rg -A 5 "date.*birth|birth.*date" src/types/**/*Api.ts src/Utils/request/api.tsx

# Find Calendar component usage and implementation
rg -l "Calendar.*mode|mode.*Calendar"

# Look for date-related types
rg -A 3 "interface.*date|type.*date" src/types/

Length of output: 1471


Script:

#!/bin/bash
# Check PatientRegistration implementation
rg -A 10 "DatePicker" src/pages/PublicAppointments/PatientRegistration.tsx

# Look for birth date validation
rg -A 5 "birth.*valid|valid.*birth"

# Check patient API request formatting
rg -A 10 "patient.*create|create.*patient"

Length of output: 22492

}

export function DatePicker({ date, onChange }: DatePickerProps) {
export function DatePicker({ date, onChange, disabled }: DatePickerProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Add JSDoc documentation for the DatePicker component and its props

The component lacks documentation for its props, particularly the disabled prop's behavior. Please add JSDoc documentation to explain that the disabled prop is a function that returns true to disable a specific date.

Example documentation:

/**
 * A date picker component that allows selecting a date from a calendar.
 */
interface DatePickerProps {
  /** The currently selected date */
  date?: Date;
  /** Callback fired when the date changes */
  onChange?: (date?: Date) => void;
  /** Function to determine if a date should be disabled. Return true to disable the date. */
  disabled?: (date: Date) => boolean;
}
🔗 Analysis chain

Verify disabled prop documentation.

While the implementation looks good, ensure that the component's documentation or comments describe the expected behavior of the disabled function (e.g., return true to disable a date).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there's any documentation for the DatePicker component
rg -B 5 -A 1 "DatePicker" --type ts --type tsx | grep -i "doc\|comment"

Length of output: 99


Script:

#!/bin/bash
# Search for DatePicker without file type filtering
rg -B 5 -A 1 "DatePicker"

# Use ast-grep to find interface/type definitions and any JSDoc
ast-grep --pattern 'interface DatePickerProps {
  $$$
}'

# Also search for any type definition
ast-grep --pattern 'type DatePickerProps = {
  $$$
}'

# Look for any JSDoc comments before DatePicker
ast-grep --pattern '/**
  $$$
*/
$_DatePicker'

Length of output: 15231

@Jacobjeevan
Copy link
Contributor

@NikhilA8606 Is this work in progress 🤔 Only seeing DateFormField here. Or are you planning for new PRs for each component?

@NikhilA8606
Copy link
Contributor Author

I'm currently working on this PR

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

🧹 Nitpick comments (1)
src/components/ui/datefield.tsx (1)

6-9: Consider adding validation props for date constraints.

The component could benefit from additional props to handle date validation constraints (min/max date, disabled dates, etc.).

 interface DateFieldProps {
   value?: string;
   onChange?: (value: string) => void;
+  minDate?: string;
+  maxDate?: string;
+  disabledDates?: string[];
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b4a49ef and 78c2c51.

📒 Files selected for processing (2)
  • src/components/Patient/PatientRegistration.tsx (2 hunks)
  • src/components/ui/datefield.tsx (1 hunks)
🔇 Additional comments (1)
src/components/Patient/PatientRegistration.tsx (1)

516-519: LGTM! Clean integration of the DateField component.

The DateField component is properly integrated with form control and handles value/onChange correctly.

Comment on lines +40 to +46
<Input
type="number"
placeholder="DD"
value={day}
onChange={handleDayChange}
data-cy="dob-day-input"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add min/max attributes to input fields.

The numeric inputs should have min/max constraints to prevent invalid values.

 <Input
   type="number"
   placeholder="DD"
+  min="1"
+  max="31"
   value={day}
   onChange={handleDayChange}
   data-cy="dob-day-input"
 />

 <Input
   type="number"
   placeholder="MM"
+  min="1"
+  max="12"
   value={month}
   onChange={handleMonthChange}
   data-cy="dob-month-input"
 />

 <Input
   type="number"
   placeholder="YYYY"
+  min="1900"
+  max={new Date().getFullYear()}
   value={year}
   onChange={handleYearChange}
   data-cy="dob-year-input"
 />

Also applies to: 51-57, 62-68

Comment on lines +15 to +34
const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
if (onChange) {
onChange(`${year || ""}-${month || ""}-${newDay}`);
}
};

const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newMonth = e.target.value;
if (onChange) {
onChange(`${year || ""}-${newMonth}-${day || ""}`);
}
};

const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newYear = e.target.value;
if (onChange) {
onChange(`${newYear}-${month || ""}-${day || ""}`);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add date validation in the handlers.

The handlers should validate the input values to ensure they form a valid date (e.g., prevent 31st for months with 30 days).

 const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
   const newDay = e.target.value;
+  if (Number(newDay) > 31 || Number(newDay) < 1) return;
   if (onChange) {
     onChange(`${year || ""}-${month || ""}-${newDay}`);
   }
 };

 const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
   const newMonth = e.target.value;
+  if (Number(newMonth) > 12 || Number(newMonth) < 1) return;
   if (onChange) {
     onChange(`${year || ""}-${newMonth}-${day || ""}`);
   }
 };

 const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
   const newYear = e.target.value;
+  if (Number(newYear) < 1900 || Number(newYear) > new Date().getFullYear()) return;
   if (onChange) {
     onChange(`${newYear}-${month || ""}-${day || ""}`);
   }
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
if (onChange) {
onChange(`${year || ""}-${month || ""}-${newDay}`);
}
};
const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newMonth = e.target.value;
if (onChange) {
onChange(`${year || ""}-${newMonth}-${day || ""}`);
}
};
const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newYear = e.target.value;
if (onChange) {
onChange(`${newYear}-${month || ""}-${day || ""}`);
}
};
const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
if (Number(newDay) > 31 || Number(newDay) < 1) return;
if (onChange) {
onChange(`${year || ""}-${month || ""}-${newDay}`);
}
};
const handleMonthChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newMonth = e.target.value;
if (Number(newMonth) > 12 || Number(newMonth) < 1) return;
if (onChange) {
onChange(`${year || ""}-${newMonth}-${day || ""}`);
}
};
const handleYearChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newYear = e.target.value;
if (Number(newYear) < 1900 || Number(newYear) > new Date().getFullYear()) return;
if (onChange) {
onChange(`${newYear}-${month || ""}-${day || ""}`);
}
};

Comment on lines +11 to +13
export default function DateField({ value = "", onChange }: DateFieldProps) {
const [year, month, day] = value.split("-");
const { t } = useTranslation();
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add validation for the date string format.

The value.split("-") operation assumes a valid date string format. Add validation to handle invalid or malformed input.

-  const [year, month, day] = value.split("-");
+  const [year, month, day] = value?.match(/^\d{4}-\d{2}-\d{2}$/) ? value.split("-") : ["", "", ""];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export default function DateField({ value = "", onChange }: DateFieldProps) {
const [year, month, day] = value.split("-");
const { t } = useTranslation();
export default function DateField({ value = "", onChange }: DateFieldProps) {
const [year, month, day] = value?.match(/^\d{4}-\d{2}-\d{2}$/) ? value.split("-") : ["", "", ""];
const { t } = useTranslation();

Comment on lines +6 to +9
interface DateFieldProps {
value?: string;
onChange?: (value: string) => void;
}
Copy link
Member

@rithviknishad rithviknishad Jan 21, 2025

Choose a reason for hiding this comment

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

can we stick with Date type instead of string in the prop's interface for value and onChange?

placeholder="DD"
value={day}
onChange={handleDayChange}
data-cy="dob-day-input"
Copy link
Member

Choose a reason for hiding this comment

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

forgot to remove this?

Suggested change
data-cy="dob-day-input"

Comment on lines +40 to +46
<Input
type="number"
placeholder="DD"
value={day}
onChange={handleDayChange}
data-cy="dob-day-input"
/>
Copy link
Member

@rithviknishad rithviknishad Jan 21, 2025

Choose a reason for hiding this comment

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

can we restrict the individual inputs to it's respective possible values?

day - min: 1, max: 31, similarly for month and year too respectively.

Suggested change
<Input
type="number"
placeholder="DD"
value={day}
onChange={handleDayChange}
data-cy="dob-day-input"
/>
<Input
type="number"
placeholder="DD"
value={day}
onChange={handleDayChange}
min={0}
max={31}
data-cy="dob-day-input"
/>

Comment on lines +15 to +20
const handleDayChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newDay = e.target.value;
if (onChange) {
onChange(`${year || ""}-${month || ""}-${newDay}`);
}
};
Copy link
Member

@rithviknishad rithviknishad Jan 21, 2025

Choose a reason for hiding this comment

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

the implementation of date input in existing PatientRegistration form had auto focus change once a valid value is inputted, can we preserve that logic in this too?

ref:

const month = parseInt(e.target.value);
if (
e.target.value.length === 2 &&
month >= 1 &&
month <= 12
) {
document
.getElementById("dob-year-input")
?.focus();
}
}}

Comment on lines +6 to +9
interface DateFieldProps {
value?: string;
onChange?: (value: string) => void;
}
Copy link
Member

@rithviknishad rithviknishad Jan 21, 2025

Choose a reason for hiding this comment

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

let's also add disabled: boolean and id: string props too.

id is required for cypress tests to recognise and use these inputs.

Copy link
Contributor Author

@NikhilA8606 NikhilA8606 Jan 22, 2025

Choose a reason for hiding this comment

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

What is the need of disabled props is here?
@rithviknishad

Copy link
Member

Choose a reason for hiding this comment

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

let's follow similar file naming conventions on how other reusable components are named here.

date-field.tsx instead of datefield.tsx.

I'd go with date-text-input.tsx since that'd more confidently convey what the component exactly is.

@github-actions github-actions bot added the merge conflict pull requests with merge conflict label Jan 21, 2025
Copy link

👋 Hi, @NikhilA8606,
Conflicts have been detected against the base branch. Please rebase your branch against the base branch.


This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge conflict pull requests with merge conflict work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replacing older UI components with new UI components
3 participants