Skip to content

Refactor function or property names #31

@rubycho

Description

@rubycho

common

  • acc will be named as {type}Acc
  • item will be named as {type}

utils.js

  • getFormattedDate(date, format) to formatDate(date, format)
  • getCurrentMonth(date) will be removed by lint
  • genDayOfWeek(DayOfWeekString) to genDateBlock(dayOW), which dayOW means dayOfWeek
  • str2numberString in genDayOfWeek to dayOWMap
  • genTimeBlock(dayOfWeek, hours, minutes) to genTimeBlock(dayOW, hours, minutes)
  • addColor(events) to assignColor(events)
  • hashString(s) will be removed by lint
  • colorGenerator(num) to pickColor(idx), color_list to colorList

TimeTableView.js

  • props numberOfDays to nDays
  • props formatDateHeader to dateHeaderFormat
  • props selectedDate and pivotDate should be fixed and linted
  • state currentMoment to currentDate
  • generateTimes(pivotTime, endPivotTime) to genTimes(pivotTime, endPivotTime) or better syntax

Header.js

  • getFontSizeHeader(numberOfDays) to headerFontSize(nDays)
  • getDayTextStyles(numberOfDays) to dayTextStyle(nDays)
  • getColumns(numberOfDays, selectedDate) to datesFrom...(nDays, ...)
  • Columns({ columns, numberOfDays, format}) to DaysHeader({ dates, nDays, format }) and remove Column Component.
  • Title role seems to be speicifed. It is empty.
  • WeekViewHeader props numberOfDays to nDays
  • WeekViewHeader props selectedDate to ...
  • WeekViewHeader props formatDate to dateFormat

Events.js

  • Events to EventTable
  • getEventsByNumberOfDays(numberOfDays, events, selectedDate) to catEventsByDays(nDays, events, ...)
  • getStyleForEvent(item) to calcEventStyle(event)
  • getEventsWithPosition(totalEvents) to adjustEventStyle(allEvents)
  • getEventItemWidth; change as const (if hooks)
  • sortEventByDates(events) to sortEventsByDate(events)
  • Events props numberOfDays to nDays
  • Events props selectedDate to ...

Event.js

  • currently no item available

selectedDate

  • TimeTableView is saving props pivotDate to state currentMoment. And in UNSAFE_componentWillReceiveProps, it updates currentMoment as undocumented props selectedDate. And currentMoment is injected to child components. Will there be scenarios using selectedDate? In my current view, we could just remove that state and just use pivotDate, renaming all selectedDate items to pivotDate.

Extra alert

  • Variable names on function could also change, based on new function name.
  • Using old function names which is revealed to user, will be allowed until future v.1.0.6; with aliasing + deprecation notice in documentation. After that we may remove the alias codes.

Please feel free to comment for discussion, related to above items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions