-
Notifications
You must be signed in to change notification settings - Fork 31
Migrate create_report/ to Typescript #17
Migrate create_report/ to Typescript #17
Conversation
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.
LGTM
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.
Thanks for the changes. Some minor comments and I think otherwise looks good.
const [reportSettingsDashboard, setReportSettingsDashboard] = useState(''); | ||
const [deliveryEmailSubject, setDeliveryEmailSubject] = useState(''); | ||
const [deliveryEmailBody, setDeliveryEmailBody] = useState(''); | ||
const [scheduleRadioFutureDateSelected, setScheduleRadioFutureDateSelected] = useState(false); | ||
const [scheduleRadioRecurringSelected, setScheduleRadioRecurringSelected] = useState(false); | ||
const [scheduleUTCOffset, setScheduleUTCOffset] = useState(0); | ||
const [scheduleFutureDate, setScheduleFutureDate] = useState(moment()); | ||
const [scheduleRecurringFrequency, setScheduleRecurringFrequency] = useState('Daily'); | ||
const [scheduleRecurringUTCOffset, setScheduleRecurringUTCOffset] = useState(0); | ||
const [scheduleRecurringWeeklyDayOfWeek, setScheduleRecurringWeeklyDayOfWeek] = useState('Monday'); | ||
const [scheduleRecurringStartDate, setScheduleRecurringStartDate] = useState(moment()); | ||
const [scheduleRadioIdSelected, setScheduleRadioIdSelected] = useState(`${idPrefix}7`); |
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.
Use can also use useState
with object. Such as
const reportState = useState<CreateReportState>({
....otherstates.
})
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.
Would I be defining the other states in CreateReportState
? Otherwise I don't think I fully understand the added benefit
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.
Correct you can create a State which contains all the required info and move this inside une useState. to simplify
{ value: -10, text: 'HST -10:00' } | ||
]; | ||
|
||
const ScheduleFutureDatePicker = () => { |
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.
You could move all individual components out to simplify and better readability.
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.
Just put TODO to simplified useState
.
Issue #, if available:
#7
Description of changes:
Migrate all files in
create_report/
to Typescript. All UI will be migrated to Typescript after this PR and #14 are merged.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.