Select thumbnail, spee.ch upload #1248

Merged
daovist merged 25 commits from select-thumbnail into master 2018-06-08 06:46:55 +02:00
daovist commented 2018-04-02 20:06:51 +02:00 (Migrated from github.com)

This PR...

Lets <FileSelector> take custom labels

Adds thumbnail_upload_statuses constants

Adds <SelectThumbnail> component and uses it in <PublishForm>

Adds ModalConfirmThumbnailUpload which is called by <SelectThumbnail>

Adds uploadThumbnailStatus to PublishState (and not PublishParams) in publishReducer

Uses existing reducers and selectors, adds doResetThumbnailStatus and doUploadThumbnail actions for spee.ch requests

Adds a.link CSS

Cleans up some errors I got committing changes

This PR... Lets `<FileSelector>` take custom labels Adds `thumbnail_upload_statuses` constants Adds `<SelectThumbnail>` component and uses it in `<PublishForm>` Adds `ModalConfirmThumbnailUpload` which is called by `<SelectThumbnail>` Adds `uploadThumbnailStatus` to `PublishState` (and not `PublishParams`) in `publishReducer` Uses existing reducers and selectors, adds `doResetThumbnailStatus` and `doUploadThumbnail` actions for spee.ch requests Adds `a.link` CSS Cleans up some errors I got committing changes
daovist commented 2018-04-10 14:42:42 +02:00 (Migrated from github.com)

@liamcardenas this is ready for review. I think I got the rebase right but I'm not positive. I tested it post merge, commit, push, and it works fine.

A couple things that could/maybe should be done:

The modal and publish form write to the same state.publish.nsfw so if the thumbnail is marked nsfw it will be checked when the user gets to that option on the page. Should we turn off the ability to not mark a file nsfw when the thumbnail being uploaded was marked nsfw, by disabling the checkbox?

Should we disable publishing until the upload is complete? Until it does, the thumbnail field is a blank string, it doesn't get back the url with a claim_id until the upload is complete.

@liamcardenas this is ready for review. I think I got the rebase right but I'm not positive. I tested it post merge, commit, push, and it works fine. A couple things that could/maybe should be done: The modal and publish form write to the same `state.publish.nsfw` so if the thumbnail is marked nsfw it will be checked when the user gets to that option on the page. Should we turn off the ability to not mark a file nsfw when the thumbnail being uploaded was marked nsfw, by disabling the checkbox? Should we disable publishing until the upload is complete? Until it does, the thumbnail field is a blank string, it doesn't get back the url with a claim_id until the upload is complete.
daovist commented 2018-05-21 16:42:38 +02:00 (Migrated from github.com)

@seanyesmunt this is working and ready for review

@seanyesmunt this is working and ready for review
skhameneh (Migrated from github.com) approved these changes 2018-05-30 06:36:38 +02:00
skhameneh (Migrated from github.com) left a comment

Approved w/ minor comments

Approved w/ minor comments
skhameneh (Migrated from github.com) commented 2018-05-30 06:31:25 +02:00

Can you add parens for legibility?

Can you add parens for legibility?
@ -70,1 +74,3 @@
// Returns a new uri to be used in the form and begins to resolve that uri for bid help text
componentWillMount() {
this.props.resetThumbnailStatus();
}
skhameneh (Migrated from github.com) commented 2018-05-30 06:33:13 +02:00

This method is being deprecated, it's good to start using getDerivedStateFromProps()

https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops

This method is being deprecated, it's good to start using `getDerivedStateFromProps()` https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops
@ -33,0 +90,4 @@
dispatch({
type: ACTIONS.UPDATE_PUBLISH_FORM,
data: { uploadThumbnailStatus: STATUSES.IN_PROGRESS },
});
skhameneh (Migrated from github.com) commented 2018-05-30 06:34:46 +02:00

Can you split this line out with brackets for legibility?

Can you split this line out with brackets for legibility?
@ -33,0 +113,4 @@
thumbnail: `${json.data.url}${fileExt}`,
},
})
: uploadError('Upload failed')
skhameneh (Migrated from github.com) commented 2018-05-30 06:36:06 +02:00

Can you clean up some of the formatting from ln90 to 110?
Line breaks, indentation, etc

Can you clean up some of the formatting from ln90 to 110? Line breaks, indentation, etc
daovist commented 2018-05-31 17:15:32 +02:00 (Migrated from github.com)

I cleaned this up based on comments from @skhameneh and other changes since the last time I worked on select-thumbnail. I moved constants to lbry-redux in /lbryio/lbry-redux/pull/39 which is a prereq for this PR.

I did not implement getDerivedStateFromProps thinking that pattern is all over the app and should be its own issue to clean up everywhere.

It now resets the thumbnail upload status when the whole form is reset. I refactored the errors and tested it on a faulty URL and everything worked like it should. Though some more @tzarebczan testing is probably in order.

I cleaned this up based on comments from @skhameneh and other changes since the last time I worked on `select-thumbnail`. I moved constants to `lbry-redux` in [/lbryio/lbry-redux/pull/39](http://github.com/lbryio/lbry-redux/pull/39) which is a prereq for this PR. I did not implement [getDerivedStateFromProps](https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops) thinking that pattern is all over the app and should be its own issue to clean up everywhere. It now resets the thumbnail upload status when the whole form is reset. I refactored the errors and tested it on a faulty URL and everything worked like it should. Though some more @tzarebczan testing is probably in order.
neb-b (Migrated from github.com) reviewed 2018-06-04 20:49:08 +02:00
neb-b (Migrated from github.com) commented 2018-06-04 20:49:08 +02:00

This should be in lbry-redux

This should be in lbry-redux
neb-b (Migrated from github.com) reviewed 2018-06-04 21:00:11 +02:00
@ -30,6 +34,90 @@ export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) =>
data: { ...publishFormValue },
});
neb-b (Migrated from github.com) commented 2018-06-04 21:00:11 +02:00

Is this the correct path?

Is this the correct path?
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-desktop#1248
No description provided.