This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type FormsState = { | |
+user: { | |
+initialState: UserForm, | |
+changedState: { +[id: Id]: UserForm }, | |
}, | |
}; | |
export type State = { | |
+forms: FormsState, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type UserForm = { | |
+name: string, | |
+description: string, | |
+likesCats: boolean, | |
+likesDogs: boolean, | |
+gender: null | 'male' | 'female' | 'other', | |
+wantsKing: boolean, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
import type { Style, Theme } from '../themes/types'; | |
import React from 'react'; | |
import { createComponent } from 'react-fela'; | |
// TODO: | |
// Exact<PropType> on Component props. | |
// Text.style(props) should by typed. | |
// Text.Props like React.Element, how React does it? | |
// Autocomplete for props. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Link to={`/people/${viewer.id}`}> | |
<div style={{ display: 'none' }}> | |
<ProfilePage params={{ id: viewer.id }} /> | |
</div> | |
<FormattedMessage {...messages.yourPublicProfile} /> | |
</Link> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: Run epic on app start if geolocation was already explicitly requested. | |
const watchAppPositionEpic = (action$, { geolocation }) => { | |
const geolocation$ = Observable.create(observer => { | |
const onNext = (position: Position) => { | |
const action = watchAppPositionNext(geopositionToObject(position)); | |
observer.next(action); | |
}; | |
const onError = ({ code, message }: PositionError) => { | |
const action = watchAppPositionFail({ code, message }); | |
observer.next(action); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BrowserHistory from 'react-history/BrowserHistory' | |
import React from 'react'; | |
import Test from './Test'; | |
import { Provider as Redux } from 'react-redux'; | |
import { StaticRouter } from 'react-router'; | |
import { connect } from 'react-redux'; | |
import { setLocation } from '../../common/app/actions'; | |
// Some component wrapped by pure container. | |
const Test = (props) => ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Helmet from 'react-helmet'; | |
import React from 'react'; | |
import linksMessages from '../../common/app/linksMessages'; | |
import { FormattedMessage } from 'react-intl'; | |
import { connect } from 'react-redux'; | |
import { fields } from '../../common/lib/redux-fields'; | |
@fields({ | |
path: 'offline', | |
fields: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Helmet from 'react-helmet'; | |
import React from 'react'; | |
import linksMessages from '../../common/app/linksMessages'; | |
import { FormattedMessage } from 'react-intl'; | |
import { connect } from 'react-redux'; | |
import { fields } from '../../common/lib/redux-fields'; | |
let OfflinePage = ({ fields, online }) => ( | |
<div className="offline-page"> | |
<FormattedMessage {...linksMessages.offline}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BaseError } from 'make-error'; | |
export default class ValidationError extends BaseError { | |
constructor(name, params = {}) { | |
super(`ValidationError: ${JSON.stringify({ name, params })}`); | |
this.name = name; | |
this.params = params; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const validateEmailAndPassword = (validate, fields) => validate(fields) | |
.prop('email') | |
.required() | |
.email() | |
.prop('password') | |
.required() | |
.simplePassword() | |
.promise; |