mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
Replace all occurrences of with momentjs
This commit is contained in:
parent
147c852b02
commit
c6f6bb398d
@ -41,6 +41,7 @@ For this project, we're using:
|
|||||||
* We don't use ES6's class declaration for React components because it does not support Mixins as well as Autobinding ([Blog post about it](http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding))
|
* We don't use ES6's class declaration for React components because it does not support Mixins as well as Autobinding ([Blog post about it](http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding))
|
||||||
* We don't use camel case for file naming but in everything Javascript related
|
* We don't use camel case for file naming but in everything Javascript related
|
||||||
* We use `let` instead of `var`: [SA Post](http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword)
|
* We use `let` instead of `var`: [SA Post](http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword)
|
||||||
|
* We don't use Javascript's `Date` object, as its interface introduced bugs previously and we're including `momentjs` for other dependencies anyways
|
||||||
|
|
||||||
|
|
||||||
SCSS Code Conventions
|
SCSS Code Conventions
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||||
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
|
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
|
||||||
@ -129,7 +130,7 @@ let AccordionListItemWallet = React.createClass({
|
|||||||
piece={this.props.content}
|
piece={this.props.content}
|
||||||
subsubheading={
|
subsubheading={
|
||||||
<div className="pull-left">
|
<div className="pull-left">
|
||||||
<span>{new Date(this.props.content.date_created).getUTCFullYear()}</span>
|
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||||
{this.getLicences()}
|
{this.getLicences()}
|
||||||
</div>}
|
</div>}
|
||||||
buttons={
|
buttons={
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link, History } from 'react-router';
|
import { Link, History } from 'react-router';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import Row from 'react-bootstrap/lib/Row';
|
import Row from 'react-bootstrap/lib/Row';
|
||||||
import Col from 'react-bootstrap/lib/Col';
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
@ -85,7 +86,7 @@ let Edition = React.createClass({
|
|||||||
<hr style={{marginTop: 0}}/>
|
<hr style={{marginTop: 0}}/>
|
||||||
<h1 className="ascribe-detail-title">{this.props.edition.title}</h1>
|
<h1 className="ascribe-detail-title">{this.props.edition.title}</h1>
|
||||||
<EditionDetailProperty label="BY" value={this.props.edition.artist_name} />
|
<EditionDetailProperty label="BY" value={this.props.edition.artist_name} />
|
||||||
<EditionDetailProperty label="DATE" value={ new Date(this.props.edition.date_created).getUTCFullYear() } />
|
<EditionDetailProperty label="DATE" value={Moment(this.props.edition.date_created, 'YYYY-MM-DD').year()} />
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
<EditionSummary
|
<EditionSummary
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { History } from 'react-router';
|
import { History } from 'react-router';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import PieceActions from '../../actions/piece_actions';
|
import PieceActions from '../../actions/piece_actions';
|
||||||
import PieceStore from '../../stores/piece_store';
|
import PieceStore from '../../stores/piece_store';
|
||||||
@ -234,7 +235,7 @@ let PieceContainer = React.createClass({
|
|||||||
<hr style={{marginTop: 0}}/>
|
<hr style={{marginTop: 0}}/>
|
||||||
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
||||||
<DetailProperty label="BY" value={this.state.piece.artist_name} />
|
<DetailProperty label="BY" value={this.state.piece.artist_name} />
|
||||||
<DetailProperty label="DATE" value={ new Date(this.state.piece.date_created).getUTCFullYear() } />
|
<DetailProperty label="DATE" value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year() } />
|
||||||
{this.state.piece.num_editions > 0 ? <DetailProperty label="EDITIONS" value={ this.state.piece.num_editions } /> : null}
|
{this.state.piece.num_editions > 0 ? <DetailProperty label="EDITIONS" value={ this.state.piece.num_editions } /> : null}
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import StarRating from 'react-star-rating';
|
import StarRating from 'react-star-rating';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import PieceListActions from '../../../../../actions/piece_list_actions';
|
import PieceListActions from '../../../../../actions/piece_list_actions';
|
||||||
import PieceListStore from '../../../../../stores/piece_list_store';
|
import PieceListStore from '../../../../../stores/piece_list_store';
|
||||||
@ -182,7 +183,7 @@ let AccordionListItemPrize = React.createClass({
|
|||||||
artistName={artistName}
|
artistName={artistName}
|
||||||
subsubheading={
|
subsubheading={
|
||||||
<div>
|
<div>
|
||||||
<span>{new Date(this.props.content.date_created).getUTCFullYear()}</span>
|
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||||
</div>}
|
</div>}
|
||||||
buttons={this.getPrizeButtons()}
|
buttons={this.getPrizeButtons()}
|
||||||
badge={this.getPrizeBadge()}>
|
badge={this.getPrizeBadge()}>
|
||||||
|
@ -141,7 +141,7 @@ let PieceContainer = React.createClass({
|
|||||||
<hr/>
|
<hr/>
|
||||||
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
||||||
<DetailProperty label={getLangText('BY')} value={artistName} />
|
<DetailProperty label={getLangText('BY')} value={artistName} />
|
||||||
<DetailProperty label={getLangText('DATE')} value={new Date(this.state.piece.date_created).getUTCFullYear()} />
|
<DetailProperty label={getLangText('DATE')} value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year()} />
|
||||||
{artistEmail}
|
{artistEmail}
|
||||||
{this.getActions()}
|
{this.getActions()}
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import Piece from '../../../../../components/ascribe_detail/piece';
|
import Piece from '../../../../../components/ascribe_detail/piece';
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ let WalletPieceContainer = React.createClass({
|
|||||||
<hr style={{marginTop: 0}}/>
|
<hr style={{marginTop: 0}}/>
|
||||||
<h1 className="ascribe-detail-title">{this.props.piece.title}</h1>
|
<h1 className="ascribe-detail-title">{this.props.piece.title}</h1>
|
||||||
<DetailProperty label="BY" value={this.props.piece.artist_name} />
|
<DetailProperty label="BY" value={this.props.piece.artist_name} />
|
||||||
<DetailProperty label="DATE" value={new Date(this.props.piece.date_created).getUTCFullYear()} />
|
<DetailProperty label="DATE" value={Moment(this.props.piece.date_created, 'YYYY-MM-DD').year()} />
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ let CylandAccordionListItem = React.createClass({
|
|||||||
piece={this.props.content}
|
piece={this.props.content}
|
||||||
subsubheading={
|
subsubheading={
|
||||||
<div className="pull-left">
|
<div className="pull-left">
|
||||||
<span>{new Date(this.props.content.date_created).getUTCFullYear()}</span>
|
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||||
</div>}
|
</div>}
|
||||||
buttons={this.getSubmitButtons()}>
|
buttons={this.getSubmitButtons()}>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
||||||
|
|
||||||
@ -106,7 +107,7 @@ let IkonotvAccordionListItem = React.createClass({
|
|||||||
piece={this.props.content}
|
piece={this.props.content}
|
||||||
subsubheading={
|
subsubheading={
|
||||||
<div className="pull-left">
|
<div className="pull-left">
|
||||||
<span>{new Date(this.props.content.date_created).getUTCFullYear()}</span>
|
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||||
</div>}
|
</div>}
|
||||||
buttons={this.getSubmitButtons()}>
|
buttons={this.getSubmitButtons()}>
|
||||||
{this.props.children}
|
{this.props.children}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import Q from 'q';
|
import Q from 'q';
|
||||||
import SparkMD5 from 'spark-md5';
|
import SparkMD5 from 'spark-md5';
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
import { getLangText } from './lang_utils';
|
import { getLangText } from './lang_utils';
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ export function computeHashOfFile(file) {
|
|||||||
let spark = new SparkMD5.ArrayBuffer();
|
let spark = new SparkMD5.ArrayBuffer();
|
||||||
let fileReader = new FileReader();
|
let fileReader = new FileReader();
|
||||||
|
|
||||||
let startTime = new Date();
|
let startTime = new Moment();
|
||||||
|
|
||||||
// comment: We should convert this to es6 at some point, however if so please consider that
|
// comment: We should convert this to es6 at some point, however if so please consider that
|
||||||
// an arrow function will get rid of the function's scope...
|
// an arrow function will get rid of the function's scope...
|
||||||
@ -53,7 +54,7 @@ export function computeHashOfFile(file) {
|
|||||||
|
|
||||||
console.info('computed hash %s (took %d s)',
|
console.info('computed hash %s (took %d s)',
|
||||||
fileHash,
|
fileHash,
|
||||||
Math.round(((new Date() - startTime) / 1000) % 60)); // Compute hash
|
Math.round(((new Moment() - startTime) / 1000) % 60)); // Compute hash
|
||||||
|
|
||||||
let blobTextFile = makeTextFile(fileHash, file);
|
let blobTextFile = makeTextFile(fileHash, file);
|
||||||
resolve(blobTextFile);
|
resolve(blobTextFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user