1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +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() {
const {
artistName,
badge,
buttons,
children,
className,
piece,
subsubheading,
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { artistName,
badge,
buttons,
children,
className,
piece,
subsubheading,
thumbnailPlaceholder: ThumbnailPlaceholder } = this.props;
const { url: thumbnailUrl, url_safe: thumbnailSafeUrl } = piece.thumbnail;
// 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() {
const {
availableAcls,
buttonAcceptClassName,
currentUser,
email,
pieceOrEditions,
handleSuccess } = this.props;
const { availableAcls,
buttonAcceptClassName,
currentUser,
email,
pieceOrEditions,
handleSuccess } = this.props;
return (
<AclProxy

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -127,19 +127,18 @@ let FileDragAndDrop = React.createClass({
},
render: function () {
const {
filesToUpload,
dropzoneInactive,
className,
hashingProgress,
handleCancelHashing,
multiple,
enableLocalHashing,
uploadMethod,
fileClassToUpload,
areAssetsDownloadable,
areAssetsEditable,
allowedExtensions } = this.props;
const { allowedExtensions,
areAssetsDownloadable,
areAssetsEditable,
className,
dropzoneInactive,
enableLocalHashing,
fileClassToUpload,
filesToUpload,
handleCancelHashing,
hashingProgress,
multiple,
uploadMethod } = this.props;
// 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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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