diff options
author | Fabio Berger <me@fabioberger.com> | 2017-12-22 04:24:54 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-12-22 04:24:54 +0800 |
commit | e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9 (patch) | |
tree | 241b630db5044974cc17130f149ca64728d9c619 /packages/website/ts/pages | |
parent | d725de72861c6a6218c7f4822a339175a2da7403 (diff) | |
parent | cb3582289ff94857d5956bbd71dbf68ee3f42ecf (diff) | |
download | dexon-0x-contracts-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.gz dexon-0x-contracts-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.tar.zst dexon-0x-contracts-e01c0f054d2dbb043aec8b4cb8e1c47f83bd5eb9.zip |
Merge branch 'development' into fix/docLinks
* development:
Update and standardize contracts README
Add to CHANGELOG
Refactor toBaseUnitAmount so that it throws if user supplies unitAmount with too many decimals
Make assertion stricter so that one cannot submit invalid baseUnit amounts to `toUnitAmount`
Add some missed underscores, update changelog and comments
Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors
# Conflicts:
# packages/website/ts/pages/documentation/documentation.tsx
# packages/website/ts/pages/shared/nested_sidebar_menu.tsx
Diffstat (limited to 'packages/website/ts/pages')
15 files changed, 125 insertions, 125 deletions
diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index e9e876f45..722e819ff 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -188,10 +188,10 @@ export class About extends React.Component<AboutProps, AboutState> { </div> <div className="pt3 md-px4 lg-px0"> <div className="clearfix pb3"> - {this.renderProfiles(teamRow1)} + {this._renderProfiles(teamRow1)} </div> <div className="clearfix"> - {this.renderProfiles(teamRow2)} + {this._renderProfiles(teamRow2)} </div> </div> <div className="pt3 pb2"> @@ -202,7 +202,7 @@ export class About extends React.Component<AboutProps, AboutState> { Advisors: </div> <div className="clearfix"> - {this.renderProfiles(advisors)} + {this._renderProfiles(advisors)} </div> </div> <div className="mx-auto py4 sm-px3" style={{maxWidth: 308}}> @@ -232,7 +232,7 @@ export class About extends React.Component<AboutProps, AboutState> { </div> ); } - private renderProfiles(profiles: ProfileInfo[]) { + private _renderProfiles(profiles: ProfileInfo[]) { const numIndiv = profiles.length; const colSize = utils.getColSize(numIndiv); return _.map(profiles, profile => { diff --git a/packages/website/ts/pages/documentation/docs_info.ts b/packages/website/ts/pages/documentation/docs_info.ts index 1afcf8aaf..b88b247e8 100644 --- a/packages/website/ts/pages/documentation/docs_info.ts +++ b/packages/website/ts/pages/documentation/docs_info.ts @@ -19,7 +19,7 @@ export class DocsInfo { public menu: DocsMenu; public sections: SectionsMap; public sectionNameToMarkdown: {[sectionName: string]: string}; - private docsInfo: DocsInfoConfig; + private _docsInfo: DocsInfoConfig; constructor(config: DocsInfoConfig) { this.displayName = config.displayName; this.packageUrl = config.packageUrl; @@ -28,32 +28,32 @@ export class DocsInfo { this.docsJsonRoot = config.docsJsonRoot; this.sections = config.sections; this.sectionNameToMarkdown = config.sectionNameToMarkdown; - this.docsInfo = config; + this._docsInfo = config; } public isPublicType(typeName: string): boolean { - if (_.isUndefined(this.docsInfo.publicTypes)) { + if (_.isUndefined(this._docsInfo.publicTypes)) { return false; } - const isPublic = _.includes(this.docsInfo.publicTypes, typeName); + const isPublic = _.includes(this._docsInfo.publicTypes, typeName); return isPublic; } public getModulePathsIfExists(sectionName: string): string[] { - const modulePathsIfExists = this.docsInfo.sectionNameToModulePath[sectionName]; + const modulePathsIfExists = this._docsInfo.sectionNameToModulePath[sectionName]; return modulePathsIfExists; } public getMenu(selectedVersion?: string): {[section: string]: string[]} { - if (_.isUndefined(selectedVersion) || _.isUndefined(this.docsInfo.menuSubsectionToVersionWhenIntroduced)) { - return this.docsInfo.menu; + if (_.isUndefined(selectedVersion) || _.isUndefined(this._docsInfo.menuSubsectionToVersionWhenIntroduced)) { + return this._docsInfo.menu; } - const finalMenu = _.cloneDeep(this.docsInfo.menu); + const finalMenu = _.cloneDeep(this._docsInfo.menu); if (_.isUndefined(finalMenu.contracts)) { return finalMenu; } // TODO: refactor to include more sections then simply the `contracts` section finalMenu.contracts = _.filter(finalMenu.contracts, (contractName: string) => { - const versionIntroducedIfExists = this.docsInfo.menuSubsectionToVersionWhenIntroduced[contractName]; + const versionIntroducedIfExists = this._docsInfo.menuSubsectionToVersionWhenIntroduced[contractName]; if (!_.isUndefined(versionIntroducedIfExists)) { const existsInSelectedVersion = compareVersions(selectedVersion, versionIntroducedIfExists) >= 0; @@ -104,9 +104,9 @@ export class DocsInfo { return typeDefinitionByName; } public isVisibleConstructor(sectionName: string): boolean { - return _.includes(this.docsInfo.visibleConstructors, sectionName); + return _.includes(this._docsInfo.visibleConstructors, sectionName); } public convertToDocAgnosticFormat(docObj: DoxityDocObj|TypeDocNode): DocAgnosticFormat { - return this.docsInfo.convertToDocAgnosticFormatFn(docObj, this); + return this._docsInfo.convertToDocAgnosticFormatFn(docObj, this); } } diff --git a/packages/website/ts/pages/documentation/documentation.tsx b/packages/website/ts/pages/documentation/documentation.tsx index 4d3607d76..1731c19fe 100644 --- a/packages/website/ts/pages/documentation/documentation.tsx +++ b/packages/website/ts/pages/documentation/documentation.tsx @@ -93,7 +93,7 @@ export class Documentation extends const versions = findVersions(lastSegment); const preferredVersionIfExists = versions.length > 0 ? versions[0] : undefined; // tslint:disable-next-line:no-floating-promises - this.fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists); + this._fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists); } public render() { const menuSubsectionsBySection = _.isUndefined(this.state.docAgnosticFormat) ? @@ -157,7 +157,7 @@ export class Documentation extends {this.props.docsInfo.displayName} </a> </h1> - {this.renderDocumentation()} + {this._renderDocumentation()} </div> </div> </div> @@ -165,16 +165,16 @@ export class Documentation extends </div> ); } - private renderDocumentation(): React.ReactNode { + private _renderDocumentation(): React.ReactNode { const subMenus = _.values(this.props.docsInfo.getMenu()); const orderedSectionNames = _.flatten(subMenus); const typeDefinitionByName = this.props.docsInfo.getTypeDefinitionsByName(this.state.docAgnosticFormat); - const renderedSections = _.map(orderedSectionNames, this.renderSection.bind(this, typeDefinitionByName)); + const renderedSections = _.map(orderedSectionNames, this._renderSection.bind(this, typeDefinitionByName)); return renderedSections; } - private renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode { + private _renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode { const markdownFileIfExists = this.props.docsInfo.sectionNameToMarkdown[sectionName]; if (!_.isUndefined(markdownFileIfExists)) { return ( @@ -204,12 +204,12 @@ export class Documentation extends }); const sortedProperties = _.sortBy(docSection.properties, 'name'); - const propertyDefs = _.map(sortedProperties, this.renderProperty.bind(this, sectionName)); + const propertyDefs = _.map(sortedProperties, this._renderProperty.bind(this, sectionName)); const sortedMethods = _.sortBy(docSection.methods, 'name'); const methodDefs = _.map(sortedMethods, method => { const isConstructor = false; - return this.renderMethodBlocks(method, sectionName, isConstructor, typeDefinitionByName); + return this._renderMethodBlocks(method, sectionName, isConstructor, typeDefinitionByName); }); const sortedEvents = _.sortBy(docSection.events, 'name'); @@ -232,7 +232,7 @@ export class Documentation extends <div style={{marginRight: 7}}> <SectionHeader sectionName={sectionName} /> </div> - {this.renderNetworkBadgesIfExists(sectionName)} + {this._renderNetworkBadgesIfExists(sectionName)} </div> {docSection.comment && <Comment @@ -243,7 +243,7 @@ export class Documentation extends this.props.docsInfo.isVisibleConstructor(sectionName) && <div> <h2 className="thin">Constructor</h2> - {this.renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)} + {this._renderConstructors(docSection.constructors, sectionName, typeDefinitionByName)} </div> } {docSection.properties.length > 0 && @@ -272,7 +272,7 @@ export class Documentation extends </div> ); } - private renderNetworkBadgesIfExists(sectionName: string) { + private _renderNetworkBadgesIfExists(sectionName: string) { const networkToAddressByContractName = configs.CONTRACT_ADDRESS[this.props.docsVersion]; const badges = _.map(networkToAddressByContractName, (addressByContractName: AddressByContractName, networkName: string) => { @@ -299,11 +299,11 @@ export class Documentation extends }); return badges; } - private renderConstructors(constructors: SolidityMethod[]|TypescriptMethod[], - sectionName: string, - typeDefinitionByName: TypeDefinitionByName): React.ReactNode { + private _renderConstructors(constructors: SolidityMethod[]|TypescriptMethod[], + sectionName: string, + typeDefinitionByName: TypeDefinitionByName): React.ReactNode { const constructorDefs = _.map(constructors, constructor => { - return this.renderMethodBlocks( + return this._renderMethodBlocks( constructor, sectionName, constructor.isConstructor, typeDefinitionByName, ); }); @@ -313,7 +313,7 @@ export class Documentation extends </div> ); } - private renderProperty(sectionName: string, property: Property): React.ReactNode { + private _renderProperty(sectionName: string, property: Property): React.ReactNode { return ( <div key={`property-${property.name}-${property.type.name}`} @@ -344,8 +344,8 @@ export class Documentation extends </div> ); } - private renderMethodBlocks(method: SolidityMethod|TypescriptMethod, sectionName: string, - isConstructor: boolean, typeDefinitionByName: TypeDefinitionByName): React.ReactNode { + private _renderMethodBlocks(method: SolidityMethod|TypescriptMethod, sectionName: string, + isConstructor: boolean, typeDefinitionByName: TypeDefinitionByName): React.ReactNode { return ( <MethodBlock key={`method-${method.name}-${sectionName}`} @@ -357,7 +357,7 @@ export class Documentation extends /> ); } - private scrollToHash(): void { + private _scrollToHash(): void { const hashWithPrefix = this.props.location.hash; let hash = hashWithPrefix.slice(1); if (_.isEmpty(hash)) { @@ -366,7 +366,7 @@ export class Documentation extends scroller.scrollTo(hash, {duration: 0, offset: 0, containerId: 'documentation'}); } - private async fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> { + private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> { const versionToFileName = await docUtils.getVersionToFileNameAsync(this.props.docsInfo.docsJsonRoot); const versions = _.keys(versionToFileName); this.props.dispatcher.updateAvailableDocVersions(versions); @@ -391,7 +391,7 @@ export class Documentation extends this.setState({ docAgnosticFormat, }, () => { - this.scrollToHash(); + this._scrollToHash(); }); } } diff --git a/packages/website/ts/pages/documentation/event_definition.tsx b/packages/website/ts/pages/documentation/event_definition.tsx index 71ec56aac..2fef019d2 100644 --- a/packages/website/ts/pages/documentation/event_definition.tsx +++ b/packages/website/ts/pages/documentation/event_definition.tsx @@ -30,8 +30,8 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event id={`${this.props.sectionName}-${event.name}`} className="pb2" style={{overflow: 'hidden', width: '100%'}} - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <AnchorTitle headerSize={HeaderSizes.H3} @@ -42,14 +42,14 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event <div style={{fontSize: 16}}> <pre> <code className="hljs"> - {this.renderEventCode()} + {this._renderEventCode()} </code> </pre> </div> </div> ); } - private renderEventCode() { + private _renderEventCode() { const indexed = <span style={{color: colors.green}}> indexed</span>; const eventArgs = _.map(this.props.event.eventArgs, (eventArg: EventArg) => { const type = ( @@ -78,7 +78,7 @@ export class EventDefinition extends React.Component<EventDefinitionProps, Event </span> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/documentation/method_block.tsx b/packages/website/ts/pages/documentation/method_block.tsx index 60dfc17db..147bc34d6 100644 --- a/packages/website/ts/pages/documentation/method_block.tsx +++ b/packages/website/ts/pages/documentation/method_block.tsx @@ -58,19 +58,19 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt id={`${this.props.sectionName}-${method.name}`} style={{overflow: 'hidden', width: '100%'}} className="pb4" - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > {!method.isConstructor && <div className="flex"> {(method as TypescriptMethod).isStatic && - this.renderChip('Static') + this._renderChip('Static') } {(method as SolidityMethod).isConstant && - this.renderChip('Constant') + this._renderChip('Constant') } {(method as SolidityMethod).isPayable && - this.renderChip('Payable') + this._renderChip('Payable') } <AnchorTitle headerSize={HeaderSizes.H3} @@ -110,7 +110,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt > ARGUMENTS </h4> - {this.renderParameterDescriptions(method.parameters)} + {this._renderParameterDescriptions(method.parameters)} </div> } {method.returnComment && @@ -129,7 +129,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt </div> ); } - private renderChip(text: string) { + private _renderChip(text: string) { return ( <div className="p1 mr1" @@ -139,7 +139,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt </div> ); } - private renderParameterDescriptions(parameters: Parameter[]) { + private _renderParameterDescriptions(parameters: Parameter[]) { const descriptions = _.map(parameters, parameter => { const isOptional = parameter.isOptional; return ( @@ -168,7 +168,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt }); return descriptions; } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/documentation/type_definition.tsx b/packages/website/ts/pages/documentation/type_definition.tsx index 77434d2ed..25499a6d0 100644 --- a/packages/website/ts/pages/documentation/type_definition.tsx +++ b/packages/website/ts/pages/documentation/type_definition.tsx @@ -114,8 +114,8 @@ export class TypeDefinition extends React.Component<TypeDefinitionProps, TypeDef id={this.props.shouldAddId ? typeDefinitionAnchorId : ''} className="pb2" style={{overflow: 'hidden', width: '100%'}} - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <AnchorTitle headerSize={HeaderSizes.H3} @@ -139,7 +139,7 @@ export class TypeDefinition extends React.Component<TypeDefinitionProps, TypeDef </div> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/faq/faq.tsx b/packages/website/ts/pages/faq/faq.tsx index 296e63f1d..c5afcb79f 100644 --- a/packages/website/ts/pages/faq/faq.tsx +++ b/packages/website/ts/pages/faq/faq.tsx @@ -459,26 +459,26 @@ export class FAQ extends React.Component<FAQProps, FAQState> { > <h1 className="center" style={{...styles.thin}}>0x FAQ</h1> <div className="sm-px2 md-px2 lg-px0 pb4"> - {this.renderSections()} + {this._renderSections()} </div> </div> <Footer /> </div> ); } - private renderSections() { + private _renderSections() { const renderedSections = _.map(sections, (section: FAQSection, i: number) => { const isFirstSection = i === 0; return ( <div key={section.name}> <h3>{section.name}</h3> - {this.renderQuestions(section.questions, isFirstSection)} + {this._renderQuestions(section.questions, isFirstSection)} </div> ); }); return renderedSections; } - private renderQuestions(questions: FAQQuestion[], isFirstSection: boolean) { + private _renderQuestions(questions: FAQQuestion[], isFirstSection: boolean) { const renderedQuestions = _.map(questions, (question: FAQQuestion, i: number) => { const isFirstQuestion = i === 0; return ( diff --git a/packages/website/ts/pages/faq/question.tsx b/packages/website/ts/pages/faq/question.tsx index 534304cc8..54ae1a592 100644 --- a/packages/website/ts/pages/faq/question.tsx +++ b/packages/website/ts/pages/faq/question.tsx @@ -27,7 +27,7 @@ export class Question extends React.Component<QuestionProps, QuestionState> { > <Card initiallyExpanded={this.props.shouldDisplayExpanded} - onExpandChange={this.onExchangeChange.bind(this)} + onExpandChange={this._onExchangeChange.bind(this)} > <CardHeader title={this.props.prompt} @@ -45,7 +45,7 @@ export class Question extends React.Component<QuestionProps, QuestionState> { </div> ); } - private onExchangeChange() { + private _onExchangeChange() { this.setState({ isExpanded: !this.state.isExpanded, }); diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 3d9ebe099..1e97ae240 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -138,20 +138,20 @@ interface LandingState { } export class Landing extends React.Component<LandingProps, LandingState> { - private throttledScreenWidthUpdate: () => void; + private _throttledScreenWidthUpdate: () => void; constructor(props: LandingProps) { super(props); this.state = { screenWidth: utils.getScreenWidth(), }; - this.throttledScreenWidthUpdate = _.throttle(this.updateScreenWidth.bind(this), THROTTLE_TIMEOUT); + this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); } public componentDidMount() { - window.addEventListener('resize', this.throttledScreenWidthUpdate); + window.addEventListener('resize', this._throttledScreenWidthUpdate); window.scrollTo(0, 0); } public componentWillUnmount() { - window.removeEventListener('resize', this.throttledScreenWidthUpdate); + window.removeEventListener('resize', this._throttledScreenWidthUpdate); } public render() { return ( @@ -163,19 +163,19 @@ export class Landing extends React.Component<LandingProps, LandingState> { isNightVersion={true} style={{backgroundColor: colors.heroGrey, position: 'relative'}} /> - {this.renderHero()} - {this.renderProjects()} - {this.renderTokenizationSection()} - {this.renderProtocolSection()} - {this.renderInfoBoxes()} - {this.renderBuildingBlocksSection()} - {this.renderUseCases()} - {this.renderCallToAction()} + {this._renderHero()} + {this._renderProjects()} + {this._renderTokenizationSection()} + {this._renderProtocolSection()} + {this._renderInfoBoxes()} + {this._renderBuildingBlocksSection()} + {this._renderUseCases()} + {this._renderCallToAction()} <Footer /> </div> ); } - private renderHero() { + private _renderHero() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const buttonLabelStyle: React.CSSProperties = { textTransform: 'none', @@ -259,7 +259,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderProjects() { + private _renderProjects() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const isMediumScreen = this.state.screenWidth === ScreenWidths.Md; const projectList = _.map(projects, (project: Project, i: number) => { @@ -323,7 +323,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderTokenizationSection() { + private _renderTokenizationSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div @@ -332,7 +332,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { > <div className="mx-auto max-width-4 py4 clearfix"> {isSmallScreen && - this.renderTokenCloud() + this._renderTokenCloud() } <div className="col lg-col-6 md-col-6 col-12"> <div className="mx-auto" style={{maxWidth: 385, paddingTop: 7}}> @@ -365,18 +365,18 @@ export class Landing extends React.Component<LandingProps, LandingState> { } </div> <div className="flex pt1 sm-px3"> - {this.renderAssetTypes()} + {this._renderAssetTypes()} </div> </div> </div> {!isSmallScreen && - this.renderTokenCloud() + this._renderTokenCloud() } </div> </div> ); } - private renderProtocolSection() { + private _renderProtocolSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div @@ -462,7 +462,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderBuildingBlocksSection() { + private _renderBuildingBlocksSection() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const descriptionStyle: React.CSSProperties = { fontFamily: 'Roboto Mono', @@ -484,7 +484,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { > <div className="mx-auto max-width-4 lg-pt4 md-pt4 lg-mb4 md-mb4 sm-mb2 clearfix"> {isSmallScreen && - this.renderBlockChipImage() + this._renderBlockChipImage() } <div className="col lg-col-6 md-col-6 col-12 lg-pr3 md-pr3 sm-px3" @@ -528,13 +528,13 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> </div> {!isSmallScreen && - this.renderBlockChipImage() + this._renderBlockChipImage() } </div> </div> ); } - private renderBlockChipImage() { + private _renderBlockChipImage() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div className="col lg-col-6 md-col-6 col-12 sm-center"> @@ -545,7 +545,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderTokenCloud() { + private _renderTokenCloud() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( <div className="col lg-col-6 md-col-6 col-12 center"> @@ -556,7 +556,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderAssetTypes() { + private _renderAssetTypes() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const assetTypes: AssetType[] = [ { @@ -595,7 +595,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { }); return assets; } - private renderInfoBoxes() { + private _renderInfoBoxes() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const boxStyle: React.CSSProperties = { maxWidth: 252, @@ -648,7 +648,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderUseCases() { + private _renderUseCases() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const useCases: UseCase[] = [ @@ -759,7 +759,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private renderCallToAction() { + private _renderCallToAction() { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const buttonLabelStyle: React.CSSProperties = { textTransform: 'none', @@ -805,7 +805,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { </div> ); } - private updateScreenWidth() { + private _updateScreenWidth() { const newScreenWidth = utils.getScreenWidth(); if (newScreenWidth !== this.state.screenWidth) { this.setState({ diff --git a/packages/website/ts/pages/shared/anchor_title.tsx b/packages/website/ts/pages/shared/anchor_title.tsx index 0a3674fd9..0c1e8f4b7 100644 --- a/packages/website/ts/pages/shared/anchor_title.tsx +++ b/packages/website/ts/pages/shared/anchor_title.tsx @@ -79,14 +79,14 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt className="zmdi zmdi-link" onClick={utils.setUrlHash.bind(utils, this.props.id)} style={{...styles.anchor, opacity}} - onMouseOver={this.setHoverState.bind(this, true)} - onMouseOut={this.setHoverState.bind(this, false)} + onMouseOver={this._setHoverState.bind(this, true)} + onMouseOut={this._setHoverState.bind(this, false)} /> </ScrollLink> </div> ); } - private setHoverState(isHovering: boolean) { + private _setHoverState(isHovering: boolean) { this.setState({ isHovering, }); diff --git a/packages/website/ts/pages/shared/markdown_section.tsx b/packages/website/ts/pages/shared/markdown_section.tsx index 8686e80b6..e81920fc3 100644 --- a/packages/website/ts/pages/shared/markdown_section.tsx +++ b/packages/website/ts/pages/shared/markdown_section.tsx @@ -35,8 +35,8 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd return ( <div className="pt2 pr3 md-pl2 sm-pl3 overflow-hidden" - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <ScrollElement name={id}> <div className="clearfix"> @@ -69,7 +69,7 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd </div> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx index 42e087e2a..6dc194010 100644 --- a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx +++ b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx @@ -61,13 +61,13 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N {finalSectionName.toUpperCase()} </div> </ScrollLink> - {this.renderMenuItems(menuItems)} + {this._renderMenuItems(menuItems)} </div> ); } else { return ( <div key={`section-${sectionName}`} > - {this.renderMenuItems(menuItems)} + {this._renderMenuItems(menuItems)} </div> ); } @@ -87,7 +87,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </div> ); } - private renderMenuItems(menuItemNames: string[]): React.ReactNode[] { + private _renderMenuItems(menuItemNames: string[]): React.ReactNode[] { const menuItemStyles = this.props.shouldDisplaySectionHeaders ? styles.menuItemWithHeaders : styles.menuItemWithoutHeaders; @@ -105,7 +105,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N containerId={constants.DOCS_CONTAINER_ID} > <MenuItem - onTouchTap={this.onMenuItemClick.bind(this, menuItemName)} + onTouchTap={this._onMenuItemClick.bind(this, menuItemName)} style={menuItemStyles} innerDivStyle={menuItemInnerDivStyles} > @@ -114,19 +114,19 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </span> </MenuItem> </ScrollLink> - {this.renderMenuItemSubsections(menuItemName)} + {this._renderMenuItemSubsections(menuItemName)} </div> ); }); return menuItems; } - private renderMenuItemSubsections(menuItemName: string): React.ReactNode { + private _renderMenuItemSubsections(menuItemName: string): React.ReactNode { if (_.isUndefined(this.props.menuSubsectionsBySection[menuItemName])) { return null; } - return this.renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]); + return this._renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]); } - private renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode { + private _renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode { return ( <ul style={{margin: 0, listStyleType: 'none', paddingLeft: 0}} key={menuItemName}> {_.map(entityNames, entityName => { @@ -139,10 +139,10 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N offset={0} duration={constants.DOCS_SCROLL_DURATION_MS} containerId={constants.DOCS_CONTAINER_ID} - onTouchTap={this.onMenuItemClick.bind(this, name)} + onTouchTap={this._onMenuItemClick.bind(this, name)} > <MenuItem - onTouchTap={this.onMenuItemClick.bind(this, name)} + onTouchTap={this._onMenuItemClick.bind(this, name)} style={{minHeight: 35}} innerDivStyle={{paddingLeft: 36, fontSize: 14, lineHeight: '35px'}} > @@ -155,7 +155,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N </ul> ); } - private onMenuItemClick(name: string): void { + private _onMenuItemClick(name: string): void { const id = utils.getIdFromName(name); utils.setUrlHash(id); this.props.onMenuItemClick(); diff --git a/packages/website/ts/pages/shared/section_header.tsx b/packages/website/ts/pages/shared/section_header.tsx index b5119b128..5ea9fc681 100644 --- a/packages/website/ts/pages/shared/section_header.tsx +++ b/packages/website/ts/pages/shared/section_header.tsx @@ -28,8 +28,8 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe const id = utils.getIdFromName(sectionName); return ( <div - onMouseOver={this.setAnchorVisibility.bind(this, true)} - onMouseOut={this.setAnchorVisibility.bind(this, false)} + onMouseOver={this._setAnchorVisibility.bind(this, true)} + onMouseOut={this._setAnchorVisibility.bind(this, false)} > <ScrollElement name={id}> <AnchorTitle @@ -42,7 +42,7 @@ export class SectionHeader extends React.Component<SectionHeaderProps, SectionHe </div> ); } - private setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); diff --git a/packages/website/ts/pages/shared/version_drop_down.tsx b/packages/website/ts/pages/shared/version_drop_down.tsx index e63ad19cd..8d3322d72 100644 --- a/packages/website/ts/pages/shared/version_drop_down.tsx +++ b/packages/website/ts/pages/shared/version_drop_down.tsx @@ -18,14 +18,14 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi <DropDownMenu maxHeight={300} value={this.props.selectedVersion} - onChange={this.updateSelectedVersion.bind(this)} + onChange={this._updateSelectedVersion.bind(this)} > - {this.renderDropDownItems()} + {this._renderDropDownItems()} </DropDownMenu> </div> ); } - private renderDropDownItems() { + private _renderDropDownItems() { const items = _.map(this.props.versions, version => { return ( <MenuItem @@ -37,7 +37,7 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi }); return items; } - private updateSelectedVersion(e: any, index: number, value: string) { + private _updateSelectedVersion(e: any, index: number, value: string) { window.location.href = `${this.props.docPath}/${value}${window.location.hash}`; } } diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx index e1471243d..72da94a20 100644 --- a/packages/website/ts/pages/wiki/wiki.tsx +++ b/packages/website/ts/pages/wiki/wiki.tsx @@ -46,7 +46,7 @@ const styles: Styles = { }; export class Wiki extends React.Component<WikiProps, WikiState> { - private wikiBackoffTimeoutId: number; + private _wikiBackoffTimeoutId: number; constructor(props: WikiProps) { super(props); this.state = { @@ -55,15 +55,15 @@ export class Wiki extends React.Component<WikiProps, WikiState> { } public componentWillMount() { // tslint:disable-next-line:no-floating-promises - this.fetchArticlesBySectionAsync(); + this._fetchArticlesBySectionAsync(); } public componentWillUnmount() { - clearTimeout(this.wikiBackoffTimeoutId); + clearTimeout(this._wikiBackoffTimeoutId); } public render() { const menuSubsectionsBySection = _.isUndefined(this.state.articlesBySection) ? {} - : this.getMenuSubsectionsBySection(this.state.articlesBySection); + : this._getMenuSubsectionsBySection(this.state.articlesBySection); return ( <div> <DocumentTitle title="0x Protocol Wiki"/> @@ -117,7 +117,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </a> </h1> <div id="wiki"> - {this.renderWikiArticles()} + {this._renderWikiArticles()} </div> </div> </div> @@ -126,12 +126,12 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </div> ); } - private renderWikiArticles(): React.ReactNode { + private _renderWikiArticles(): React.ReactNode { const sectionNames = _.keys(this.state.articlesBySection); - const sections = _.map(sectionNames, sectionName => this.renderSection(sectionName)); + const sections = _.map(sectionNames, sectionName => this._renderSection(sectionName)); return sections; } - private renderSection(sectionName: string) { + private _renderSection(sectionName: string) { const articles = this.state.articlesBySection[sectionName]; const renderedArticles = _.map(articles, (article: Article) => { const githubLink = `${constants.URL_GITHUB_WIKI}/edit/master/${sectionName}/${article.fileName}`; @@ -165,7 +165,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </div> ); } - private scrollToHash(): void { + private _scrollToHash(): void { const hashWithPrefix = this.props.location.hash; let hash = hashWithPrefix.slice(1); if (_.isEmpty(hash)) { @@ -174,14 +174,14 @@ export class Wiki extends React.Component<WikiProps, WikiState> { scroller.scrollTo(hash, {duration: 0, offset: 0, containerId: 'documentation'}); } - private async fetchArticlesBySectionAsync(): Promise<void> { + private async _fetchArticlesBySectionAsync(): Promise<void> { const endpoint = `${configs.BACKEND_BASE_URL}${WebsitePaths.Wiki}`; const response = await fetch(endpoint); if (response.status === constants.HTTP_NO_CONTENT_STATUS_CODE) { // We need to backoff and try fetching again later - this.wikiBackoffTimeoutId = window.setTimeout(() => { + this._wikiBackoffTimeoutId = window.setTimeout(() => { // tslint:disable-next-line:no-floating-promises - this.fetchArticlesBySectionAsync(); + this._fetchArticlesBySectionAsync(); }, WIKI_NOT_READY_BACKOUT_TIMEOUT_MS); return; } @@ -195,10 +195,10 @@ export class Wiki extends React.Component<WikiProps, WikiState> { this.setState({ articlesBySection, }, () => { - this.scrollToHash(); + this._scrollToHash(); }); } - private getMenuSubsectionsBySection(articlesBySection: ArticlesBySection) { + private _getMenuSubsectionsBySection(articlesBySection: ArticlesBySection) { const sectionNames = _.keys(articlesBySection); const menuSubsectionsBySection: {[section: string]: string[]} = {}; for (const sectionName of sectionNames) { |