-
Notifications
You must be signed in to change notification settings - Fork 4
Declare propTypes across the Core UI components #316
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
base: main
Are you sure you want to change the base?
Changes from all commits
e2fd2d6
09a13ab
936698d
1a63093
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| **/ | ||
|
|
||
| import React from 'react' | ||
| import PropTypes from 'prop-types'; | ||
| import 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css' | ||
| import Input from '../inputs/text-input' | ||
| import Dropdown from '../inputs/dropdown' | ||
|
|
@@ -164,4 +165,30 @@ class RsvpForm extends React.Component { | |
| } | ||
| } | ||
|
|
||
| RsvpForm.propTypes = { | ||
| /** Rendered by class_name, e.g. RSVPTextBoxQuestionTemplate or RSVPCheckBoxListQuestionTemplate. */ | ||
| questions: PropTypes.arrayOf(PropTypes.shape({ | ||
| /** Must be a number: handleChange compares answer.question_id to parseInt(id) with strict equality, which never matches a string id. */ | ||
| id: PropTypes.number.isRequired, | ||
| /** Selects the widget; unknown values render nothing. */ | ||
| class_name: PropTypes.string.isRequired, | ||
| name: PropTypes.string, | ||
| /** Injected as raw HTML. */ | ||
| label: PropTypes.string, | ||
| is_mandatory: PropTypes.bool, | ||
| values: PropTypes.array, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- file outline ---'
ast-grep outline src/components/forms/rsvp-form.js --match 'RsvpForm' --view expanded || true
printf '%s\n' '--- relevant declarations and rendering branches ---'
sed -n '1,230p' src/components/forms/rsvp-form.js
printf '%s\n' '--- question-value consumers ---'
rg -n -C 3 'q\.values|values\.map|CheckboxList|RadioList|country' srcRepository: OpenStackweb/openstack-uicore-foundation Length of output: 35882 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- child component contracts and option usage ---'
sed -n '1,180p' src/components/inputs/checkbox-list.js
sed -n '1,165p' src/components/inputs/radio-list.js
sed -n '1,210p' src/components/inputs/dropdown.js
printf '%s\n' '--- RSVP question fixtures and producers ---'
rg -n -C 5 'RSVP(CheckBoxList|RadioButtonList|DropDown)QuestionTemplate|is_country_selector|"values"|values:' src/utils src/components --glob '!*.map'Repository: OpenStackweb/openstack-uicore-foundation Length of output: 50397 Validate Require 🤖 Prompt for AI Agents |
||
| /** RSVPLiteralContentQuestionTemplate: raw HTML content rendered via RawHTML. */ | ||
| value: PropTypes.string, | ||
| /** RSVPDropDownQuestionTemplate: when true, values are remapped to {value: id, label: value}. */ | ||
| is_country_selector: PropTypes.bool, | ||
| /** RSVPDropDownQuestionTemplate: passed through to the Dropdown as isMulti. */ | ||
| is_multiselect: PropTypes.bool, | ||
| /** RSVPDropDownQuestionTemplate: used as the Dropdown's placeholder. */ | ||
| empty_string: PropTypes.string | ||
| })).isRequired, | ||
| /** Receives the collected answers array on submit. Omit to render a display-only form with no submit button. */ | ||
| onSubmit: PropTypes.func, | ||
| /** Keyed by question id. Read into state at mount with no fallback; hasErrors() throws if omitted. */ | ||
| errors: PropTypes.object.isRequired | ||
| }; | ||
| export default RsvpForm; | ||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 12512
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 10718
🏁 Script executed:
Repository: OpenStackweb/openstack-uicore-foundation
Length of output: 903
Preserve numeric
nowoverrides.When
nowis0, the truthiness check falls back togetServerTime()andrender()hides the timestamp. Whennowis nonzero,manualSetremains false, so a visibility change can replace the override with server time. Checknowagainstnullandundefined, setmanualSet = true, and usetimestamp !== nullfor state updates and rendering. Add regression tests for zero and nonzero overrides.🤖 Prompt for AI Agents