mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
track reflecting files after publish
This commit is contained in:
parent
b6c7a8ec83
commit
0fcc657783
13 changed files with 95 additions and 100 deletions
|
@ -131,7 +131,7 @@
|
||||||
"imagesloaded": "^4.1.4",
|
"imagesloaded": "^4.1.4",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#1e27a854d012ef758c04b234fb80e74e264d5962",
|
"lbry-redux": "lbryio/lbry-redux#3be6fa52ac1cb6224cf9de45623183e62c2b24ab",
|
||||||
"lbryinc": "lbryio/lbryinc#cc62a4eec10845cc0b31da7d0f27287cfa7c4866",
|
"lbryinc": "lbryio/lbryinc#cc62a4eec10845cc0b31da7d0f27287cfa7c4866",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
|
|
@ -1200,5 +1200,7 @@
|
||||||
"this channel": "this channel",
|
"this channel": "this channel",
|
||||||
"Share this channel": "Share this channel",
|
"Share this channel": "Share this channel",
|
||||||
"File preview": "File preview",
|
"File preview": "File preview",
|
||||||
"Go Home": "Go Home"
|
"Go Home": "Go Home",
|
||||||
|
"Uploading (%progress%%) ": "Uploading (%progress%%) ",
|
||||||
|
"Confirming": "Confirming"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
selectBlockedChannels,
|
selectBlockedChannels,
|
||||||
selectChannelIsBlocked,
|
selectChannelIsBlocked,
|
||||||
doFileGet,
|
doFileGet,
|
||||||
|
makeSelectReflectingClaimForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||||
|
@ -21,6 +22,7 @@ import ClaimPreview from './view';
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||||
|
reflectingInfo: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||||
obscureNsfw: !selectShowMatureContent(state),
|
obscureNsfw: !selectShowMatureContent(state),
|
||||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||||
|
|
|
@ -21,6 +21,7 @@ import ClaimPreviewSubtitle from 'component/claimPreviewSubtitle';
|
||||||
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
||||||
import FileDownloadLink from 'component/fileDownloadLink';
|
import FileDownloadLink from 'component/fileDownloadLink';
|
||||||
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
||||||
|
import PublishPending from 'component/publishPending';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -29,6 +30,7 @@ type Props = {
|
||||||
showUserBlocked: boolean,
|
showUserBlocked: boolean,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
pending?: boolean,
|
pending?: boolean,
|
||||||
|
reflectingInfo?: any, // fxme
|
||||||
resolveUri: string => void,
|
resolveUri: string => void,
|
||||||
isResolvingUri: boolean,
|
isResolvingUri: boolean,
|
||||||
history: { push: string => void },
|
history: { push: string => void },
|
||||||
|
@ -65,6 +67,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
claimIsMine,
|
claimIsMine,
|
||||||
pending,
|
pending,
|
||||||
|
reflectingInfo,
|
||||||
history,
|
history,
|
||||||
uri,
|
uri,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
|
@ -97,7 +100,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
const showPublishLink = abandoned && !showUnresolvedClaim && placeholder === 'publish';
|
const showPublishLink = abandoned && !showUnresolvedClaim && placeholder === 'publish';
|
||||||
const hideActions = type === 'small' || type === 'tooltip';
|
const hideActions = type === 'small' || type === 'tooltip';
|
||||||
const canonicalUrl = claim && claim.canonical_url;
|
const canonicalUrl = claim && claim.canonical_url;
|
||||||
|
|
||||||
let isValid = false;
|
let isValid = false;
|
||||||
if (uri) {
|
if (uri) {
|
||||||
try {
|
try {
|
||||||
|
@ -245,28 +247,40 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
<ChannelThumbnail uri={uri} obscure={channelIsBlocked} />
|
<ChannelThumbnail uri={uri} obscure={channelIsBlocked} />
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
) : (
|
) : (
|
||||||
<NavLink {...navLinkProps}>
|
<>
|
||||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
{!pending ? (
|
||||||
{/* @if TARGET='app' */}
|
<NavLink {...navLinkProps}>
|
||||||
{claim && (
|
<FileThumbnail thumbnail={thumbnailUrl}>
|
||||||
<div className="claim-preview__hover-actions">
|
{/* @if TARGET='app' */}
|
||||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
{claim && (
|
||||||
</div>
|
<div className="claim-preview__hover-actions">
|
||||||
)}
|
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||||
{/* @endif */}
|
</div>
|
||||||
</FileThumbnail>
|
)}
|
||||||
</NavLink>
|
{/* @endif */}
|
||||||
|
</FileThumbnail>
|
||||||
|
</NavLink>
|
||||||
|
) : (
|
||||||
|
<FileThumbnail thumbnail={thumbnailUrl} />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="claim-preview__text">
|
<div className="claim-preview__text">
|
||||||
<div className="claim-preview-metadata">
|
<div className="claim-preview-metadata">
|
||||||
<div className="claim-preview-info">
|
<div className="claim-preview-info">
|
||||||
<NavLink {...navLinkProps}>
|
{pending ? (
|
||||||
<ClaimPreviewTitle uri={uri} />
|
<ClaimPreviewTitle uri={uri} />
|
||||||
</NavLink>
|
) : (
|
||||||
|
<NavLink {...navLinkProps}>
|
||||||
|
<ClaimPreviewTitle uri={uri} />
|
||||||
|
</NavLink>
|
||||||
|
)}
|
||||||
|
|
||||||
{!isChannel && <FileProperties uri={uri} />}
|
{!isChannel && <FileProperties uri={uri} />}
|
||||||
</div>
|
</div>
|
||||||
<ClaimPreviewSubtitle uri={uri} type={type} />
|
<ClaimPreviewSubtitle uri={uri} type={type} />
|
||||||
|
{(pending || !!reflectingInfo) && <PublishPending uri={uri} />}
|
||||||
</div>
|
</div>
|
||||||
{type !== 'small' && (
|
{type !== 'small' && (
|
||||||
<div className="claim-preview__actions">
|
<div className="claim-preview__actions">
|
||||||
|
|
|
@ -28,14 +28,9 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||||
{claim ? (
|
{claim ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<UriIndicator uri={uri} link />{' '}
|
<UriIndicator uri={uri} link />{' '}
|
||||||
{pending
|
{!pending &&
|
||||||
? __('Pending...')
|
claim &&
|
||||||
: claim &&
|
(isChannel ? type !== 'inline' && `${claimsInChannel} ${__('publishes')}` : <DateTime timeAgo uri={uri} />)}
|
||||||
(isChannel ? (
|
|
||||||
type !== 'inline' && `${claimsInChannel} ${__('publishes')}`
|
|
||||||
) : (
|
|
||||||
<DateTime timeAgo uri={uri} />
|
|
||||||
))}
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
13
ui/component/publishPending/index.js
Normal file
13
ui/component/publishPending/index.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { makeSelectReflectingClaimForUri, doCheckReflectingFiles } from 'lbry-redux';
|
||||||
|
import PublishPending from './view';
|
||||||
|
|
||||||
|
const select = (state, props) => ({
|
||||||
|
reflectingInfo: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
checkReflecting: () => dispatch(doCheckReflectingFiles()),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(select, perform)(PublishPending);
|
32
ui/component/publishPending/view.jsx
Normal file
32
ui/component/publishPending/view.jsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import Lbry from 'lbry-redux';
|
||||||
|
import Button from 'component/button';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
reflectingInfo?: ReflectingUpdate,
|
||||||
|
checkReflecting: () => void,
|
||||||
|
};
|
||||||
|
|
||||||
|
const PublishPending = (props: Props) => {
|
||||||
|
const { reflectingInfo = {}, checkReflecting } = props;
|
||||||
|
const { fileListItem, progress, stalled } = reflectingInfo;
|
||||||
|
const sdHash = fileListItem && fileListItem.sd_hash;
|
||||||
|
const reflecting = Object.keys(reflectingInfo).length;
|
||||||
|
if (stalled) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
button="link"
|
||||||
|
label={__('Upload stalled. Retry?')}
|
||||||
|
onClick={() => Lbry.file_reflect({ sd_hash: sdHash }).then(() => checkReflecting())}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else if (reflecting) {
|
||||||
|
return <span>{__('Uploading (%progress%%) ', { progress: progress })}</span>;
|
||||||
|
} else {
|
||||||
|
return <span>{__('Confirming')}</span>;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PublishPending;
|
|
@ -24,7 +24,6 @@ import {
|
||||||
lbrytvReducer,
|
lbrytvReducer,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import appReducer from 'redux/reducers/app';
|
import appReducer from 'redux/reducers/app';
|
||||||
import availabilityReducer from 'redux/reducers/availability';
|
|
||||||
import contentReducer from 'redux/reducers/content';
|
import contentReducer from 'redux/reducers/content';
|
||||||
import settingsReducer from 'redux/reducers/settings';
|
import settingsReducer from 'redux/reducers/settings';
|
||||||
import subscriptionsReducer from 'redux/reducers/subscriptions';
|
import subscriptionsReducer from 'redux/reducers/subscriptions';
|
||||||
|
@ -33,7 +32,6 @@ export default history =>
|
||||||
combineReducers({
|
combineReducers({
|
||||||
router: connectRouter(history),
|
router: connectRouter(history),
|
||||||
app: appReducer,
|
app: appReducer,
|
||||||
availability: availabilityReducer,
|
|
||||||
blacklist: blacklistReducer,
|
blacklist: blacklistReducer,
|
||||||
filtered: filteredReducer,
|
filtered: filteredReducer,
|
||||||
claims: claimsReducer,
|
claims: claimsReducer,
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
export function doFetchAvailability() {
|
|
||||||
return () => {
|
|
||||||
/*
|
|
||||||
this is disabled atm - Jeremy
|
|
||||||
*/
|
|
||||||
// const state = getState();
|
|
||||||
// const alreadyFetching = !!selectFetchingAvailability(state)[uri];
|
|
||||||
//
|
|
||||||
// if (!alreadyFetching) {
|
|
||||||
// dispatch({
|
|
||||||
// type: ACTIONS.FETCH_AVAILABILITY_STARTED,
|
|
||||||
// data: { uri },
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// lbry.get_availability({ uri }).then(availability => {
|
|
||||||
// dispatch({
|
|
||||||
// type: ACTIONS.FETCH_AVAILABILITY_COMPLETED,
|
|
||||||
// data: {
|
|
||||||
// availability,
|
|
||||||
// uri,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
selectMyClaims,
|
selectMyClaims,
|
||||||
doPublish,
|
doPublish,
|
||||||
doCheckPendingPublishes,
|
doCheckPendingPublishes,
|
||||||
|
doCheckReflectingFiles,
|
||||||
ACTIONS as LBRY_REDUX_ACTIONS,
|
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||||
|
@ -44,6 +45,12 @@ export const doPublishDesktop = (filePath: string) => (dispatch: Dispatch, getSt
|
||||||
claims: [pendingClaim],
|
claims: [pendingClaim],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// @if TARGET='app'
|
||||||
|
actions.push({
|
||||||
|
type: LBRY_REDUX_ACTIONS.ADD_FILES_REFLECTING,
|
||||||
|
data: pendingClaim,
|
||||||
|
});
|
||||||
|
// @endif
|
||||||
|
|
||||||
dispatch(batchActions(...actions));
|
dispatch(batchActions(...actions));
|
||||||
dispatch(
|
dispatch(
|
||||||
|
@ -53,6 +60,10 @@ export const doPublishDesktop = (filePath: string) => (dispatch: Dispatch, getSt
|
||||||
filePath,
|
filePath,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
dispatch(doCheckPendingPublishesApp());
|
||||||
|
// @if TARGET='app'
|
||||||
|
dispatch(doCheckReflectingFiles());
|
||||||
|
// @endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const publishFail = error => {
|
const publishFail = error => {
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
import * as ACTIONS from 'constants/action_types';
|
|
||||||
|
|
||||||
const reducers = {};
|
|
||||||
const defaultState = {};
|
|
||||||
|
|
||||||
reducers[ACTIONS.FETCH_AVAILABILITY_STARTED] = (state, action) => {
|
|
||||||
const { uri } = action.data;
|
|
||||||
const newFetching = Object.assign({}, state.fetching);
|
|
||||||
|
|
||||||
newFetching[uri] = true;
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
fetching: newFetching,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.FETCH_AVAILABILITY_COMPLETED] = (state, action) => {
|
|
||||||
const { uri, availability } = action.data;
|
|
||||||
|
|
||||||
const newFetching = Object.assign({}, state.fetching);
|
|
||||||
const newAvailabilityByUri = Object.assign({}, state.byUri);
|
|
||||||
|
|
||||||
delete newFetching[uri];
|
|
||||||
newAvailabilityByUri[uri] = availability;
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
fetching: newFetching,
|
|
||||||
byUri: newAvailabilityByUri,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function reducer(state = defaultState, action) {
|
|
||||||
const handler = reducers[action.type];
|
|
||||||
if (handler) return handler(state, action);
|
|
||||||
return state;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
|
|
||||||
const selectState = state => state.availability;
|
|
||||||
|
|
||||||
const selectFetchingAvailability = createSelector(
|
|
||||||
selectState,
|
|
||||||
state => state.fetching || {}
|
|
||||||
);
|
|
||||||
|
|
||||||
export { selectFetchingAvailability as default };
|
|
|
@ -6178,9 +6178,9 @@ lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#1e27a854d012ef758c04b234fb80e74e264d5962:
|
lbry-redux@lbryio/lbry-redux#3be6fa52ac1cb6224cf9de45623183e62c2b24ab:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/1e27a854d012ef758c04b234fb80e74e264d5962"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/3be6fa52ac1cb6224cf9de45623183e62c2b24ab"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue