diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index fb82d8614..f6a128bb8 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -22,6 +22,8 @@ type FileInfo = { type Props = { hideFilter: boolean, + sortByHeight?: boolean, + claimsById: Array<{}>, fileInfos: Array, }; @@ -141,21 +143,30 @@ class FileList extends React.PureComponent { const content = []; this.sortFunctions[sortBy](fileInfos).forEach(fileInfo => { - const { channel_name: channelName, name: claimName, claim_id: claimId } = fileInfo; + const { + channel_name: channelName, + name: claimName, + claim_name: claimNameDownloaded, + claim_id: claimId, + } = fileInfo; const uriParams = {}; + // This is unfortunate + // https://github.com/lbryio/lbry/issues/1159 + const name = claimName || claimNameDownloaded; + if (channelName) { uriParams.channelName = channelName; - uriParams.contentName = claimName; + uriParams.contentName = name; uriParams.claimId = this.getChannelSignature(fileInfo); } else { uriParams.claimId = claimId; - uriParams.claimName = claimName; + uriParams.claimName = name; } const uri = buildURI(uriParams); - content.push(); + content.push(); }); return ( diff --git a/src/renderer/component/fileListSearch/view.jsx b/src/renderer/component/fileListSearch/view.jsx index 53add5ab7..25694d1c7 100644 --- a/src/renderer/component/fileListSearch/view.jsx +++ b/src/renderer/component/fileListSearch/view.jsx @@ -7,9 +7,7 @@ import debounce from 'util/debounce'; const SEARCH_DEBOUNCE_TIME = 800; -const NoResults = () => { - return
{__('No results')}
; -}; +const NoResults = () =>
{__('No results')}
; type Props = { search: string => void, diff --git a/src/renderer/component/publishForm/view.jsx b/src/renderer/component/publishForm/view.jsx index 0a7ab7523..aaf90e188 100644 --- a/src/renderer/component/publishForm/view.jsx +++ b/src/renderer/component/publishForm/view.jsx @@ -140,13 +140,20 @@ class PublishForm extends React.PureComponent { } handleFileChange(filePath: string, fileName: string) { - const { updatePublishForm, channel } = this.props; - const parsedFileName = fileName.replace(regexInvalidURI, ''); - const uri = this.getNewUri(parsedFileName, channel); + const { updatePublishForm, channel, name } = this.props; + const newFileParams: { + filePath: string, + name?: string, + uri?: string + } = { filePath }; - if (filePath) { - updatePublishForm({ filePath, name: parsedFileName, uri }); + if (!name) { + const parsedFileName = fileName.replace(regexInvalidURI, ''); + const uri = this.getNewUri(parsedFileName, channel); + newFileParams.name = parsedFileName; } + + updatePublishForm(newFileParams); } handleNameChange(name: ?string) { diff --git a/src/renderer/component/userEmailVerify/view.jsx b/src/renderer/component/userEmailVerify/view.jsx index 5d6a367fa..b5f634280 100644 --- a/src/renderer/component/userEmailVerify/view.jsx +++ b/src/renderer/component/userEmailVerify/view.jsx @@ -1,19 +1,33 @@ -// I'll come back to this -/* eslint-disable */ +// @flow import React from 'react'; import Button from 'component/button'; -import { Form, FormField, Submit } from 'component/common/form'; +import { Form, FormField, FormRow, Submit } from 'component/common/form'; -class UserEmailVerify extends React.PureComponent { - constructor(props) { +type Props = { + cancelButton: React.Node, + errorMessage: ?string, + email: string, + isPending: boolean, + verifyUserEmail: (string, string) => void, + verifyUserEmailFailure: string => void, +}; + +type State = { + code: string, +}; + +class UserEmailVerify extends React.PureComponent { + constructor(props: Props) { super(props); this.state = { code: '', }; + + (this: any).handleSubmit = this.handleSubmit.bind(this); } - handleCodeChanged(event) { + handleCodeChanged(event: SyntheticInputEvent<*>) { this.setState({ code: String(event.target.value).trim(), }); @@ -31,31 +45,30 @@ class UserEmailVerify extends React.PureComponent { render() { const { cancelButton, errorMessage, email, isPending } = this.props; - // ( - // { - // this.handleCodeChanged(event); - // }} - // /> - // )} - // /> + return ( -
+

Please enter the verification code emailed to {email}.

- {/* render help separately so it always shows */} -
+ + this.handleCodeChanged(event)} + /> + +

- {__('Email')}

-
+
{cancelButton}
@@ -65,4 +78,3 @@ class UserEmailVerify extends React.PureComponent { } export default UserEmailVerify; -/* eslint-enable */ diff --git a/src/renderer/modal/modalRemoveFile/view.jsx b/src/renderer/modal/modalRemoveFile/view.jsx index bff0fcda5..7a30f2dca 100644 --- a/src/renderer/modal/modalRemoveFile/view.jsx +++ b/src/renderer/modal/modalRemoveFile/view.jsx @@ -23,8 +23,8 @@ class ModalRemoveFile extends React.PureComponent { super(props); this.state = { - deleteChecked: true, - abandonClaimChecked: false, + deleteChecked: false, + abandonClaimChecked: true, }; (this: any).handleDeleteCheckboxClicked = this.handleDeleteCheckboxClicked.bind(this); diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index ba93acb2b..ba0da04b8 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -34,7 +34,12 @@ export const doPrepareEdit = (claim: any) => (dispatch: Dispatch) => { const { author, description, - fee, + // use same values as default state + // fee will be undefined for free content + fee = { + amount: 0, + currency: 'LBC', + }, language, license, licenseUrl, @@ -67,7 +72,7 @@ export const doPublish = (params: PublishParams): ThunkAction => { const { name, bid, - filePath: file_path, + filePath, description, language, license, @@ -102,7 +107,7 @@ export const doPublish = (params: PublishParams): ThunkAction => { } const publishPayload = { - file_path, + file_path: filePath, name, channel_name: channelName, bid, @@ -130,52 +135,50 @@ export const doPublish = (params: PublishParams): ThunkAction => { }; // Calls claim_list_mine until any pending publishes are confirmed -export const doCheckPendingPublishes = () => { - return (dispatch: Dispatch, getState: GetState) => { - const state = getState(); - const pendingPublishes = selectPendingPublishes(state); - const myClaims = selectMyClaimsWithoutChannels(state); +export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => { + const state = getState(); + const pendingPublishes = selectPendingPublishes(state); + const myClaims = selectMyClaimsWithoutChannels(state); - let publishCheckInterval; + let publishCheckInterval; - const checkFileList = () => { - Lbry.claim_list_mine().then(claims => { - const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/)); - if (myClaims.length !== claimsWithoutChannels.length) { - const pendingPublishMap = {}; - pendingPublishes.forEach(({ name }) => { - pendingPublishMap[name] = name; - }); + const checkFileList = () => { + Lbry.claim_list_mine().then(claims => { + const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/)); + if (myClaims.length !== claimsWithoutChannels.length) { + const pendingPublishMap = {}; + pendingPublishes.forEach(({ name }) => { + pendingPublishMap[name] = name; + }); - claims.forEach(claim => { - if (pendingPublishMap[claim.name]) { - dispatch({ - type: ACTIONS.REMOVE_PENDING_PUBLISH, - data: { - name: claim.name, - }, - }); - dispatch({ - type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, - data: { - claims, - }, - }); + claims.forEach(claim => { + if (pendingPublishMap[claim.name]) { + dispatch({ + type: ACTIONS.REMOVE_PENDING_PUBLISH, + data: { + name: claim.name, + }, + }); + dispatch({ + type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, + data: { + claims, + }, + }); - delete pendingPublishMap[claim.name]; - } - }); + delete pendingPublishMap[claim.name]; + } + }); - clearInterval(publishCheckInterval); - } - }); - }; - - if (pendingPublishes.length) { - checkFileList(); - publishCheckInterval = setInterval(() => { - checkFileList(); - }, 10000); - } + clearInterval(publishCheckInterval); + } + }); }; + + if (pendingPublishes.length) { + checkFileList(); + publishCheckInterval = setInterval(() => { + checkFileList(); + }, 10000); + } }; diff --git a/src/renderer/redux/selectors/file_info.js b/src/renderer/redux/selectors/file_info.js index f13c0c9ae..b971328f5 100644 --- a/src/renderer/redux/selectors/file_info.js +++ b/src/renderer/redux/selectors/file_info.js @@ -2,6 +2,7 @@ import { selectClaimsByUri, selectIsFetchingClaimListMine, selectMyClaims, + selectClaimsById, } from 'redux/selectors/claims'; import { createSelector } from 'reselect'; import { buildURI } from 'lbryURI'; @@ -106,7 +107,7 @@ export const selectTotalDownloadProgress = createSelector(selectDownloadingFileI }); export const selectSearchDownloadUris = query => - createSelector(selectFileInfosDownloaded, fileInfos => { + createSelector(selectFileInfosDownloaded, selectClaimsById, (fileInfos, claimsById) => { if (!query || !fileInfos.length) { return null; } @@ -129,19 +130,19 @@ export const selectSearchDownloadUris = query => const downloadResultsFromQuery = []; fileInfos.forEach(fileInfo => { - const { channel_name, claim_name, metadata } = fileInfo; + const { channel_name: channelName, claim_name: claimName, metadata } = fileInfo; const { author, description, title } = metadata; - if (channel_name) { - const channelName = channel_name.toLowerCase(); - const strippedOutChannelName = channelName.slice(1); // trim off the @ - if (searchQueryDictionary[channel_name] || searchQueryDictionary[strippedOutChannelName]) { + if (channelName) { + const lowerCaseChannel = channelName.toLowerCase(); + const strippedOutChannelName = lowerCaseChannel.slice(1); // trim off the @ + if (searchQueryDictionary[channelName] || searchQueryDictionary[strippedOutChannelName]) { downloadResultsFromQuery.push(fileInfo); return; } } - const nameParts = claim_name.toLowerCase().split('-'); + const nameParts = claimName.toLowerCase().split('-'); if (arrayContainsQueryPart(nameParts)) { downloadResultsFromQuery.push(fileInfo); return; @@ -171,23 +172,24 @@ export const selectSearchDownloadUris = query => return downloadResultsFromQuery.length ? downloadResultsFromQuery.map(fileInfo => { - const { - channel_name: channelName, - claim_id: claimId, - claim_name: claimName, - value, - metadata, - } = fileInfo; + const { channel_name: channelName, claim_id: claimId, claim_name: claimName } = fileInfo; + const uriParams = {}; if (channelName) { + const claim = claimsById[claimId]; + if (claim.value) { + uriParams.claimId = claim.value.publisherSignature.certificateId; + } else { + uriParams.claimId = claimId; + } uriParams.channelName = channelName; + uriParams.contentName = claimName; + } else { + uriParams.claimId = claimId; + uriParams.claimName = claimName; } - uriParams.claimId = claimId; - uriParams.claimId = claimId; - uriParams.contentName = claimName; - const uri = buildURI(uriParams); return uri; }) diff --git a/src/renderer/scss/component/_button.scss b/src/renderer/scss/component/_button.scss index e4e08977d..2e0279647 100644 --- a/src/renderer/scss/component/_button.scss +++ b/src/renderer/scss/component/_button.scss @@ -189,5 +189,5 @@ button:disabled { opacity: 0.8; border-radius: var(--btn-radius); height: var(--btn-height); - padding: 0 3px; + padding: 10px; }