1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Update multiline destructuring format based on style guide

This commit is contained in:
Brett Sun 2016-01-18 14:46:39 +01:00
parent 821fe79461
commit e5cae3fc34
20 changed files with 148 additions and 173 deletions

View File

@ -45,15 +45,14 @@ let AccordionListItemPiece = React.createClass({
}, },
render() { render() {
const { const { artistName,
artistName, badge,
badge, buttons,
buttons, children,
children, className,
className, piece,
piece, subsubheading,
subsubheading, thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail; const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail;
// Display the 300x300 thumbnail if we have it, otherwise just use the safe url // Display the 300x300 thumbnail if we have it, otherwise just use the safe url

View File

@ -44,13 +44,12 @@ export default function ({ action, displayName, title, tooltip }) {
}, },
render() { render() {
const { const { availableAcls,
availableAcls, buttonAcceptClassName,
buttonAcceptClassName, currentUser,
currentUser, email,
email, pieceOrEditions,
pieceOrEditions, handleSuccess } = this.props;
handleSuccess } = this.props;
return ( return (
<AclProxy <AclProxy

View File

@ -32,15 +32,14 @@ const DetailProperty = React.createClass({
}, },
render() { render() {
const { const { children,
children, className,
className, ellipsis,
ellipsis, label,
label, labelClassName,
labelClassName, separator,
separator, valueClassName,
valueClassName, value } = this.props;
value } = this.props;
return ( return (
<div className={classNames('row ascribe-detail-property', className)}> <div className={classNames('row ascribe-detail-property', className)}>

View File

@ -51,13 +51,12 @@ let Edition = React.createClass({
}, },
render() { render() {
const { const { actionPanelButtonListType,
actionPanelButtonListType, coaError,
coaError, currentUser,
currentUser, edition,
edition, furtherDetailsType: FurtherDetailsType,
furtherDetailsType: FurtherDetailsType, loadEdition } = this.props;
loadEdition } = this.props;
return ( return (
<Row> <Row>

View File

@ -95,10 +95,9 @@ let EditionActionPanel = React.createClass({
}, },
render() { render() {
const { const { actionPanelButtonListType: ActionPanelButtonListType,
actionPanelButtonListType: ActionPanelButtonListType, currentUser,
edition, edition } = this.props;
currentUser } = this.props;
if (edition && if (edition &&
edition.notifications && edition.notifications &&

View File

@ -53,16 +53,15 @@ let AclFormFactory = React.createClass({
}, },
render() { render() {
const { const { action,
action, autoFocusProperty,
autoFocusProperty, pieceOrEditions,
pieceOrEditions, currentUser,
currentUser, email,
email, message,
message, labels,
labels, handleSuccess,
handleSuccess, showNotification } = this.props;
showNotification } = this.props;
const formMessage = message || getAclFormMessage({ const formMessage = message || getAclFormMessage({
aclName: action, aclName: action,

View File

@ -62,15 +62,14 @@ let ConsignForm = React.createClass({
render() { render() {
const { email } = this.state; const { email } = this.state;
const { const { autoFocusProperty,
autoFocusProperty, createPublicContractAgreement,
createPublicContractAgreement, email: defaultEmail,
email: defaultEmail, handleSuccess,
handleSuccess, id,
id, message,
message, labels,
labels, url } = this.props;
url } = this.props;
return ( return (
<Form <Form

View File

@ -118,21 +118,20 @@ let LoanForm = React.createClass({
render() { render() {
const { email } = this.state; const { email } = this.state;
const { const { children,
children, createPublicContractAgreement,
createPublicContractAgreement, email: defaultEmail,
email: defaultEmail, handleSuccess,
handleSuccess, gallery,
gallery, loanHeading,
loanHeading, message,
message, showPersonalMessage,
showPersonalMessage, endDate,
endDate, startDate,
startDate, showEndDate,
showEndDate, showStartDate,
showStartDate, showPassword,
showPassword, url } = this.props;
url } = this.props;
return ( return (
<Form <Form

View File

@ -143,16 +143,14 @@ const InputContractAgreementCheckbox = React.createClass({
getContractCheckbox() { getContractCheckbox() {
const contractAgreement = this.getContractAgreement(); const contractAgreement = this.getContractAgreement();
if(contractAgreement) { if (contractAgreement) {
const { const { contract: {
datetime_accepted: datetimeAccepted, issuer: contractIssuer,
contract: { blob: { url_safe: contractUrl }
issuer: contractIssuer, },
blob: { url_safe: contractUrl } datetime_accepted: datetimeAccepted } = contractAgreement;
}
} = contractAgreement;
if(datetimeAccepted) { if (datetimeAccepted) {
return ( return (
<div <div
className="notification-contract-pdf" className="notification-contract-pdf"
@ -168,10 +166,7 @@ const InputContractAgreementCheckbox = React.createClass({
</div> </div>
); );
} else { } else {
const { const { disabled, name, style } = this.props;
name,
disabled,
style } = this.props;
return ( return (
<InputCheckbox <InputCheckbox

View File

@ -77,11 +77,11 @@ const InputFineUploader = React.createClass({
value: file.key value: file.key
}); });
if(this.state.value && typeof this.props.onChange === 'function') { if (this.state.value && typeof this.props.onChange === 'function') {
this.props.onChange({ target: { value: this.state.value } }); this.props.onChange({ target: { value: this.state.value } });
} }
if(typeof this.props.submitFile === 'function') { if (typeof this.props.submitFile === 'function') {
this.props.submitFile(file); this.props.submitFile(file);
} }
}, },
@ -98,26 +98,25 @@ const InputFineUploader = React.createClass({
}, },
render() { render() {
const { const { areAssetsDownloadable,
areAssetsDownloadable, enableLocalHashing,
enableLocalHashing, createBlobRoutine,
createBlobRoutine, disabled,
disabled, fileClassToUpload,
fileClassToUpload, fileInputElement,
fileInputElement, isFineUploaderActive,
isFineUploaderActive, isReadyForFormSubmission,
isReadyForFormSubmission, keyRoutine,
keyRoutine, onValidationFailed,
onValidationFailed, setIsUploadReady,
setIsUploadReady, uploadMethod,
uploadMethod, validation,
validation, handleChangedFile } = this.props;
handleChangedFile } = this.props;
let editable = isFineUploaderActive; let editable = isFineUploaderActive;
// if disabled is actually set by property, we want to override // if disabled is actually set by property, we want to override
// isFineUploaderActive // isFineUploaderActive
if(typeof disabled !== 'undefined') { if (typeof disabled !== 'undefined') {
editable = !disabled; editable = !disabled;
} }

View File

@ -127,19 +127,18 @@ let FileDragAndDrop = React.createClass({
}, },
render: function () { render: function () {
const { const { allowedExtensions,
filesToUpload, areAssetsDownloadable,
dropzoneInactive, areAssetsEditable,
className, className,
hashingProgress, dropzoneInactive,
handleCancelHashing, enableLocalHashing,
multiple, fileClassToUpload,
enableLocalHashing, filesToUpload,
uploadMethod, handleCancelHashing,
fileClassToUpload, hashingProgress,
areAssetsDownloadable, multiple,
areAssetsEditable, uploadMethod } = this.props;
allowedExtensions } = this.props;
// has files only is true if there are files that do not have the status deleted or canceled // has files only is true if there are files that do not have the status deleted or canceled
let hasFiles = filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1).length > 0; let hasFiles = filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1).length > 0;

View File

@ -35,13 +35,12 @@ let FileDragAndDropDialog = React.createClass({
}, },
render() { render() {
const { const { enableLocalHashing,
hasFiles, fileClassToUpload,
multipleFiles, hasFiles,
enableLocalHashing, multipleFiles,
uploadMethod, onClick,
fileClassToUpload, uploadMethod } = this.props;
onClick } = this.props;
if (hasFiles) { if (hasFiles) {
return null; return null;

View File

@ -145,9 +145,7 @@ export default function UploadButton({ className = 'btn btn-default btn-sm' } =
}, },
render() { render() {
const { const { allowedExtensions, multiple } = this.props;
multiple,
allowedExtensions } = this.props;
const { disabled } = this.state; const { disabled } = this.state;

View File

@ -53,11 +53,10 @@ let GlobalNotification = React.createClass({
}, },
renderNotification() { renderNotification() {
const { const { containerWidth,
notificationQueue: [notification], notificationsPaused,
notificationStatus, notificationQueue: [notification],
notificationsPaused, notificationStatus } = this.state;
containerWidth } = this.state;
const notificationClasses = []; const notificationClasses = [];

View File

@ -259,13 +259,12 @@ let PieceList = React.createClass({
}, },
render() { render() {
const { const { accordionListItemType: AccordionListItemType,
accordionListItemType: AccordionListItemType, bulkModalButtonListType: BulkModalButtonListType,
bulkModalButtonListType: BulkModalButtonListType, customSubmitButton,
customSubmitButton, customThumbnailPlaceholder,
customThumbnailPlaceholder, filterParams,
filterParams, orderParams } = this.props;
orderParams } = this.props;
const loadingElement = <AscribeSpinner color='dark-blue' size='lg'/>; const loadingElement = <AscribeSpinner color='dark-blue' size='lg'/>;

View File

@ -33,13 +33,12 @@ let WalletPieceContainer = React.createClass({
}, },
render() { render() {
const { const { children,
children, currentUser,
currentUser, handleDeleteSuccess,
handleDeleteSuccess, loadPiece,
loadPiece, piece,
piece, submitButtonType } = this.props;
submitButtonType } = this.props;
if (piece && piece.id) { if (piece && piece.id) {
return ( return (

View File

@ -53,14 +53,13 @@ let MarketSubmitButton = React.createClass({
canEditionBeSubmitted(edition) { canEditionBeSubmitted(edition) {
if (edition && edition.extra_data && edition.other_data) { if (edition && edition.extra_data && edition.other_data) {
const { const { extra_data: {
extra_data: { artist_bio: artistBio,
artist_bio: artistBio, display_instructions: displayInstructions,
display_instructions: displayInstructions, technology_details: technologyDetails,
technology_details: technologyDetails, work_description: workDescription
work_description: workDescription },
}, other_data: otherData } = edition;
other_data: otherData } = edition;
return artistBio && displayInstructions && technologyDetails && workDescription && otherData.length; return artistBio && displayInstructions && technologyDetails && workDescription && otherData.length;
} }

View File

@ -107,16 +107,15 @@ let MarketAdditionalDataForm = React.createClass({
}, },
render() { render() {
const { const { editable,
editable, extraData = {},
extraData = {}, isInline,
isInline, handleSuccess,
handleSuccess, otherData,
otherData, pieceId,
pieceId, showHeading,
showHeading, showNotification,
showNotification, submitLabel } = this.props;
submitLabel } = this.props;
let buttons; let buttons;
let heading; let heading;

View File

@ -51,12 +51,11 @@ let MarketPieceList = React.createClass({
render() { render() {
const { customThumbnailPlaceholder, location } = this.props; const { customThumbnailPlaceholder, location } = this.props;
const { const { currentUser: { email: userEmail },
currentUser: { email: userEmail }, whitelabel: {
whitelabel: { name: whitelabelName = 'Market',
name: whitelabelName = 'Market', user: whitelabelAdminEmail
user: whitelabelAdminEmail } } = this.state;
} } = this.state;
let filterParams = null; let filterParams = null;
let canLoadPieceList = false; let canLoadPieceList = false;

View File

@ -112,12 +112,11 @@ let MarketRegisterPiece = React.createClass({
render() { render() {
const { location } = this.props; const { location } = this.props;
const { const { piece,
piece, step,
step, whitelabel: {
whitelabel: { name: whitelabelName = 'Market'
name: whitelabelName = 'Market' } } = this.state;
} } = this.state;
setDocumentTitle(getLangText('Register a new piece')); setDocumentTitle(getLangText('Register a new piece'));