Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select thumbnail, spee.ch upload #1248

Merged
merged 25 commits into from Jun 8, 2018

Conversation

Projects
None yet
4 participants
@daovist
Copy link
Contributor

daovist commented Apr 2, 2018

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

This comment has been minimized.

Copy link
Contributor Author

daovist commented Apr 10, 2018

@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.

@tzarebczan tzarebczan requested review from seanyesmunt and removed request for liamcardenas May 10, 2018

@daovist daovist force-pushed the daovist:select-thumbnail branch 2 times, most recently from ee8b1c4 to 8fea5ec May 21, 2018

@daovist

This comment has been minimized.

Copy link
Contributor Author

daovist commented May 21, 2018

@seanyesmunt this is working and ready for review

@daovist daovist force-pushed the daovist:select-thumbnail branch from 8fea5ec to a5f952a May 22, 2018

@daovist daovist requested a review from skhameneh May 23, 2018

@lbry-bot lbry-bot assigned skhameneh and seanyesmunt and unassigned seanyesmunt May 23, 2018

@daovist daovist force-pushed the daovist:select-thumbnail branch from a5f952a to 91e1f38 May 25, 2018

@skhameneh
Copy link
Member

skhameneh left a comment

Approved w/ minor comments

const { type, currentPath, fileLabel, directoryLabel } = this.props;

const label =
type === 'file' ? fileLabel || __('Choose File') : directoryLabel || __('Choose Directory');

This comment has been minimized.

@skhameneh

skhameneh May 30, 2018

Member

Can you add parens for legibility?

@@ -73,6 +77,10 @@ class PublishForm extends React.PureComponent<Props> {
(this: any).getNewUri = this.getNewUri.bind(this);
}

componentWillMount() {

This comment has been minimized.

@skhameneh

skhameneh May 30, 2018

Member

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

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

const makeid = () => {
let text = '';
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < 24; i += 1) text += possible.charAt(Math.floor(Math.random() * 62));

This comment has been minimized.

@skhameneh

skhameneh May 30, 2018

Member

Can you split this line out with brackets for legibility?

const data = new FormData();
const name = makeid();
const blob = new Blob([thumbnail], { type: `image/${fileExt.slice(1)}` });
data.append('name', name);

This comment has been minimized.

@skhameneh

skhameneh May 30, 2018

Member

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

@daovist daovist force-pushed the daovist:select-thumbnail branch from 91e1f38 to 24fe915 May 31, 2018

@daovist daovist referenced this pull request May 31, 2018

Merged

Thumbnail upload statuses #39

@daovist

This comment has been minimized.

Copy link
Contributor Author

daovist commented May 31, 2018

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.

@daovist daovist force-pushed the daovist:select-thumbnail branch from 24fe915 to 57ec2e6 Jun 4, 2018

export const SEND_TIP = 'send_tip';
export const PUBLISH = 'publish';
export const SEARCH = 'search';
export const CONFIRM_THUMBNAIL_UPLOAD = 'confirmThumbnailUpload';

This comment has been minimized.

@seanyesmunt

seanyesmunt Jun 4, 2018

Member

This should be in lbry-redux

@seanyesmunt seanyesmunt force-pushed the daovist:select-thumbnail branch from 57ec2e6 to 4bc8c52 Jun 6, 2018

@seanyesmunt seanyesmunt force-pushed the daovist:select-thumbnail branch from 4bc8c52 to 3e283f3 Jun 8, 2018

@seanyesmunt seanyesmunt merged commit 65513cf into lbryio:master Jun 8, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.