[redesign] moar fixes #1236
8 changed files with 137 additions and 104 deletions
|
@ -22,6 +22,8 @@ type FileInfo = {
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
hideFilter: boolean,
|
hideFilter: boolean,
|
||||||
|
sortByHeight?: boolean,
|
||||||
|
claimsById: Array<{}>,
|
||||||
fileInfos: Array<FileInfo>,
|
fileInfos: Array<FileInfo>,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -141,21 +143,30 @@ class FileList extends React.PureComponent<Props, State> {
|
||||||
const content = [];
|
const content = [];
|
||||||
|
|
||||||
this.sortFunctions[sortBy](fileInfos).forEach(fileInfo => {
|
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 = {};
|
const uriParams = {};
|
||||||
|
|
||||||
|
// This is unfortunate
|
||||||
|
// https://github.com/lbryio/lbry/issues/1159
|
||||||
|
const name = claimName || claimNameDownloaded;
|
||||||
|
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
uriParams.channelName = channelName;
|
uriParams.channelName = channelName;
|
||||||
uriParams.contentName = claimName;
|
uriParams.contentName = name;
|
||||||
uriParams.claimId = this.getChannelSignature(fileInfo);
|
uriParams.claimId = this.getChannelSignature(fileInfo);
|
||||||
} else {
|
} else {
|
||||||
uriParams.claimId = claimId;
|
uriParams.claimId = claimId;
|
||||||
uriParams.claimName = claimName;
|
uriParams.claimName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uri = buildURI(uriParams);
|
const uri = buildURI(uriParams);
|
||||||
|
|
||||||
content.push(<FileCard key={claimName} uri={uri} showPrice={false} />);
|
content.push(<FileCard key={uri} uri={uri} showPrice={false} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -7,9 +7,7 @@ import debounce from 'util/debounce';
|
||||||
|
|
||||||
const SEARCH_DEBOUNCE_TIME = 800;
|
const SEARCH_DEBOUNCE_TIME = 800;
|
||||||
|
|
||||||
const NoResults = () => {
|
const NoResults = () => <div className="file-tile">{__('No results')}</div>;
|
||||||
return <div className="file-tile">{__('No results')}</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
search: string => void,
|
search: string => void,
|
||||||
|
|
|
@ -140,13 +140,20 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFileChange(filePath: string, fileName: string) {
|
handleFileChange(filePath: string, fileName: string) {
|
||||||
const { updatePublishForm, channel } = this.props;
|
const { updatePublishForm, channel, name } = this.props;
|
||||||
const parsedFileName = fileName.replace(regexInvalidURI, '');
|
const newFileParams: {
|
||||||
const uri = this.getNewUri(parsedFileName, channel);
|
filePath: string,
|
||||||
|
name?: string,
|
||||||
|
uri?: string
|
||||||
|
} = { filePath };
|
||||||
|
|
||||||
if (filePath) {
|
if (!name) {
|
||||||
updatePublishForm({ filePath, name: parsedFileName, uri });
|
const parsedFileName = fileName.replace(regexInvalidURI, '');
|
||||||
|
const uri = this.getNewUri(parsedFileName, channel);
|
||||||
|
newFileParams.name = parsedFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePublishForm(newFileParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNameChange(name: ?string) {
|
handleNameChange(name: ?string) {
|
||||||
|
|
|
@ -1,19 +1,33 @@
|
||||||
// I'll come back to this
|
// @flow
|
||||||
/* eslint-disable */
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
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 {
|
type Props = {
|
||||||
constructor(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<Props, State> {
|
||||||
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
code: '',
|
code: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(this: any).handleSubmit = this.handleSubmit.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCodeChanged(event) {
|
handleCodeChanged(event: SyntheticInputEvent<*>) {
|
||||||
this.setState({
|
this.setState({
|
||||||
code: String(event.target.value).trim(),
|
code: String(event.target.value).trim(),
|
||||||
});
|
});
|
||||||
|
@ -31,31 +45,30 @@ class UserEmailVerify extends React.PureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { cancelButton, errorMessage, email, isPending } = this.props;
|
const { cancelButton, errorMessage, email, isPending } = this.props;
|
||||||
// <FormField
|
|
||||||
// label={__('Verification Code')}
|
|
||||||
// errorMessage={errorMessage}
|
|
||||||
// render{() => (
|
|
||||||
// <input
|
|
||||||
// name="code"
|
|
||||||
// value={this.state.code}
|
|
||||||
// onChange={event => {
|
|
||||||
// this.handleCodeChanged(event);
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// )}
|
|
||||||
// />
|
|
||||||
return (
|
return (
|
||||||
<Form onSubmit={this.handleSubmit.bind(this)}>
|
<Form onSubmit={this.handleSubmit}>
|
||||||
<p>Please enter the verification code emailed to {email}.</p>
|
<p>Please enter the verification code emailed to {email}.</p>
|
||||||
{/* render help separately so it always shows */}
|
<FormRow>
|
||||||
<div className="form-field__helper">
|
<FormField
|
||||||
|
stretch
|
||||||
|
name="code"
|
||||||
|
type="text"
|
||||||
|
placeholder="eyJyZWNhcHRjaGEiOiIw..."
|
||||||
|
label={__('Verification Code')}
|
||||||
|
error={errorMessage}
|
||||||
|
value={this.state.code}
|
||||||
|
onChange={event => this.handleCodeChanged(event)}
|
||||||
|
/>
|
||||||
|
</FormRow>
|
||||||
|
<div className="help">
|
||||||
<p>
|
<p>
|
||||||
{__('Email')} <Button href="mailto:help@lbry.io" label="help@lbry.io" /> or join our{' '}
|
{__('Email')} <Button button="link" href="mailto:help@lbry.io" label="help@lbry.io" />{' '}
|
||||||
<Button href="https://chat.lbry.io" label="chat" />{' '}
|
or join our <Button button="link" href="https://chat.lbry.io" label="chat" />{' '}
|
||||||
{__('if you encounter any trouble with your code.')}
|
{__('if you encounter any trouble with your code.')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-row-submit">
|
<div className="card__actions">
|
||||||
<Submit label={__('Verify')} disabled={isPending} />
|
<Submit label={__('Verify')} disabled={isPending} />
|
||||||
{cancelButton}
|
{cancelButton}
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,4 +78,3 @@ class UserEmailVerify extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UserEmailVerify;
|
export default UserEmailVerify;
|
||||||
/* eslint-enable */
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ class ModalRemoveFile extends React.PureComponent<Props, State> {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
deleteChecked: true,
|
deleteChecked: false,
|
||||||
abandonClaimChecked: false,
|
abandonClaimChecked: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
(this: any).handleDeleteCheckboxClicked = this.handleDeleteCheckboxClicked.bind(this);
|
(this: any).handleDeleteCheckboxClicked = this.handleDeleteCheckboxClicked.bind(this);
|
||||||
|
|
|
@ -34,7 +34,12 @@ export const doPrepareEdit = (claim: any) => (dispatch: Dispatch) => {
|
||||||
const {
|
const {
|
||||||
author,
|
author,
|
||||||
description,
|
description,
|
||||||
fee,
|
// use same values as default state
|
||||||
|
// fee will be undefined for free content
|
||||||
|
fee = {
|
||||||
|
amount: 0,
|
||||||
|
currency: 'LBC',
|
||||||
|
},
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
|
@ -67,7 +72,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
const {
|
const {
|
||||||
name,
|
name,
|
||||||
bid,
|
bid,
|
||||||
filePath: file_path,
|
filePath,
|
||||||
description,
|
description,
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
|
@ -102,7 +107,7 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const publishPayload = {
|
const publishPayload = {
|
||||||
file_path,
|
file_path: filePath,
|
||||||
name,
|
name,
|
||||||
channel_name: channelName,
|
channel_name: channelName,
|
||||||
bid,
|
bid,
|
||||||
|
@ -130,52 +135,50 @@ export const doPublish = (params: PublishParams): ThunkAction => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calls claim_list_mine until any pending publishes are confirmed
|
// Calls claim_list_mine until any pending publishes are confirmed
|
||||||
export const doCheckPendingPublishes = () => {
|
export const doCheckPendingPublishes = () => (dispatch: Dispatch, getState: GetState) => {
|
||||||
return (dispatch: Dispatch, getState: GetState) => {
|
const state = getState();
|
||||||
const state = getState();
|
const pendingPublishes = selectPendingPublishes(state);
|
||||||
const pendingPublishes = selectPendingPublishes(state);
|
const myClaims = selectMyClaimsWithoutChannels(state);
|
||||||
const myClaims = selectMyClaimsWithoutChannels(state);
|
|
||||||
|
|
||||||
let publishCheckInterval;
|
let publishCheckInterval;
|
||||||
|
|
||||||
const checkFileList = () => {
|
const checkFileList = () => {
|
||||||
Lbry.claim_list_mine().then(claims => {
|
Lbry.claim_list_mine().then(claims => {
|
||||||
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
const claimsWithoutChannels = claims.filter(claim => !claim.name.match(/^@/));
|
||||||
if (myClaims.length !== claimsWithoutChannels.length) {
|
if (myClaims.length !== claimsWithoutChannels.length) {
|
||||||
const pendingPublishMap = {};
|
const pendingPublishMap = {};
|
||||||
pendingPublishes.forEach(({ name }) => {
|
pendingPublishes.forEach(({ name }) => {
|
||||||
pendingPublishMap[name] = name;
|
pendingPublishMap[name] = name;
|
||||||
});
|
});
|
||||||
|
|
||||||
claims.forEach(claim => {
|
claims.forEach(claim => {
|
||||||
if (pendingPublishMap[claim.name]) {
|
if (pendingPublishMap[claim.name]) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
type: ACTIONS.REMOVE_PENDING_PUBLISH,
|
||||||
data: {
|
data: {
|
||||||
name: claim.name,
|
name: claim.name,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
claims,
|
claims,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
delete pendingPublishMap[claim.name];
|
delete pendingPublishMap[claim.name];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
clearInterval(publishCheckInterval);
|
clearInterval(publishCheckInterval);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
if (pendingPublishes.length) {
|
|
||||||
checkFileList();
|
|
||||||
publishCheckInterval = setInterval(() => {
|
|
||||||
checkFileList();
|
|
||||||
}, 10000);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (pendingPublishes.length) {
|
||||||
|
checkFileList();
|
||||||
|
publishCheckInterval = setInterval(() => {
|
||||||
|
checkFileList();
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
selectClaimsByUri,
|
selectClaimsByUri,
|
||||||
selectIsFetchingClaimListMine,
|
selectIsFetchingClaimListMine,
|
||||||
selectMyClaims,
|
selectMyClaims,
|
||||||
|
selectClaimsById,
|
||||||
} from 'redux/selectors/claims';
|
} from 'redux/selectors/claims';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { buildURI } from 'lbryURI';
|
import { buildURI } from 'lbryURI';
|
||||||
|
@ -106,7 +107,7 @@ export const selectTotalDownloadProgress = createSelector(selectDownloadingFileI
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectSearchDownloadUris = query =>
|
export const selectSearchDownloadUris = query =>
|
||||||
createSelector(selectFileInfosDownloaded, fileInfos => {
|
createSelector(selectFileInfosDownloaded, selectClaimsById, (fileInfos, claimsById) => {
|
||||||
if (!query || !fileInfos.length) {
|
if (!query || !fileInfos.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -129,19 +130,19 @@ export const selectSearchDownloadUris = query =>
|
||||||
|
|
||||||
const downloadResultsFromQuery = [];
|
const downloadResultsFromQuery = [];
|
||||||
fileInfos.forEach(fileInfo => {
|
fileInfos.forEach(fileInfo => {
|
||||||
const { channel_name, claim_name, metadata } = fileInfo;
|
const { channel_name: channelName, claim_name: claimName, metadata } = fileInfo;
|
||||||
const { author, description, title } = metadata;
|
const { author, description, title } = metadata;
|
||||||
|
|
||||||
if (channel_name) {
|
if (channelName) {
|
||||||
const channelName = channel_name.toLowerCase();
|
const lowerCaseChannel = channelName.toLowerCase();
|
||||||
const strippedOutChannelName = channelName.slice(1); // trim off the @
|
const strippedOutChannelName = lowerCaseChannel.slice(1); // trim off the @
|
||||||
if (searchQueryDictionary[channel_name] || searchQueryDictionary[strippedOutChannelName]) {
|
if (searchQueryDictionary[channelName] || searchQueryDictionary[strippedOutChannelName]) {
|
||||||
downloadResultsFromQuery.push(fileInfo);
|
downloadResultsFromQuery.push(fileInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const nameParts = claim_name.toLowerCase().split('-');
|
const nameParts = claimName.toLowerCase().split('-');
|
||||||
if (arrayContainsQueryPart(nameParts)) {
|
if (arrayContainsQueryPart(nameParts)) {
|
||||||
downloadResultsFromQuery.push(fileInfo);
|
downloadResultsFromQuery.push(fileInfo);
|
||||||
return;
|
return;
|
||||||
|
@ -171,23 +172,24 @@ export const selectSearchDownloadUris = query =>
|
||||||
|
|
||||||
return downloadResultsFromQuery.length
|
return downloadResultsFromQuery.length
|
||||||
? downloadResultsFromQuery.map(fileInfo => {
|
? downloadResultsFromQuery.map(fileInfo => {
|
||||||
const {
|
const { channel_name: channelName, claim_id: claimId, claim_name: claimName } = fileInfo;
|
||||||
channel_name: channelName,
|
|
||||||
claim_id: claimId,
|
|
||||||
claim_name: claimName,
|
|
||||||
value,
|
|
||||||
metadata,
|
|
||||||
} = fileInfo;
|
|
||||||
const uriParams = {};
|
const uriParams = {};
|
||||||
|
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
|
const claim = claimsById[claimId];
|
||||||
|
if (claim.value) {
|
||||||
|
uriParams.claimId = claim.value.publisherSignature.certificateId;
|
||||||
|
} else {
|
||||||
|
uriParams.claimId = claimId;
|
||||||
|
}
|
||||||
uriParams.channelName = channelName;
|
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);
|
const uri = buildURI(uriParams);
|
||||||
return uri;
|
return uri;
|
||||||
})
|
})
|
||||||
|
|
|
@ -189,5 +189,5 @@ button:disabled {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
border-radius: var(--btn-radius);
|
border-radius: var(--btn-radius);
|
||||||
height: var(--btn-height);
|
height: var(--btn-height);
|
||||||
padding: 0 3px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue