-
Notifications
You must be signed in to change notification settings - Fork 414
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
[redesign] Publish improvements #1040
Conversation
0e6c6d9
to
d5dc21d
Compare
|
||
let prefillClaim; | ||
if (id) { | ||
prefillClaim = selectClaimById(id)(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm probably going to change this and have whoever links to the publish page be responsible for populating the form before navigating. Currently there can be issues with this if you navigate away from the form and come back to an edit.
possibly
// file page
populatePublishForm(fileInfo);
doNavigate('/publish')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As much feedback as I could give before app meeting deadline... still didn't actually run the code and didn't quite finish.
/> | ||
<Button | ||
alt | ||
icon="Clipboard" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use constants/icons
or decide we don't deem this necessary
}; | ||
|
||
export class FormField extends React.PureComponent<Props> { | ||
render() { | ||
const { render, label, prefix, postfix, error, helper, name, type, children, stretch, ...inputProps } = this.props; | ||
|
||
// Allow a type prop to determine the input or more customizability with a render prop | ||
let Input; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why capital? To represent a JSX element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was capital when I had the render function. Now that I removed it I'll set it back to lowercase.
let isResolvingUri; | ||
|
||
// If a publish is pending, don't bother with this because props.uri isn't the complete uri at that moment | ||
if (!props.pending) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why pass pending in rather than select it from Redux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
value?: { | ||
publisherSignature: { | ||
certificateId: string, | ||
} | ||
}, | ||
metadata: { | ||
metadata?: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this metadata?
because the API is inconsistent about returning metadata? In general, I'm in favor of consistent signatures that include null
or otherwise empty values (e.g. []
), rather than omitting fields entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part specifically is for pending publishes. A pending publish won't have the metadata
object. Maybe the issue is not keeping it the same. I know there was a lot of code to build an actual dummy claim in lbry.js
, currently pendingPublishes[0]
is the payload we send to lbry.publish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm going to add the dummy claim stuff back inside the pending publish. I ran into a couple issues with it, and I'm sure I will only run into more
@@ -70,8 +71,9 @@ class FileList extends React.PureComponent<Props, State> { | |||
getChannelSignature = (fileInfo: FileInfo) => { | |||
if (fileInfo.value) { | |||
return fileInfo.value.publisherSignature.certificateId; | |||
} else if (fileInfo.metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here that this can have two different data structures?
If the daemon is inconsistent with it's responses, I'd like to get issues opened to clean this up.
const channel = event.target.value; | ||
|
||
if (channel === 'new') { | ||
this.setState({ addingChannel: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the publish page generally retains state via Redux, will this internal component state be a potential source of error or confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a good component to test out your idea, just to see how it works in practice. I'll keep it as is for now, but look into refactoring when we add it to the "Your publishes" page, or somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
<option key="anonymous" value="anonymous"> | ||
{__('Anonymous')} | ||
</option> | ||
{channels.map(({ name }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be cool if this defaulted to the last channel you published with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea
* needed to make a dummy claim or file info object. | ||
*/ | ||
let pendingId = 0; | ||
function savePendingPublish({ name, channelName }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
|
||
let prefillClaim; | ||
if (id) { | ||
prefillClaim = selectClaimById(id)(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/renderer/lbry.js
Outdated
errorCallback(err); | ||
} | ||
); | ||
Lbry.publishContent = (params, publishedCallback, errorCallback) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can drop this and just use lbry.publish(...).then(...)
in code.
@kauffj Realized I didn't add contstants for 'anonymous' and 'new' for channel creation. And also forgot to fix the price placeholder after your comments. I'll add those. |
LET THERE BE REDUX
Changes
Moved publish form values to redux
Move pending publish logic to redux
Issues
There are a few minor bugs but I would rather file those as existing issues and keep moving forward.
Additional comments
Not super happy with the types. It feels like a lot of duplication. Additionally I'm just keeping the types in the reducer file, until Akinwale's PR to see how he goes about that.