Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Feature schedule #2

Merged
merged 20 commits into from
Jul 31, 2018
Merged

Feature schedule #2

merged 20 commits into from
Jul 31, 2018

Conversation

SIARHEI-SMANTSAR
Copy link
Member

API

package.json Outdated
"luxon": "1.3.1",
"moment": "2.22.2",
Copy link
Member

Choose a reason for hiding this comment

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

have you considered a https://github.com/date-fns/date-fns?

Copy link
Member

Choose a reason for hiding this comment

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

actually, why do you need moment while we have luxon (line above) ? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not notice luxon )

"axios": "0.18.0",
"bootstrap": "4.1.1",
"classnames": "2.2.6",
"core-js": "2.5.7",
"history": "4.7.2",
"is-url": "1.2.4",
Copy link
Member

Choose a reason for hiding this comment

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

do you really need a dependency for this? 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

why not? Why not reuse something that already exists?

@@ -7,7 +7,7 @@ import { EDUCATION_YEARS, EMPTY_FACULTY, UNIVERSITIES } from '../../reference-da

function mapStateToProps(state: any) {
Copy link
Member

Choose a reason for hiding this comment

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

just a recommendation, feel free to ignore:
mapStateToProps doesn't seem to be a complex selector here, but in general I'd suggest move this alongside with connect to separate file

We've had the following structure which worked well for us

SomePage.js – just a component
connect.js – mapStateToProps, mapDispatchToProps, connect
index.js imports both SomePage and connect, exports connected page

But that's probably just a matter of sense


type InputType = 'text' | 'tel' | 'email' | 'date' | 'datetime-local' | 'select';

class ReduxFormInput extends React.PureComponent<React.InputHTMLAttributes<HTMLInputElement> & WrappedFieldProps> {
Copy link
Member

Choose a reason for hiding this comment

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

Messing with internal types from react is not a good idea

Our team had an issue with definitions where we were extending internal classes, but react team changed the hierarchy and everything was broken at some point

Copy link
Member Author

Choose a reason for hiding this comment

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

This can happen when you raise the version of the React?

import * as React from 'react';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';

type ModalDeleteProps = {
Copy link
Member

Choose a reason for hiding this comment

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

why not interface?

this.setState({ stage, isOpenModalStage: !this.state.isOpenModalStage });
};

toggleModalEvent = (
Copy link
Member

Choose a reason for hiding this comment

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

don't really understand what is it and how does it work

}
}

export default Schedule;
Copy link
Member

Choose a reason for hiding this comment

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

Component is heavy and could be splited into smaller pieces

} from '../api';

export function fetchEventsAndStages(courseId: string) {
return async (dispatch: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

consider using some middleware for async stuff


import { IEvent, IEventDocument, IStageDocument, IStage } from '../models';

type EventsResponse = {
Copy link
Member

Choose a reason for hiding this comment

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

what the motivation behind a decision to use types instead of interfaces?

Copy link
Member

Choose a reason for hiding this comment

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

my guess: here type is about specific thing which doesn't require extension and sharing with other types.

stages: IStageDocument[],
): NormalizeScheduleData[] => {
const sortedEvents = events
.reduce<INormalizeEvent[]>((res, event) => {
Copy link
Member

Choose a reason for hiding this comment

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

you don't really need pass a type to reduce, ts understands return value of reduce

@dzmitry-varabei dzmitry-varabei merged commit 65017a4 into master Jul 31, 2018
la-nuta added a commit to la-nuta/rsschool-ui that referenced this pull request Aug 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants