Simplify rules setup UI and polish resident dashboard#1
Simplify rules setup UI and polish resident dashboard#1sarwarkaiser wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50c6f1c5c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <input | ||
| value={aiPrompt} | ||
| onChange={(e) => setAiPrompt(e.target.value)} | ||
| placeholder="e.g. Max 4 shifts per month..." | ||
| className="flex-1 rounded border p-2 text-sm dark:bg-gray-700 dark:border-gray-600" | ||
| onKeyDown={(e) => e.key === 'Enter' && handleAiProcess()} | ||
| /> |
There was a problem hiding this comment.
Prevent AI prompt Enter key from submitting form
The AI helper input sits inside the constraint <form>, and its onKeyDown handler triggers handleAiProcess when Enter is pressed but does not prevent the default form submit. In a filled-out form, pressing Enter to “generate” will also submit the form immediately, creating a constraint with the pre-AI state (or partially updated values) before the AI timeout updates the fields. Previously the AI UI was outside the form, so this submission side-effect is new. Consider calling e.preventDefault() (or moving the AI prompt outside the form) so Enter only triggers the AI helper.
Useful? React with 👍 / 👎.
Motivation
Description
components/admin/rules/RulesManager.tsxto introduceconstraintTypestate, persist the selected type into the form via a hidden input and append it to form data on submit, replace the old AI toggle with andetails-based advanced AI helper, and convert the plugin/type selectors into clearer button/cards with a single settings panel and preview.showAiAssist/activePluginusages and consolidated the constraint creation UI to a three-step flow (name → type → plugin → settings).components/resident/ResidentDashboard.tsxto addResidentDashboardPropstyping, aformatShiftDatehelper, safer optional-field handling (default fallbacks for names/times/sites), and a visual refresh (hero metrics, next-shift details card, improved cards, color and spacing polish).Testing
Codex Task