Skip to content

Conversation

@niko-exo
Copy link

@niko-exo niko-exo commented Jan 5, 2026

ref: https://app.clickup.com/t/86b7h2jgh

86b7h2jgh - Fix: add asterisks to mandatory fields on add new item form

Changelog

  • Add asterisks to i18n strings.
  • Add require yup validation to mandatory fields.

Links

86b7h2jgh - Add asterisks to mandatory fields

Evidence

2026-01-05_10-16-31.mp4

Summary by CodeRabbit

  • New Features
    • Sponsor form fields (name, early bird rate, standard rate, onsite rate, default quantity) now show required-field indicators to clarify mandatory inputs, improving form validation visibility and reducing submission errors.
    • Shared text input component now supports marking fields as required and displays an asterisk on labels for consistent required-field UX across the app, ensuring uniform behavior and clearer prompts.

✏️ Tip: You can customize this high-level summary in your review settings.

src/i18n/en.json Outdated
"standard_rate": "Standard rate",
"onsite_rate": "On site rate",
"default_quantity": "Default quantity",
"name": "Name *",
Copy link

Choose a reason for hiding this comment

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

@niko-exo i do thnk that i would be better to update the fields like
https://github.com/fntechgit/summit-admin/blob/cf8c1749e92a5c08b60bf5803010a63e9417e5d0/src/components/mui/formik-inputs/mui-formik-textfield.js to support the required attr instead of change labels

Copy link
Author

Choose a reason for hiding this comment

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

I've removed the asterisks and modified the text field to have the same logic as te datepicker.

early_bird_rate: decimalValidation(),
standard_rate: decimalValidation(),
onsite_rate: decimalValidation(),
early_bird_rate: decimalValidation().required(
Copy link

Choose a reason for hiding this comment

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

@niko-exo please rebase against main and review
we already addd required to decimal validation

onsite_rate: decimalValidation().required(
T.translate("validation.required")
),
default_quantity: numberValidation()
Copy link

Choose a reason for hiding this comment

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

@niko-exo also please check this
default_quantity: positiveNumberValidation(),
quantity_limit_per_sponsor: positiveNumberValidation(),
quantity_limit_per_show: positiveNumberValidation(),
meta_fields: formMetafieldsValidation()

Copy link

@smarcet smarcet left a comment

Choose a reason for hiding this comment

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

@niko-exo please review comments

@niko-exo
Copy link
Author

Branch rebased

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Added a required prop to the reusable MuiFormikTextField so labels can show an asterisk; updated the sponsor form to pass required for name, early_bird_rate, standard_rate, onsite_rate, and default_quantity fields to mark them mandatory in the UI.

Changes

Cohort / File(s) Summary
Form component
src/components/mui/formik-inputs/mui-formik-textfield.js
Added required prop (default false); compute finalLabel and render it so label shows " *" when required. Updated PropTypes.
Sponsor form fields
src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-form.js
Passed required to fields: name, early_bird_rate, standard_rate, onsite_rate, default_quantity to display required indicators.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • smarcet

Poem

A rabbit hops through lines of code,
Adds tiny stars along the road,
Fields now sparkle, tidy, bright,
Guiding users through the night,
✨🐇

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding asterisks to mandatory fields in the add new item form, which aligns with the PR's core objective of improving UX for required form fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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: 2

🤖 Fix all issues with AI agents
In `@src/i18n/en.json`:
- Around line 2579-2583: Remove the trailing asterisks from the base keys
sponsor_form_item_list.name, sponsor_form_item_list.early_bird_rate,
sponsor_form_item_list.standard_rate, sponsor_form_item_list.onsite_rate, and
sponsor_form_item_list.default_quantity and add those asterisks to the
corresponding edit form keys: sponsor_form_item_list.edit_item.name,
sponsor_form_item_list.edit_item.early_bird_rate,
sponsor_form_item_list.edit_item.standard_rate,
sponsor_form_item_list.edit_item.onsite_rate, and
sponsor_form_item_list.edit_item.default_quantity so the add/edit form uses the
translated labels with asterisks while the table headers remain plain.

In
`@src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-form.js`:
- Around line 76-80: positiveNumberValidation() in utils/yup.js is missing
.required(), so fields using it (default_quantity, quantity_limit_per_sponsor,
quantity_limit_per_show) are allowed empty despite UI requiring them; update
positiveNumberValidation() to include .required() (like decimalValidation()
does) and keep the existing positive/number constraints so those three form
fields are validated as required and non-negative integers.

src/i18n/en.json Outdated
Comment on lines 2579 to 2583
"name": "Name *",
"early_bird_rate": "Early bird rate *",
"standard_rate": "Standard rate *",
"onsite_rate": "On site rate *",
"default_quantity": "Default quantity *",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

rg -n -C2 'sponsor_form_item_list\.(name|early_bird_rate|standard_rate|onsite_rate|default_quantity)\b' -g '!**/node_modules/**'

Repository: fntechgit/summit-admin

Length of output: 2285


🏁 Script executed:

rg -n -C2 'sponsor_form_item_list\.edit_item\.(name|early_bird_rate|standard_rate|onsite_rate|default_quantity)\b' -g '!**/node_modules/**'

Repository: fntechgit/summit-admin

Length of output: 3203


Update asterisks to the correct translation keys for the add/edit form.

The asterisks were added to sponsor_form_item_list.* (table column headers), but the add/edit form uses sponsor_form_item_list.edit_item.* keys instead. The asterisks will not appear in the form. Move them to:

  • sponsor_form_item_list.edit_item.name
  • sponsor_form_item_list.edit_item.early_bird_rate
  • sponsor_form_item_list.edit_item.standard_rate
  • sponsor_form_item_list.edit_item.onsite_rate
  • sponsor_form_item_list.edit_item.default_quantity

Remove asterisks from the base keys (lines 2579-2583) since they are used only for table headers.

🤖 Prompt for AI Agents
In `@src/i18n/en.json` around lines 2579 - 2583, Remove the trailing asterisks
from the base keys sponsor_form_item_list.name,
sponsor_form_item_list.early_bird_rate, sponsor_form_item_list.standard_rate,
sponsor_form_item_list.onsite_rate, and sponsor_form_item_list.default_quantity
and add those asterisks to the corresponding edit form keys:
sponsor_form_item_list.edit_item.name,
sponsor_form_item_list.edit_item.early_bird_rate,
sponsor_form_item_list.edit_item.standard_rate,
sponsor_form_item_list.edit_item.onsite_rate, and
sponsor_form_item_list.edit_item.default_quantity so the add/edit form uses the
translated labels with asterisks while the table headers remain plain.

Comment on lines 76 to 80
name="name"
label={T.translate("sponsor_form_item_list.edit_item.name")}
fullWidth
required
/>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find yup utility files
find src -type f \( -name '*yup*' -o -name '*validation*' \) | head -20

Repository: fntechgit/summit-admin

Length of output: 82


🏁 Script executed:

cat -n src/utils/yup.js

Repository: fntechgit/summit-admin

Length of output: 6358


🏁 Script executed:

cat -n src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-form.js | head -200

Repository: fntechgit/summit-admin

Length of output: 7438


Only positiveNumberValidation() lacks required enforcement; decimalValidation() already has it.

The form uses noValidate, so native HTML5 checks are disabled. However, the issue is narrower than stated: decimalValidation() (line 45-54 in utils/yup.js) already includes .required() on line 50, so early_bird_rate, standard_rate, and onsite_rate are properly validated.

The actual problem is positiveNumberValidation() (line 90-93 in utils/yup.js) does not include .required(). This means default_quantity (line 152), quantity_limit_per_sponsor, and quantity_limit_per_show can pass validation even when empty, despite the UI marking them required or accepting empty values.

Required fix
export const positiveNumberValidation = () =>
  numberValidation()
    .integer(T.translate("validation.integer"))
-   .min(0, T.translate("validation.number_positive"));
+   .required(T.translate("validation.required"))
+   .min(0, T.translate("validation.number_positive"));
🤖 Prompt for AI Agents
In
`@src/pages/sponsors/sponsor-form-item-list-page/components/sponsor-form-item-form.js`
around lines 76 - 80, positiveNumberValidation() in utils/yup.js is missing
.required(), so fields using it (default_quantity, quantity_limit_per_sponsor,
quantity_limit_per_show) are allowed empty despite UI requiring them; update
positiveNumberValidation() to include .required() (like decimalValidation()
does) and keep the existing positive/number constraints so those three form
fields are validated as required and non-negative integers.

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/components/mui/formik-inputs/mui-formik-textfield.js`:
- Around line 6-10: The component builds finalLabel by concatenating required to
label, which can produce "undefined *" when label is missing; update the
MuiFormikTextField logic (around finalLabel) to guard for empty/undefined label
by using a safe default or conditional concat (e.g., only append " *" when label
is truthy, or derive finalLabel from label ?? '' and then append the required
marker), ensuring finalLabel never becomes "undefined *" while preserving
required behavior.
🧹 Nitpick comments (1)
src/components/mui/formik-inputs/mui-formik-textfield.js (1)

14-22: Add semantic required to TextField (a11y) and avoid double indicators.
Right now required only affects the label string. Consider passing required={required} so the input is semantically required (ARIA/HTML). If you keep the manual " *" suffix, suppress MUI’s built‑in asterisk to avoid duplication.

🛠️ Suggested tweak (verify MUI behavior)
       <TextField
         name={name}
         label={finalLabel}
+        required={required}
+        InputLabelProps={{ required: false }}
         {...field}
 MuiFormikTextField.propTypes = {
   name: PropTypes.string.isRequired,
   label: PropTypes.string,
-  maxLength: PropTypes.number
+  maxLength: PropTypes.number,
+  required: PropTypes.bool
 };

@niko-exo
Copy link
Author

Ready for review!

const [field, meta] = useField(name);
const currentLength = field.value?.length || 0;

const finalLabel = required ? `${label} *` : label;
Copy link

Choose a reason for hiding this comment

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

@niko-exo label attribute is marked as not required
please add a check and set finalLabel as empty to avoid "* undefined"

Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Good catch!

@fntechgit fntechgit deleted a comment from coderabbitai bot Jan 21, 2026
import { useField } from "formik";

const MuiFormikTextField = ({ name, label, maxLength, ...props }) => {
const MuiFormikTextField = ({ name, label, maxLength, required, ...props }) => {
Copy link

Choose a reason for hiding this comment

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

@niko-exo please add requred to prop types and define it with default value as false

Copy link
Author

Choose a reason for hiding this comment

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

Added!

Copy link

@smarcet smarcet left a comment

Choose a reason for hiding this comment

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

@niko-exo please review comments

@niko-exo
Copy link
Author

Ready for review!

@niko-exo niko-exo requested a review from smarcet January 21, 2026 15:01
Copy link

@smarcet smarcet left a comment

Choose a reason for hiding this comment

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

LGTM

@smarcet smarcet merged commit ad28403 into master Jan 21, 2026
9 checks passed
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.

3 participants