Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e263852a |
No files matched your search
+2
-1
@@ -13,6 +13,7 @@ LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API_ALT=https://recsys.odysee.com/search
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://thumbnails.odysee.com/optimize/
|
||||
@@ -124,4 +125,4 @@ FIREBASE_STORAGE_BUCKET=lbry-mobile.appspot.com
|
||||
FIREBASE_MESSAGING_SENDER_ID=638894153788
|
||||
FIREBASE_APP_ID=1:638894153788:web:35b295b15297201bd2e339
|
||||
FIREBASE_MEASUREMENT_ID=G-2MPJGFEEXC
|
||||
FIREBASE_VAPID_KEY=BFayEBpwMTU9GQQpXgitIJkfx-SD8-ltrFb3wLTZWgA27MfBhG4948pe0eERl432NzPrMKsbkXnA7ap_vLPgLYk
|
||||
FIREBASE_VAPID_KEY=BFayEBpwMTU9GQQpXgitIJkfx-SD8-ltrFb3wLTZWgA27MfBhG4948pe0eERl432NzPrMKsbkXnA7ap_vLPgLYk
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
# Odysee Frontend - Odysee.com
|
||||
# Odysee Frontend - Odysee.com
|
||||
|
||||
This repo contains the UI and front end code that powers Odysee.com.
|
||||
|
||||
@@ -79,7 +79,7 @@ nano .env
|
||||
1. add `CUSTOM_HOMEPAGE=true` to the '.env' file
|
||||
2. copy `/custom/homepage.example.js` to `/custom/homepage.js` and make desired changes to `homepage.js`
|
||||
|
||||
- If you want up to two custom sidebar links
|
||||
- If you want up to two custom sidebar links:
|
||||
|
||||
```
|
||||
PINNED_URI_1=@someurl#2/someclaim#4
|
||||
@@ -120,6 +120,5 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
|
||||
We take security seriously. Please contact security@odysee.com regarding any security issues. Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it. Previous versions up to v0.50.2 were signed by [Sean Yesmunt](https://keybase.io/seanyesmunt/key.asc).
|
||||
New Releases are signed by [Jessop Breth](https://keybase.io/jessopb/key.asc).
|
||||
For security issues, please reach out to security@odysee.com
|
||||
|
||||
@@ -6,12 +6,14 @@ const config = {
|
||||
WEBPACK_WEB_PORT: process.env.WEBPACK_WEB_PORT,
|
||||
WEBPACK_ELECTRON_PORT: process.env.WEBPACK_ELECTRON_PORT,
|
||||
WEB_SERVER_PORT: process.env.WEB_SERVER_PORT,
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, //api.na-backend.odysee.com',
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, // api.na-backend.odysee.com',
|
||||
LBRY_WEB_PUBLISH_API: process.env.LBRY_WEB_PUBLISH_API,
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_PUBLISH_API_V2: process.env.LBRY_WEB_PUBLISH_API_V2,
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, // api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, // cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
SEARCH_SERVER_API_ALT: process.env.SEARCH_SERVER_API_ALT,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
@@ -32,7 +34,6 @@ const config = {
|
||||
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
|
||||
// LOGO
|
||||
LOGO_TITLE: process.env.LOGO_TITLE,
|
||||
FAVICON: process.env.FAVICON,
|
||||
LOGO: process.env.LOGO,
|
||||
LOGO_TEXT_LIGHT: process.env.LOGO_TEXT_LIGHT,
|
||||
LOGO_TEXT_DARK: process.env.LOGO_TEXT_DARK,
|
||||
@@ -88,7 +89,11 @@ const config = {
|
||||
|
||||
};
|
||||
|
||||
config.SDK_API_PATH = `${config.LBRY_WEB_API}/api/v1`;
|
||||
config.PROXY_URL = `${config.SDK_API_PATH}/proxy`;
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.FAVICON = `/public/favicon-spaceman.png`;
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,5 +1,4 @@
|
||||
import { app, Menu, shell } from 'electron';
|
||||
import { ZOOM } from 'util/zoomWindow';
|
||||
|
||||
export default () => {
|
||||
const template = [
|
||||
@@ -23,38 +22,6 @@ export default () => {
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{ role: 'reload' },
|
||||
{
|
||||
label: 'Zoom',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Zoom In',
|
||||
accelerator: 'CmdOrCtrl+=',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.INCREMENT);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Zoom Out',
|
||||
accelerator: 'CmdOrCtrl+-',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.DECREMENT);
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Reset Zoom',
|
||||
accelerator: 'CmdOrCtrl+0',
|
||||
click: (menuItem, browserWindow) => {
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.send('zoom-window', ZOOM.RESET);
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Developer',
|
||||
submenu: [{ role: 'forcereload' }, { role: 'toggledevtools' }],
|
||||
|
||||
@@ -83,9 +83,6 @@ export const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
|
||||
export const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
|
||||
export const SYNC_RESET = 'SYNC_RESET';
|
||||
|
||||
// Lbry.tv
|
||||
export const UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
|
||||
|
||||
// User
|
||||
export const GENERATE_AUTH_TOKEN_FAILURE = 'GENERATE_AUTH_TOKEN_FAILURE';
|
||||
export const GENERATE_AUTH_TOKEN_STARTED = 'GENERATE_AUTH_TOKEN_STARTED';
|
||||
|
||||
@@ -27,7 +27,6 @@ export {
|
||||
doResetSync,
|
||||
doSyncEncryptAndDecrypt,
|
||||
} from 'redux/actions/sync';
|
||||
export { doUpdateUploadProgress } from './redux/actions/web';
|
||||
|
||||
// reducers
|
||||
export { authReducer } from './redux/reducers/auth';
|
||||
@@ -37,13 +36,12 @@ export { filteredReducer } from './redux/reducers/filtered';
|
||||
// export { homepageReducer } from './redux/reducers/homepage';
|
||||
export { statsReducer } from './redux/reducers/stats';
|
||||
export { syncReducer } from './redux/reducers/sync';
|
||||
export { webReducer } from './redux/reducers/web';
|
||||
|
||||
// selectors
|
||||
export { selectAuthToken, selectIsAuthenticating } from './redux/selectors/auth';
|
||||
export {
|
||||
makeSelectFetchingCostInfoForUri,
|
||||
makeSelectCostInfoForUri,
|
||||
selectFetchingCostInfoForUri,
|
||||
selectCostInfoForUri,
|
||||
selectAllCostInfoByUri,
|
||||
selectFetchingCostInfo,
|
||||
} from './redux/selectors/cost_info';
|
||||
@@ -55,7 +53,7 @@ export { selectFilteredOutpoints, selectFilteredOutpointMap } from './redux/sele
|
||||
// selectTrendingUris,
|
||||
// selectFetchingTrendingUris,
|
||||
// } from './redux/selectors/homepage';
|
||||
export { selectViewCount, makeSelectViewCountForUri, makeSelectSubCountForUri } from './redux/selectors/stats';
|
||||
export { selectViewCount, selectViewCountForUri, selectSubCountForUri } from './redux/selectors/stats';
|
||||
export { selectBanStateForUri } from './redux/selectors/ban';
|
||||
export {
|
||||
selectHasSyncedWallet,
|
||||
@@ -70,4 +68,3 @@ export {
|
||||
selectSyncApplyErrorMessage,
|
||||
selectSyncApplyPasswordError,
|
||||
} from './redux/selectors/sync';
|
||||
export { selectCurrentUploads, selectUploadCount } from './redux/selectors/web';
|
||||
@@ -1,12 +1,13 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { selectClaimsByUri } from 'redux/selectors/claims';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function doFetchCostInfoForUri(uri) {
|
||||
return (dispatch, getState) => {
|
||||
export function doFetchCostInfoForUri(uri: string) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
|
||||
if (!claim) return;
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export const doUpdateUploadProgress = (
|
||||
progress: string,
|
||||
params: { [key: string]: any },
|
||||
xhr: any
|
||||
) => (dispatch: Dispatch) =>
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_UPLOAD_PROGRESS,
|
||||
data: { progress, params, xhr },
|
||||
});
|
||||
@@ -1,62 +0,0 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
/*
|
||||
test mock:
|
||||
currentUploads: {
|
||||
'test#upload': {
|
||||
progress: 50,
|
||||
params: {
|
||||
name: 'steve',
|
||||
thumbnail_url: 'https://dev2.spee.ch/4/KMNtoSZ009fawGz59VG8PrID.jpeg',
|
||||
},
|
||||
},
|
||||
},
|
||||
*/
|
||||
|
||||
export type Params = {
|
||||
channel?: string,
|
||||
name: string,
|
||||
thumbnail_url: ?string,
|
||||
title: ?string,
|
||||
};
|
||||
|
||||
export type UploadItem = {
|
||||
progess: string,
|
||||
params: Params,
|
||||
xhr?: any,
|
||||
};
|
||||
|
||||
export type TvState = {
|
||||
currentUploads: { [key: string]: UploadItem },
|
||||
};
|
||||
|
||||
const reducers = {};
|
||||
|
||||
const defaultState: TvState = {
|
||||
currentUploads: {},
|
||||
};
|
||||
|
||||
reducers[ACTIONS.UPDATE_UPLOAD_PROGRESS] = (state: TvState, action) => {
|
||||
const { progress, params, xhr } = action.data;
|
||||
const key = params.channel ? `${params.name}#${params.channel}` : `${params.name}#anonymous`;
|
||||
let currentUploads;
|
||||
if (!progress) {
|
||||
currentUploads = Object.assign({}, state.currentUploads);
|
||||
Object.keys(currentUploads).forEach(k => {
|
||||
if (k === key) {
|
||||
delete currentUploads[key];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
currentUploads = Object.assign({}, state.currentUploads);
|
||||
currentUploads[key] = { progress, params, xhr };
|
||||
}
|
||||
return { ...state, currentUploads };
|
||||
};
|
||||
|
||||
export function webReducer(state: TvState = defaultState, action: any) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
return state;
|
||||
}
|
||||
@@ -8,85 +8,57 @@ import { createCachedSelector } from 're-reselect';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import { isURIEqual } from 'util/lbryURI';
|
||||
|
||||
const selectClaimExistsForUri = (state, uri) => {
|
||||
return Boolean(selectClaimForUri(state, uri));
|
||||
};
|
||||
|
||||
const selectTxidForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.txid : claim ? claim.txid : undefined;
|
||||
};
|
||||
|
||||
const selectNoutForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.nout : claim ? claim.nout : undefined;
|
||||
};
|
||||
|
||||
const selectPermanentUrlForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.permanent_url : claim ? claim.permanent_url : undefined;
|
||||
};
|
||||
|
||||
export const selectBanStateForUri = createCachedSelector(
|
||||
// Break apart 'selectClaimForUri' into 4 cheaper selectors that return
|
||||
// primitives for values that we care about. The Claim object itself is easily
|
||||
// invalidated due to constantly-changing fields like 'confirmation'.
|
||||
selectClaimExistsForUri,
|
||||
selectTxidForUri,
|
||||
selectNoutForUri,
|
||||
selectPermanentUrlForUri,
|
||||
selectBlackListedOutpoints,
|
||||
selectFilteredOutpoints,
|
||||
selectClaimForUri,
|
||||
selectBlacklistedOutpointMap,
|
||||
selectFilteredOutpointMap,
|
||||
selectMutedChannels,
|
||||
selectModerationBlockList,
|
||||
(
|
||||
claimExists,
|
||||
txid,
|
||||
nout,
|
||||
permanentUrl,
|
||||
blackListedOutpoints,
|
||||
filteredOutpoints,
|
||||
mutedChannelUris,
|
||||
personalBlocklist
|
||||
) => {
|
||||
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist) => {
|
||||
const banState = {};
|
||||
|
||||
if (!claimExists) {
|
||||
if (!claim) {
|
||||
return banState;
|
||||
}
|
||||
|
||||
const channelClaim = getChannelFromClaim(claim);
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level.
|
||||
if (blackListedOutpoints) {
|
||||
if (blackListedOutpoints.some((outpoint) => outpoint.txid === txid && outpoint.nout === nout)) {
|
||||
if (blackListedOutpointMap) {
|
||||
if (
|
||||
(channelClaim && blackListedOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
|
||||
blackListedOutpointMap[`${claim.txid}:${claim.nout}`]
|
||||
) {
|
||||
banState['blacklisted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We're checking to see if the stream outpoint or signing channel outpoint
|
||||
// is in the filter list.
|
||||
if (filteredOutpoints) {
|
||||
if (filteredOutpoints.some((outpoint) => outpoint.txid === txid && outpoint.nout === nout)) {
|
||||
if (filteredOutpointMap) {
|
||||
if (
|
||||
(channelClaim && filteredOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
|
||||
filteredOutpointMap[`${claim.txid}:${claim.nout}`]
|
||||
) {
|
||||
banState['filtered'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// block stream claims
|
||||
// block channel claims if we can't control for them in claim search
|
||||
if (mutedChannelUris.length) {
|
||||
if (mutedChannelUris.some((blockedUri) => isURIEqual(blockedUri, permanentUrl))) {
|
||||
if (mutedChannelUris.length && channelClaim) {
|
||||
if (mutedChannelUris.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {
|
||||
banState['muted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Commentron blocklist
|
||||
if (personalBlocklist.length) {
|
||||
if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, permanentUrl))) {
|
||||
if (personalBlocklist.length && channelClaim) {
|
||||
if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {
|
||||
banState['blocked'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { createSelector } from 'reselect';
|
||||
// @flow
|
||||
type State = { costInfo: any };
|
||||
|
||||
export const selectState = state => state.costInfo || {};
|
||||
export const selectState = (state: State) => state.costInfo || {};
|
||||
export const selectAllCostInfoByUri = (state: State) => selectState(state).byUri;
|
||||
export const selectFetchingCostInfo = (state: State) => selectState(state).fetching;
|
||||
|
||||
export const selectAllCostInfoByUri = createSelector(selectState, state => state.byUri || {});
|
||||
export const selectCostInfoForUri = (state: State, uri: string) => {
|
||||
const costInfos = selectAllCostInfoByUri(state);
|
||||
return costInfos && costInfos[uri];
|
||||
};
|
||||
|
||||
export const makeSelectCostInfoForUri = uri =>
|
||||
createSelector(selectAllCostInfoByUri, costInfos => costInfos && costInfos[uri]);
|
||||
|
||||
export const selectFetchingCostInfo = createSelector(selectState, state => state.fetching || {});
|
||||
|
||||
export const makeSelectFetchingCostInfoForUri = uri =>
|
||||
createSelector(selectFetchingCostInfo, fetchingByUri => fetchingByUri && fetchingByUri[uri]);
|
||||
export const selectFetchingCostInfoForUri = (state: State, uri: string) => {
|
||||
const fetchingByUri = selectFetchingCostInfo(state);
|
||||
return fetchingByUri && fetchingByUri[uri];
|
||||
};
|
||||
@@ -1,20 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
// @flow
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
|
||||
const selectState = state => state.stats || {};
|
||||
export const selectViewCount = createSelector(selectState, state => state.viewCountById);
|
||||
export const selectSubCount = createSelector(selectState, state => state.subCountById);
|
||||
type State = { claims: any, stats: any };
|
||||
|
||||
export const makeSelectViewCountForUri = uri =>
|
||||
createSelector(
|
||||
makeSelectClaimForUri(uri),
|
||||
selectViewCount,
|
||||
(claim, viewCountById) => (claim ? viewCountById[claim.claim_id] || 0 : 0)
|
||||
);
|
||||
const selectState = (state: State) => state.stats || {};
|
||||
export const selectViewCount = (state: State) => selectState(state).viewCountById;
|
||||
export const selectSubCount = (state: State) => selectState(state).subCountById;
|
||||
|
||||
export const makeSelectSubCountForUri = uri =>
|
||||
createSelector(
|
||||
makeSelectClaimForUri(uri),
|
||||
selectSubCount,
|
||||
(claim, subCountById) => (claim ? subCountById[claim.claim_id] || 0 : 0)
|
||||
);
|
||||
export const selectViewCountForUri = (state: State, uri: string) => {
|
||||
const claimId = selectClaimIdForUri(state, uri);
|
||||
const viewCountById = selectViewCount(state);
|
||||
return claimId ? viewCountById[claimId] || 0 : 0;
|
||||
};
|
||||
|
||||
export const selectSubCountForUri = (state: State, uri: string) => {
|
||||
const claimId = selectClaimIdForUri(state, uri);
|
||||
const subCountById = selectSubCount(state);
|
||||
return claimId ? subCountById[claimId] || 0 : 0;
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
const selectState = (state) => state.web || {};
|
||||
|
||||
export const selectCurrentUploads = (state) => selectState(state).currentUploads;
|
||||
|
||||
export const selectUploadCount = createSelector(
|
||||
selectCurrentUploads,
|
||||
(currentUploads) => currentUploads && Object.keys(currentUploads).length
|
||||
);
|
||||
@@ -5,10 +5,10 @@ import { parseURI } from 'util/lbryURI';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectPlayingUri, selectPrimaryUri } from 'redux/selectors/content';
|
||||
import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import { history } from 'ui/store';
|
||||
|
||||
const recsysEndpoint = 'https://clickstream.odysee.com/log/video/view';
|
||||
const recsysEndpoint = 'https://recsys.odysee.com/log/video/view';
|
||||
const recsysId = 'lighthouse-v0';
|
||||
|
||||
const getClaimIdsFromUris = (uris) => {
|
||||
@@ -229,7 +229,7 @@ const recsys = {
|
||||
const claim = makeSelectClaimForUri(actualPlayingUri)(state);
|
||||
const playingClaimId = claim ? claim.claim_id : null;
|
||||
// const primaryUri = selectPrimaryUri(state);
|
||||
const floatingPlayer = makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state);
|
||||
const floatingPlayer = selectClientSetting(state, SETTINGS.FLOATING_PLAYER);
|
||||
// When leaving page, if floating player is enabled, play will continue.
|
||||
Object.keys(recsys.entries).forEach((claimId) => {
|
||||
const shouldSkip = recsys.entries[claimId].parentUuid && !recsys.entries[claimId].recClaimIds;
|
||||
|
||||
Vendored
+7
-3
@@ -169,8 +169,10 @@ declare type CommentAbandonParams = {
|
||||
comment_id: string,
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
channel_id?: string,
|
||||
hexdata?: string,
|
||||
signature?: string,
|
||||
signing_ts?: string,
|
||||
mod_channel_id?: string,
|
||||
mod_channel_name?: string,
|
||||
};
|
||||
|
||||
declare type CommentCreateParams = {
|
||||
@@ -204,9 +206,11 @@ declare type ModerationBlockParams = {
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
// ID of comment to remove as part of this block
|
||||
offending_comment_id?: string,
|
||||
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
||||
block_all?: boolean,
|
||||
time_out?: number,
|
||||
time_out?: ?number,
|
||||
// If true will delete all comments of the offender, requires Admin rights on commentron for universal delete
|
||||
delete_all?: boolean,
|
||||
// The usual signature stuff
|
||||
|
||||
Vendored
+23
@@ -52,3 +52,26 @@ declare type PublishParams = {
|
||||
nsfw: boolean,
|
||||
tags: Array<Tag>,
|
||||
};
|
||||
|
||||
declare type TusUploader = any;
|
||||
|
||||
declare type FileUploadSdkParams = {
|
||||
file_path: string,
|
||||
name: ?string,
|
||||
preview?: boolean,
|
||||
remote_url?: string,
|
||||
thumbnail_url?: string,
|
||||
title?: string,
|
||||
// Temporary values
|
||||
uploadUrl?: string,
|
||||
};
|
||||
|
||||
declare type FileUploadItem = {
|
||||
params: FileUploadSdkParams,
|
||||
file: File,
|
||||
fileFingerprint: string,
|
||||
progress: string,
|
||||
status?: string,
|
||||
uploader?: TusUploader | XMLHttpRequest,
|
||||
resumable: boolean,
|
||||
};
|
||||
+2
-1
@@ -20,7 +20,6 @@
|
||||
},
|
||||
"main": "./dist/electron/main.js",
|
||||
"scripts": {
|
||||
"analyze": "yarn compile && source-map-explorer --no-border-checks web/dist/public/*.js --html analyzeResults.html",
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||
@@ -60,6 +59,7 @@
|
||||
"if-env": "^1.0.4",
|
||||
"match-sorter": "^6.3.0",
|
||||
"parse-duration": "^1.0.0",
|
||||
"player.js": "^0.1.0",
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"re-reselect": "^4.0.0",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
@@ -69,6 +69,7 @@
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"tempy": "^0.6.0",
|
||||
"tus-js-client": "^2.3.0",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
"videojs-ima": "^1.11.0",
|
||||
"videojs-ima-player": "^0.5.6",
|
||||
|
||||
+88
-51
@@ -55,19 +55,30 @@
|
||||
"Deposit": "Deposit",
|
||||
"Language": "Language",
|
||||
"English": "English",
|
||||
"Arabic": "Arabic",
|
||||
"Chinese": "Chinese",
|
||||
"Croatian": "Croatian",
|
||||
"Czech": "Czech",
|
||||
"Dutch": "Dutch",
|
||||
"French": "French",
|
||||
"German": "German",
|
||||
"Japanese": "Japanese",
|
||||
"Russian": "Russian",
|
||||
"Spanish": "Spanish",
|
||||
"Greek": "Greek",
|
||||
"Hindi": "Hindi",
|
||||
"Indonesian": "Indonesian",
|
||||
"Italian": "Italian",
|
||||
"Dutch": "Dutch",
|
||||
"Turkish": "Turkish",
|
||||
"Polish": "Polish",
|
||||
"Malay": "Malay",
|
||||
"Japanese": "Japanese",
|
||||
"Khmer": "Khmer",
|
||||
"Korean": "Korean",
|
||||
"Malay": "Malay",
|
||||
"Norwegian": "Norwegian",
|
||||
"Persian": "Persian",
|
||||
"Polish": "Polish",
|
||||
"Romanian": "Romanian",
|
||||
"Russian": "Russian",
|
||||
"Spanish": "Spanish",
|
||||
"Thai": "Thai",
|
||||
"Turkish": "Turkish",
|
||||
"Vietnamese": "Vietnamese",
|
||||
"By continuing, you accept the %lbry_terms_of_service%.": "By continuing, you accept the %lbry_terms_of_service%.",
|
||||
"LBRY Terms of Service": "LBRY Terms of Service",
|
||||
"Enter a thumbnail URL": "Enter a thumbnail URL",
|
||||
@@ -111,7 +122,7 @@
|
||||
"Balance": "Balance",
|
||||
"Full History": "Full History",
|
||||
"Refresh": "Refresh",
|
||||
"Send LBRY Credits to your friends or favorite creators.": "Send LBRY Credits to your friends or favorite creators.",
|
||||
"Send Credits to your friends or favorite creators.": "Send Credits to your friends or favorite creators.",
|
||||
"Amount": "Amount",
|
||||
"Recipient address": "Recipient address",
|
||||
"Send": "Send",
|
||||
@@ -173,10 +184,10 @@
|
||||
"Confirm External Resource": "Confirm External Resource",
|
||||
"Continue": "Continue",
|
||||
"This file has been shared with you by other people.": "This file has been shared with you by other people.",
|
||||
"LBRY Inc is not responsible for its content, click continue to proceed at your own risk.": "LBRY Inc is not responsible for its content, click continue to proceed at your own risk.",
|
||||
"Odysee is not responsible for its content, click continue to proceed at your own risk.": "Odysee is not responsible for its content, click continue to proceed at your own risk.",
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.",
|
||||
"These search results are provided by Odysee.": "These search results are provided by Odysee.",
|
||||
"View file": "View file",
|
||||
"Files": "Files",
|
||||
"Channels": "Channels",
|
||||
@@ -239,9 +250,9 @@
|
||||
"release notes": "release notes",
|
||||
"Read the FAQ": "Read the FAQ",
|
||||
"Our FAQ answers many common questions.": "Our FAQ answers many common questions.",
|
||||
"Join Our Chat": "Join Our Chat",
|
||||
"Join the Foundation Chat": "Join the Foundation Chat",
|
||||
"Report a bug or suggest something": "Report a bug or suggest something",
|
||||
"Did you find something wrong? Think LBRY could add something useful and cool?": "Did you find something wrong? Think LBRY could add something useful and cool?",
|
||||
"Did you find something wrong? Think Odysee could add something useful and cool?": "Did you find something wrong? Think Odysee could add something useful and cool?",
|
||||
"View your log": "View your log",
|
||||
"support": "support",
|
||||
"Open Log": "Open Log",
|
||||
@@ -324,7 +335,7 @@
|
||||
"Please wait for thumbnail to finish uploading": "Please wait for thumbnail to finish uploading",
|
||||
"A thumbnail is required. Please upload or provide an image URL above.": "A thumbnail is required. Please upload or provide an image URL above.",
|
||||
"Thumbnail is invalid.": "Thumbnail is invalid.",
|
||||
"Please reselect a file after changing the LBRY URL": "Please reselect a file after changing the LBRY URL",
|
||||
"Please reselect a file after changing the URL": "Please reselect a file after changing the URL",
|
||||
"API connection string": "API connection string",
|
||||
"Method": "Method",
|
||||
"Parameters": "Parameters",
|
||||
@@ -332,7 +343,7 @@
|
||||
"Error message": "Error message",
|
||||
"Error data": "Error data",
|
||||
"Error": "Error",
|
||||
"We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.": "We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.",
|
||||
"We're sorry that Odysee has encountered an error. Please try again or reach out to hello@odysee.com with detailed information.": "We're sorry that Odysee has encountered an error. Please try again or reach out to hello@odysee.com with detailed information.",
|
||||
"Customize": "Customize",
|
||||
"Customize Your Homepage": "Customize Your Homepage",
|
||||
"Tags You Follow": "Tags You Follow",
|
||||
@@ -379,7 +390,6 @@
|
||||
"Read more about why we do this.": "Read more about why we do this.",
|
||||
"Submit Phone Number": "Submit Phone Number",
|
||||
"Standard messaging rates apply. Having trouble?": "Standard messaging rates apply. Having trouble?",
|
||||
"Join LBRY Chat": "Join LBRY Chat",
|
||||
"Blockchain Sync": "Blockchain Sync",
|
||||
"No rewards available": "No rewards available",
|
||||
"You have claimed all available rewards! We're regularly adding more so be sure to check back later.": "You have claimed all available rewards! We're regularly adding more so be sure to check back later.",
|
||||
@@ -393,8 +403,8 @@
|
||||
"These LBRY Credits remain yours. It is a deposit to reserve the name and can be undone at any time.": "These LBRY Credits remain yours. It is a deposit to reserve the name and can be undone at any time.",
|
||||
"Create channel": "Create channel",
|
||||
"Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.": "Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.",
|
||||
"Read the App Basics FAQ": "Read the App Basics FAQ",
|
||||
"View all LBRY FAQs": "View all LBRY FAQs",
|
||||
"Read Odysee Basics FAQ": "Read Odysee Basics FAQ",
|
||||
"View all Odysee FAQs": "View all Odysee FAQs",
|
||||
"Find assistance": "Find assistance",
|
||||
"Email Us": "Email Us",
|
||||
"Today": "Today",
|
||||
@@ -471,18 +481,7 @@
|
||||
"This file is in your library.": "This file is in your library.",
|
||||
"Invalid claim ID %s.": "Invalid claim ID %s.",
|
||||
"View Tag": "View Tag",
|
||||
"Vietnamese": "Vietnamese",
|
||||
"Thai": "Thai",
|
||||
"Arabic": "Arabic",
|
||||
"Czech": "Czech",
|
||||
"Croatian": "Croatian",
|
||||
"Korean": "Korean",
|
||||
"Norwegian": "Norwegian",
|
||||
"Romanian": "Romanian",
|
||||
"Hindi": "Hindi",
|
||||
"Greek": "Greek",
|
||||
"Hide": "Hide",
|
||||
"Persian": "Persian",
|
||||
"Sorry, we can't preview this file.": "Sorry, we can't preview this file.",
|
||||
"View File": "View File",
|
||||
"Close": "Close",
|
||||
@@ -514,7 +513,7 @@
|
||||
"Not enough Credits": "Not enough Credits",
|
||||
"Decrease amount to account for transaction fee": "Decrease amount to account for transaction fee",
|
||||
"You have %credit_amount% in unclaimed rewards.": "You have %credit_amount% in unclaimed rewards.",
|
||||
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.",
|
||||
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications. Content may also be blocked due to DMCA Red Flag rules which are obvious copyright violations we come across, are discussed in public channels, or reported to us.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications. Content may also be blocked due to DMCA Red Flag rules which are obvious copyright violations we come across, are discussed in public channels, or reported to us.",
|
||||
"Read More": "Read More",
|
||||
"Read more": "Read more",
|
||||
"Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.": "Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.",
|
||||
@@ -549,7 +548,7 @@
|
||||
"Your YouTube channel": "Your YouTube channel",
|
||||
"Your YouTube channels": "Your YouTube channels",
|
||||
"Your videos are currently being transferred. There is nothing else for you to do.": "Your videos are currently being transferred. There is nothing else for you to do.",
|
||||
"Please check back later. This may take up to 1 week.": "Please check back later. This may take up to 1 week.",
|
||||
"Please check back later, this may take a few hours.": "Please check back later, this may take a few hours.",
|
||||
"%channelName% is not yet ready to be transferred. Please allow up to one week, though it is frequently faster.": "%channelName% is not yet ready to be transferred. Please allow up to one week, though it is frequently faster.",
|
||||
"here": "here",
|
||||
"%channelName% is not ready to be transferred. You can check the status %statusLink% or check back later.": "%channelName% is not ready to be transferred. You can check the status %statusLink% or check back later.",
|
||||
@@ -647,8 +646,8 @@
|
||||
"Failed to load %language% translations.": "Failed to load %language% translations.",
|
||||
"contact support": "contact support",
|
||||
"If you continue to have issues, please %support%.": "If you continue to have issues, please %support%.",
|
||||
"lbry.tv Account": "lbry.tv Account",
|
||||
"Creating a lbry.tv account will allow you to earn rewards, receive content and security updates, and optionally backup your data.": "Creating a lbry.tv account will allow you to earn rewards, receive content and security updates, and optionally backup your data.",
|
||||
"odysee.com Account": "odysee.com Account",
|
||||
"Creating a odysee.com account will allow you to earn rewards, receive content and security updates, and optionally backup your data.": "Creating a odysee.com account will allow you to earn rewards, receive content and security updates, and optionally backup your data.",
|
||||
"Paid content cannot be embedded": "Paid content cannot be embedded",
|
||||
"This content cannot be embedded": "This content cannot be embedded",
|
||||
"Your videos are ready to be transferred.": "Your videos are ready to be transferred.",
|
||||
@@ -706,7 +705,6 @@
|
||||
"Use custom wallet servers": "Use custom wallet servers",
|
||||
"Remove custom wallet server": "Remove custom wallet server",
|
||||
"Add": "Add",
|
||||
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.",
|
||||
"lbry.tv": "lbry.tv",
|
||||
"Bid position must be a number.": "Bid position must be a number.",
|
||||
"Copy": "Copy",
|
||||
@@ -822,9 +820,9 @@
|
||||
"Can this app send information about your usage to inform publishers and improve the software?": "Can this app send information about your usage to inform publishers and improve the software?",
|
||||
"Yes, including with third-party analytics platforms": "Yes, including with third-party analytics platforms",
|
||||
"Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed analytical reports to improve all aspects of LBRY.": "Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed analytical reports to improve all aspects of LBRY.",
|
||||
"Yes, but only with LBRY, Inc.": "Yes, but only with LBRY, Inc.",
|
||||
"Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.": "Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.",
|
||||
"No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.": "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.",
|
||||
"Yes, but only with Odysee, Inc.": "Yes, but only with Odysee, Inc.",
|
||||
"Sharing information with Odysee, Inc. allows us to report to publishers how their content is doing, as well as track basic usage and performance. This is the minimum required to earn rewards from Odysee, Inc.": "Sharing information with Odysee, Inc. allows us to report to publishers how their content is doing, as well as track basic usage and performance. This is the minimum required to earn rewards from Odysee, Inc.",
|
||||
"No information will be sent directly to Odysee, Inc. or third-parties about your usage. Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.": "No information will be sent directly to Odysee, Inc. or third-parties about your usage. Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.",
|
||||
"Let's go": "Let's go",
|
||||
"Do you agree to the %terms%?": "Do you agree to the %terms%?",
|
||||
"While we respect the desire for maximally private usage, please note that choosing this option hurts the ability for creators to understand how their content is performing.": "While we respect the desire for maximally private usage, please note that choosing this option hurts the ability for creators to understand how their content is performing.",
|
||||
@@ -869,7 +867,7 @@
|
||||
"Are you sure? Type %name% to confirm that you wish to remove the channel.": "Are you sure? Type %name% to confirm that you wish to remove the channel.",
|
||||
"This will permanently remove your channel. Content published under this channel will be orphaned.": "This will permanently remove your channel. Content published under this channel will be orphaned.",
|
||||
"Are you sure you'd like to remove \"%title%\"?": "Are you sure you'd like to remove \"%title%\"?",
|
||||
"You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.": "You are signed into lbry.tv which automatically shares data with LBRY inc. %signout_button%.",
|
||||
"You are signed into odysee.com which automatically shares data with LBRY inc. %signout_button%.": "You are signed into odysee.com which automatically shares data with LBRY inc. %signout_button%.",
|
||||
"%SITE_NAME% works better if you find and follow a couple creators you like. You can also block channels you never want to see.": "%SITE_NAME% works better if you find and follow a couple creators you like. You can also block channels you never want to see.",
|
||||
"Nice! You are currently following %followingCount% creator": "Nice! You are currently following %followingCount% creator",
|
||||
"Nice! You are currently following %followingCount% creators": "Nice! You are currently following %followingCount% creators",
|
||||
@@ -916,6 +914,11 @@
|
||||
"Please decrease the amount to account for transaction fees": "Please decrease the amount to account for transaction fees",
|
||||
"Amount cannot be blank": "Amount cannot be blank",
|
||||
"Amount cannot be more than available": "Amount cannot be more than available",
|
||||
"Amount is lower than price of $%price_amount%": "Amount is lower than price of $%price_amount%",
|
||||
"Amount must have no more than 2 decimal places": "Amount must have no more than 2 decimal places",
|
||||
"Insufficient amount (%input_amount% Credits = %converted_amount% USD).": "Insufficient amount (%input_amount% Credits = %converted_amount% USD).",
|
||||
"This support is priced in $USD.": "This support is priced in $USD.",
|
||||
"The current exchange rate for the submitted LBC amount is ~ $%exchange_amount%.": "The current exchange rate for the submitted LBC amount is ~ $%exchange_amount%.",
|
||||
"Amount to unlock": "Amount to unlock",
|
||||
"Unlock tips": "Unlock tips",
|
||||
"Support This Claim": "Support This Claim",
|
||||
@@ -1008,6 +1011,7 @@
|
||||
"You deposited %amount% LBRY Credits as a support!": "You deposited %amount% LBRY Credits as a support!",
|
||||
"You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
"You sent %lbc% as a tip, Mahalo!": "You sent %lbc% as a tip, Mahalo!",
|
||||
"You sent %amount% LBRY Credits as a tip, Mahalo!": "You sent %amount% LBRY Credits as a tip, Mahalo!",
|
||||
"You sent %amount% LBRY Credits": "You sent %amount% LBRY Credits",
|
||||
"No stats found": "No stats found",
|
||||
@@ -1052,15 +1056,15 @@
|
||||
"Description of your issue or feature request": "Description of your issue or feature request",
|
||||
"Submitting...": "Submitting...",
|
||||
"Submit Report": "Submit Report",
|
||||
"Developer?": "Developer?",
|
||||
"Developer? Or looking for more?": "Developer? Or looking for more?",
|
||||
"You can also:": "You can also:",
|
||||
"Submit an issue on GitHub": "Submit an issue on GitHub",
|
||||
"Most viewed recent content": "Most viewed recent content",
|
||||
"Most viewed content all time": "Most viewed content all time",
|
||||
"There are no stats for this channel yet, it will take a few views. Make sure you are signed in with the correct email and have data sharing turned on.": "There are no stats for this channel yet, it will take a few views. Make sure you are signed in with the correct email and have data sharing turned on.",
|
||||
"Join our %tech_forum%": "Join our %tech_forum%",
|
||||
"Join LBRY's %tech_forum%": "Join LBRY's %tech_forum%",
|
||||
"tech forum": "tech forum",
|
||||
"Explore our %technical_resources%": "Explore our %technical_resources%",
|
||||
"Explore LBRY's %technical_resources%": "Explore LBRY's %technical_resources%",
|
||||
"technical resources": "technical resources",
|
||||
"Check your rewards page to see if you qualify for paid content reimbursement. Only content in this section qualifies.": "Check your rewards page to see if you qualify for paid content reimbursement. Only content in this section qualifies.",
|
||||
"Discover Channels": "Discover Channels",
|
||||
@@ -1080,11 +1084,11 @@
|
||||
"Trending For Your Tags": "Trending For Your Tags",
|
||||
"Latest From @lbry": "Latest From @lbry",
|
||||
"Latest From @lbrycast": "Latest From @lbrycast",
|
||||
"Hate these? %log_in_to_domain% or %download_the_app% for an ad free experience.": "Hate these? %log_in_to_domain% or %download_the_app% for an ad free experience.",
|
||||
"Hate these? %log_in_to_domain% for an ad free experience.": "Hate these? %log_in_to_domain% for an ad free experience.",
|
||||
"Hate these? Login to Odysee for an ad free experience": "Hate these? Login to Odysee for an ad free experience",
|
||||
"Log in to %domain%": "Log in to %domain%",
|
||||
"download the app": "download the app",
|
||||
"lbry.tv collects usage information for itself only (%more_information%).": "lbry.tv collects usage information for itself only (%more_information%).",
|
||||
"lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?": "lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?",
|
||||
"odysee collects usage information for itself only (%more_information%).": "odysee collects usage information for itself only (%more_information%).",
|
||||
"odysee collects usage information for itself only (%more_information%). Want control over this and more?": "odysee collects usage information for itself only (%more_information%). Want control over this and more?",
|
||||
"more --[value for \"more_information\"]--": "more",
|
||||
"%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.": "%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.",
|
||||
"Please %sign_in_link% to comment.": "Please %sign_in_link% to comment.",
|
||||
@@ -1108,7 +1112,7 @@
|
||||
"minute": "minute",
|
||||
"hours": "hours",
|
||||
"hour": "hour",
|
||||
"%SITE_NAME% uploads are limited to %limit% GB. Download the app for unrestricted publishing.": "%SITE_NAME% uploads are limited to %limit% GB. Download the app for unrestricted publishing.",
|
||||
"%SITE_NAME% uploads are limited to %limit% GB.": "%SITE_NAME% uploads are limited to %limit% GB.",
|
||||
"Connected": "Connected",
|
||||
"Not connected": "Not connected",
|
||||
"this link": "this link",
|
||||
@@ -1290,8 +1294,19 @@
|
||||
"Select a file to upload": "Select a file to upload",
|
||||
"Select file to upload": "Select file to upload",
|
||||
"Url copied.": "Url copied.",
|
||||
"Failed to initiate upload (%err%)": "Failed to initiate upload (%err%)",
|
||||
"Invalid file": "Invalid file",
|
||||
"It appears to be a different or modified file.": "It appears to be a different or modified file.",
|
||||
"Please select the same file from the initial upload.": "Please select the same file from the initial upload.",
|
||||
"Cancel upload": "Cancel upload",
|
||||
"Cancel and remove the selected upload?": "Cancel and remove the selected upload?",
|
||||
"Select the file to resume upload...": "Select the file to resume upload...",
|
||||
"Stopped.": "Stopped.",
|
||||
"Resume": "Resume",
|
||||
"Retrying...": "Retrying...",
|
||||
"Uploading...": "Uploading...",
|
||||
"Creating...": "Creating...",
|
||||
"Stopped. Duplicate session detected.": "Stopped. Duplicate session detected.",
|
||||
"Use a URL": "Use a URL",
|
||||
"Edit Cover Image": "Edit Cover Image",
|
||||
"Cover Image": "Cover Image",
|
||||
@@ -1397,6 +1412,7 @@
|
||||
"Cheese": "Cheese",
|
||||
"Cooking": "Cooking",
|
||||
"Big Hits": "Big Hits",
|
||||
"Education": "Education",
|
||||
"Enlightenment": "Enlightenment",
|
||||
"Gaming": "Gaming",
|
||||
"Game": "Game",
|
||||
@@ -1407,6 +1423,7 @@
|
||||
"Movies": "Movies",
|
||||
"News": "News",
|
||||
"News & Politics": "News & Politics",
|
||||
"Pop Culture": "Pop Culture",
|
||||
"Finance 2.0": "Finance 2.0",
|
||||
"The Universe": "The Universe",
|
||||
"Wild West": "Wild West",
|
||||
@@ -1429,7 +1446,6 @@
|
||||
"Log in to %SITE_NAME%": "Log in to %SITE_NAME%",
|
||||
"Log in": "Log in",
|
||||
"Not Yet": "Not Yet",
|
||||
"Preparing...": "Preparing...",
|
||||
"Confirm Upload": "Confirm Upload",
|
||||
"Confirm Edit": "Confirm Edit",
|
||||
"Create Livestream": "Create Livestream",
|
||||
@@ -1639,7 +1655,6 @@
|
||||
"You have no lists! Create one from any playable content.": "You have no lists! Create one from any playable content.",
|
||||
"Pick": "Pick",
|
||||
"You have unpublished lists! %pick% one and publish it!": "You have unpublished lists! %pick% one and publish it!",
|
||||
"No Reposts Found": "No Reposts Found",
|
||||
"Publish Something": "Publish Something",
|
||||
"Repost Something": "Repost Something",
|
||||
"Watch on %SITE_NAME%": "Watch on %SITE_NAME%",
|
||||
@@ -1650,6 +1665,7 @@
|
||||
"Most Supported": "Most Supported",
|
||||
"Search Results": "Search Results",
|
||||
"View All Results": "View All Results",
|
||||
"View All Playlists": "View All Playlists",
|
||||
"View competing uploads for %name%": "View competing uploads for %name%",
|
||||
"Homepage": "Homepage",
|
||||
"Currently winning": "Currently winning",
|
||||
@@ -1660,7 +1676,7 @@
|
||||
"POWERED BY %lbry_link%": "POWERED BY %lbry_link%",
|
||||
"Learn more about LBRY Credits on %DOMAIN%": "Learn more about LBRY Credits on %DOMAIN%",
|
||||
"Results boosted by %lbc%": "Results boosted by %lbc%",
|
||||
"This will be visible in a few minutes.": "This will be visible in a few minutes.",
|
||||
"Uploaded image will be visible in a few minutes after you submit this form.": "Uploaded image will be visible in a few minutes after you submit this form.",
|
||||
"Turn on notifications": "Turn on notifications",
|
||||
"Turn off notifications": "Turn off notifications",
|
||||
"Notifications turned off for %channel%.": "Notifications turned off for %channel%.",
|
||||
@@ -1696,7 +1712,7 @@
|
||||
"Enter a name or %domain% URL": "Enter a name or %domain% URL",
|
||||
"Winning amount: %amount%": "Winning amount: %amount%",
|
||||
"Download or get the app": "Download or get the app",
|
||||
"This content can be downloaded from lbry.tv, but not displayed. It will display in LBRY Desktop, an app for desktop computers.": "This content can be downloaded from lbry.tv, but not displayed. It will display in LBRY Desktop, an app for desktop computers.",
|
||||
"This content can be downloaded from odysee.com, but not displayed. It will display in LBRY Desktop, an app for desktop computers.": "This content can be downloaded from odysee.com, but not displayed. It will display in LBRY Desktop, an app for desktop computers.",
|
||||
"Repost Here": "Repost Here",
|
||||
"Publish Here": "Publish Here",
|
||||
"Close sidebar - hide channels you are following.": "Close sidebar - hide channels you are following.",
|
||||
@@ -1829,7 +1845,7 @@
|
||||
"Only visible to you": "Only visible to you",
|
||||
"People who view this link will be redirected to your livestream. Make sure to use this for sharing so your title and thumbnail are displayed properly.": "People who view this link will be redirected to your livestream. Make sure to use this for sharing so your title and thumbnail are displayed properly.",
|
||||
"View livestream": "View livestream",
|
||||
"You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.": "You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.",
|
||||
"You need to upload your livestream details before you can go live. Please note: Replays must be published manually after your stream via the Update button on the livestream.": "You need to upload your livestream details before you can go live. Please note: Replays must be published manually after your stream via the Update button on the livestream.",
|
||||
"Create A Livestream": "Create A Livestream",
|
||||
"Create a Livestream by first submitting your livestream details and waiting for approval confirmation. This can be done well in advance and will take a few minutes.": "Create a Livestream by first submitting your livestream details and waiting for approval confirmation. This can be done well in advance and will take a few minutes.",
|
||||
"The livestream will not be visible on your channel page until you are live, but you can share the URL in advance.": "The livestream will not be visible on your channel page until you are live, but you can share the URL in advance.",
|
||||
@@ -1883,6 +1899,7 @@
|
||||
"Alternative coins": "Alternative coins",
|
||||
"Failed to initiate swap.": "Failed to initiate swap.",
|
||||
"Failed to query swap status.": "Failed to query swap status.",
|
||||
"odysee.com is currently down": "odysee.com is currently down",
|
||||
"The system is currently down. Come back later.": "The system is currently down. Come back later.",
|
||||
"Unable to obtain exchange rate. Try again later.": "Unable to obtain exchange rate. Try again later.",
|
||||
"The amount needs to be higher": "The amount needs to be higher",
|
||||
@@ -2019,7 +2036,8 @@
|
||||
"Replay video available": "Replay video available",
|
||||
"Check for Replays": "Check for Replays",
|
||||
"You can upload your own recording or select a replay when your stream is over": "You can upload your own recording or select a replay when your stream is over",
|
||||
"This channel isn't staking enough LBRY Credits for inline image previews.": "This channel isn't staking enough LBRY Credits for inline image previews.",
|
||||
"This channel isn't staking enough Credits for inline image previews.": "This channel isn't staking enough Credits for inline image previews.",
|
||||
"This channel isn't staking enough Credits for link previews.": "This channel isn't staking enough Credits for link previews.",
|
||||
"Latest": "Latest",
|
||||
"Channel Not Found": "Channel Not Found",
|
||||
"Channel not found": "Channel not found",
|
||||
@@ -2205,5 +2223,24 @@
|
||||
"On Firefox, notifications won't function if cookies are set to clear on browser close. Please disable or add an exception for Odysee, then refresh.": "On Firefox, notifications won't function if cookies are set to clear on browser close. Please disable or add an exception for Odysee, then refresh.",
|
||||
"For Brave, enable google push notifications in settings.": "For Brave, enable google push notifications in settings.",
|
||||
"Check browser settings to see if notifications are disabled or otherwise restricted.": "Check browser settings to see if notifications are disabled or otherwise restricted.",
|
||||
"Claiming credits...": "Claiming credits...",
|
||||
"Sending...": "Sending...",
|
||||
"Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8",
|
||||
"Choose %asset%": "Choose %asset%",
|
||||
"Showing %filtered% results of %total%": "Showing %filtered% results of %total%",
|
||||
"Failed to synchronize settings. Wait a while before retrying.": "Failed to synchronize settings. Wait a while before retrying.",
|
||||
"You are offline. Check your internet connection.": "You are offline. Check your internet connection.",
|
||||
"A new version of Odysee is available.": "A new version of Odysee is available.",
|
||||
"Reset stream": "Reset stream",
|
||||
"Live stream successfully reset.": "Live stream successfully reset.",
|
||||
"There was an error resetting the live stream.": "There was an error resetting the live stream.",
|
||||
"If you're having trouble starting a stream or if your stream shows that you're live but aren't, try a reset. If the problem persists, please reach out at %SITE_HELP_EMAIL%.": "If you're having trouble starting a stream or if your stream shows that you're live but aren't, try a reset. If the problem persists, please reach out at %SITE_HELP_EMAIL%.",
|
||||
"Stickers": "Stickers",
|
||||
"Different Sticker": "Different Sticker",
|
||||
"Cash": "Cash",
|
||||
"Switch to Cash": "Switch to Cash",
|
||||
"Switch to Credits": "Switch to Credits",
|
||||
"Cookies": "Cookies",
|
||||
"Did someone invite you to use Odysee? Tell us who and you both get a reward!": "Did someone invite you to use Odysee? Tell us who and you both get a reward!",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -5,10 +5,12 @@
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BB8DNPB73F"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
gtag('consent', 'default', {
|
||||
'ad_storage': 'denied',
|
||||
'analytics_storage': 'denied',
|
||||
ad_storage: 'denied',
|
||||
analytics_storage: 'denied',
|
||||
});
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-BB8DNPB73F');
|
||||
@@ -26,7 +28,7 @@
|
||||
<link rel="preload" href="/public/font/v1/700.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/700i.woff" as="font" type="font/woff" crossorigin />
|
||||
|
||||
<link rel="shortcut icon" href="/public/favicon-spaceman.png">
|
||||
<link rel="shortcut icon" href="/public/favicon-spaceman.png" />
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
|
||||
+4
-2
@@ -2,7 +2,7 @@
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import { SDK_API_PATH } from './index';
|
||||
import { SDK_API_PATH } from 'config';
|
||||
|
||||
// --- GA ---
|
||||
// - Events: 500 max (cannot be deleted).
|
||||
@@ -383,6 +383,8 @@ const analytics: Analytics = {
|
||||
return 'loaded_markdown';
|
||||
case RENDER_MODES.IMAGE:
|
||||
return 'loaded_image';
|
||||
case 'livestream':
|
||||
return 'loaded_livestream';
|
||||
default:
|
||||
return 'loaded_misc';
|
||||
}
|
||||
@@ -480,7 +482,7 @@ function sendPromMetric(name: string, value?: number) {
|
||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url, { method: 'post' }).catch(function(error) {});
|
||||
return fetch(url, { method: 'post' }).catch(function (error) {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { hot } from 'react-hot-loader/root';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUploadCount } from 'lbryinc';
|
||||
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
|
||||
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -9,12 +8,7 @@ import { doFetchChannelListMine, doFetchCollectionListMine, doResolveUris } from
|
||||
import { selectMyChannelUrls } from 'redux/selectors/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import {
|
||||
makeSelectClientSetting,
|
||||
selectLanguage,
|
||||
selectLoadedLanguages,
|
||||
selectThemePath,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectLanguage, selectLoadedLanguages, selectThemePath } from 'redux/selectors/settings';
|
||||
import {
|
||||
selectIsUpgradeAvailable,
|
||||
selectAutoUpdateDownloaded,
|
||||
@@ -22,15 +16,10 @@ import {
|
||||
selectActiveChannelClaim,
|
||||
selectIsReloadRequired,
|
||||
} from 'redux/selectors/app';
|
||||
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
||||
import { selectUploadCount } from 'redux/selectors/publish';
|
||||
import { doSetLanguage } from 'redux/actions/settings';
|
||||
import { doSyncLoop } from 'redux/actions/sync';
|
||||
import {
|
||||
doDownloadUpgradeRequested,
|
||||
doSignIn,
|
||||
doGetAndPopulatePreferences,
|
||||
doSetActiveChannel,
|
||||
doSetIncognito,
|
||||
} from 'redux/actions/app';
|
||||
import { doDownloadUpgradeRequested, doSignIn, doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
|
||||
import App from './view';
|
||||
|
||||
@@ -39,7 +28,7 @@ const select = (state) => ({
|
||||
accessToken: selectAccessToken(state),
|
||||
theme: selectThemePath(state),
|
||||
language: selectLanguage(state),
|
||||
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
|
||||
syncEnabled: selectClientSetting(state, SETTINGS.ENABLE_SYNC),
|
||||
languages: selectLoadedLanguages(state),
|
||||
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
||||
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
||||
@@ -62,8 +51,6 @@ const perform = (dispatch) => ({
|
||||
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
||||
signIn: () => dispatch(doSignIn()),
|
||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
|
||||
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
|
||||
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
|
||||
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
|
||||
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
||||
|
||||
+126
-109
@@ -4,6 +4,7 @@ import React, { useEffect, useRef, useState, useLayoutEffect } from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import analytics from 'analytics';
|
||||
import { setSearchUserId } from 'redux/actions/search';
|
||||
import { buildURI, parseURI } from 'util/lbryURI';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import Router from 'component/router/index';
|
||||
@@ -20,12 +21,6 @@ import REWARDS from 'rewards';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import Spinner from 'component/spinner';
|
||||
import LANGUAGES from 'constants/languages';
|
||||
|
||||
// @if TARGET='app'
|
||||
import useZoom from 'effects/use-zoom';
|
||||
import useHistoryNav from 'effects/use-history-nav';
|
||||
// @endif
|
||||
// @if TARGET='web'
|
||||
import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
|
||||
import {
|
||||
useDegradedPerformance,
|
||||
@@ -34,22 +29,17 @@ import {
|
||||
STATUS_FAILING,
|
||||
STATUS_DOWN,
|
||||
} from 'web/effects/use-degraded-performance';
|
||||
// @endif
|
||||
import LANGUAGE_MIGRATIONS from 'constants/language-migrations';
|
||||
|
||||
const FileDrop = lazyImport(() => import('component/fileDrop' /* webpackChunkName: "fileDrop" */));
|
||||
const NagContinueFirstRun = lazyImport(() => import('component/nagContinueFirstRun' /* webpackChunkName: "nagCFR" */));
|
||||
const OpenInAppLink = lazyImport(() => import('web/component/openInAppLink' /* webpackChunkName: "openInAppLink" */));
|
||||
|
||||
// @if TARGET='web'
|
||||
const NagDataCollection = lazyImport(() => import('web/component/nag-data-collection' /* webpackChunkName: "nagDC" */));
|
||||
const NagDegradedPerformance = lazyImport(() =>
|
||||
import('web/component/nag-degraded-performance' /* webpackChunkName: "NagDegradedPerformance" */)
|
||||
);
|
||||
const NagNoUser = lazyImport(() => import('web/component/nag-no-user' /* webpackChunkName: "nag-no-user" */));
|
||||
const NagSunset = lazyImport(() => import('web/component/nag-sunset' /* webpackChunkName: "nag-sunset" */));
|
||||
// @endif
|
||||
|
||||
const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* webpackChunkName: "syncFatalError" */));
|
||||
|
||||
// ****************************************************************************
|
||||
@@ -57,11 +47,8 @@ const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* web
|
||||
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
|
||||
export const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||
|
||||
// button numbers pulled from https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
||||
const MOUSE_BACK_BTN = 3;
|
||||
const MOUSE_FORWARD_BTN = 4;
|
||||
|
||||
const imaLibraryPath = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
|
||||
const securePrivacyScriptUrl = 'https://app.secureprivacy.ai/script/6194129b66262906dd4a5f43.js';
|
||||
|
||||
type Props = {
|
||||
language: string,
|
||||
@@ -69,13 +56,7 @@ type Props = {
|
||||
theme: string,
|
||||
user: ?{ id: string, has_verified_email: boolean, is_reward_approved: boolean },
|
||||
location: { pathname: string, hash: string, search: string },
|
||||
history: {
|
||||
goBack: () => void,
|
||||
goForward: () => void,
|
||||
index: number,
|
||||
length: number,
|
||||
push: (string) => void,
|
||||
},
|
||||
history: { push: (string) => void },
|
||||
fetchAccessToken: () => void,
|
||||
fetchChannelListMine: () => void,
|
||||
fetchCollectionListMine: () => void,
|
||||
@@ -86,8 +67,6 @@ type Props = {
|
||||
isUpgradeAvailable: boolean,
|
||||
isReloadRequired: boolean,
|
||||
autoUpdateDownloaded: boolean,
|
||||
updatePreferences: () => Promise<any>,
|
||||
getWalletSyncPref: () => Promise<any>,
|
||||
uploadCount: number,
|
||||
balance: ?number,
|
||||
syncError: ?string,
|
||||
@@ -127,8 +106,6 @@ function App(props: Props) {
|
||||
language,
|
||||
languages,
|
||||
setLanguage,
|
||||
updatePreferences,
|
||||
getWalletSyncPref,
|
||||
rewards,
|
||||
setReferrer,
|
||||
isAuthenticated,
|
||||
@@ -148,19 +125,18 @@ function App(props: Props) {
|
||||
const appRef = useRef();
|
||||
const isEnhancedLayout = useKonamiListener();
|
||||
const [hasSignedIn, setHasSignedIn] = useState(false);
|
||||
const [readyForSync, setReadyForSync] = useState(false);
|
||||
const [readyForPrefs, setReadyForPrefs] = useState(false);
|
||||
const hasVerifiedEmail = user && Boolean(user.has_verified_email);
|
||||
const isRewardApproved = user && user.is_reward_approved;
|
||||
const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail);
|
||||
const previousRewardApproved = usePrevious(isRewardApproved);
|
||||
// @if TARGET='web'
|
||||
|
||||
const [showAnalyticsNag, setShowAnalyticsNag] = usePersistedState('analytics-nag', true);
|
||||
const [lbryTvApiStatus, setLbryTvApiStatus] = useState(STATUS_OK);
|
||||
// @endif
|
||||
|
||||
const { pathname, hash, search } = props.location;
|
||||
const [upgradeNagClosed, setUpgradeNagClosed] = useState(false);
|
||||
const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false);
|
||||
const [retryingSync, setRetryingSync] = useState(false);
|
||||
const [sidebarOpen] = usePersistedState('sidebar', true);
|
||||
const [seenSunsestMessage, setSeenSunsetMessage] = usePersistedState('lbrytv-sunset', false);
|
||||
const showUpgradeButton =
|
||||
@@ -180,6 +156,7 @@ function App(props: Props) {
|
||||
const hasActiveChannelClaim = activeChannelClaim !== undefined;
|
||||
const isPersonalized = !IS_WEB || hasVerifiedEmail;
|
||||
const renderFiledrop = !IS_WEB || isAuthenticated;
|
||||
const isOnline = navigator.onLine;
|
||||
|
||||
let uri;
|
||||
try {
|
||||
@@ -187,15 +164,58 @@ function App(props: Props) {
|
||||
uri = newpath + hash;
|
||||
} catch (e) {}
|
||||
|
||||
// @if TARGET='web'
|
||||
function handleAnalyticsDismiss() {
|
||||
setShowAnalyticsNag(false);
|
||||
}
|
||||
|
||||
// @endif
|
||||
function getStatusNag() {
|
||||
// Handle "offline" first. Everything else is meaningless if it's offline.
|
||||
if (!isOnline) {
|
||||
return <Nag type="helpful" message={__('You are offline. Check your internet connection.')} />;
|
||||
}
|
||||
|
||||
// Only 1 nag is possible, so show the most important:
|
||||
|
||||
if (user === null) {
|
||||
return <NagNoUser />;
|
||||
}
|
||||
|
||||
if (lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) {
|
||||
if (!shouldHideNag) {
|
||||
return <NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />;
|
||||
}
|
||||
}
|
||||
|
||||
if (syncFatalError) {
|
||||
if (!retryingSync) {
|
||||
return (
|
||||
<Nag
|
||||
type="error"
|
||||
message={__('Failed to synchronize settings. Wait a while before retrying.')}
|
||||
actionText={__('Retry')}
|
||||
onClick={() => {
|
||||
syncLoop(true);
|
||||
setRetryingSync(true);
|
||||
setTimeout(() => setRetryingSync(false), 4000);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else if (isReloadRequired) {
|
||||
return (
|
||||
<Nag
|
||||
message={__('A new version of Odysee is available.')}
|
||||
actionText={__('Refresh')}
|
||||
onClick={() => window.location.reload()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
analytics.setUser(userId);
|
||||
setSearchUserId(userId);
|
||||
}
|
||||
}, [userId]);
|
||||
|
||||
@@ -209,22 +229,6 @@ function App(props: Props) {
|
||||
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||
}, [uploadCount]);
|
||||
|
||||
// allows user to navigate history using the forward and backward buttons on a mouse
|
||||
useEffect(() => {
|
||||
const handleForwardAndBackButtons = (e) => {
|
||||
switch (e.button) {
|
||||
case MOUSE_BACK_BTN:
|
||||
history.index > 0 && history.goBack();
|
||||
break;
|
||||
case MOUSE_FORWARD_BTN:
|
||||
history.index < history.length - 1 && history.goForward();
|
||||
break;
|
||||
}
|
||||
};
|
||||
window.addEventListener('mouseup', handleForwardAndBackButtons);
|
||||
return () => window.removeEventListener('mouseup', handleForwardAndBackButtons);
|
||||
});
|
||||
|
||||
// allows user to pause miniplayer using the spacebar without the page scrolling down
|
||||
useEffect(() => {
|
||||
const handleKeyPress = (e) => {
|
||||
@@ -236,16 +240,6 @@ function App(props: Props) {
|
||||
return () => window.removeEventListener('keydown', handleKeyPress);
|
||||
}, []);
|
||||
|
||||
// Enable ctrl +/- zooming on Desktop.
|
||||
// @if TARGET='app'
|
||||
useZoom();
|
||||
// @endif
|
||||
|
||||
// Enable 'Alt + Left/Right' for history navigation on Desktop.
|
||||
// @if TARGET='app'
|
||||
useHistoryNav(history);
|
||||
// @endif
|
||||
|
||||
useEffect(() => {
|
||||
if (referredRewardAvailable && sanitizedReferrerParam && isRewardApproved) {
|
||||
setReferrer(sanitizedReferrerParam, true);
|
||||
@@ -324,7 +318,6 @@ function App(props: Props) {
|
||||
}, [previousRewardApproved, isRewardApproved]);
|
||||
|
||||
// Load IMA3 SDK for aniview
|
||||
// @if TARGET='web'
|
||||
useEffect(() => {
|
||||
const script = document.createElement('script');
|
||||
script.src = imaLibraryPath;
|
||||
@@ -336,46 +329,91 @@ function App(props: Props) {
|
||||
document.body.removeChild(script);
|
||||
};
|
||||
}, []);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
// add secure privacy script
|
||||
useEffect(() => {
|
||||
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
||||
getWalletSyncPref()
|
||||
.then(() => updatePreferences())
|
||||
.then(() => {
|
||||
setReadyForSync(true);
|
||||
});
|
||||
function inIframe() {
|
||||
try {
|
||||
return window.self !== window.top;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, [updatePreferences, getWalletSyncPref, setReadyForSync, readyForPrefs, hasVerifiedEmail]);
|
||||
// @endif
|
||||
|
||||
if (inIframe()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.src = securePrivacyScriptUrl;
|
||||
script.async = true;
|
||||
// might use this for future checking to prevent doubleloading
|
||||
script.id = 'securePrivacy';
|
||||
|
||||
const cmpScript = document.createElement('script');
|
||||
cmpScript.src = 'https://app.secureprivacy.ai/secureprivacy-plugin/web-plugin/cmp/cmp-v2.js';
|
||||
cmpScript.async = true;
|
||||
|
||||
const getLocaleEndpoint = 'https://api.odysee.com/locale/get';
|
||||
let gdprRequired;
|
||||
try {
|
||||
gdprRequired = localStorage.getItem('gdprRequired');
|
||||
} catch (err) {
|
||||
if (err) return;
|
||||
}
|
||||
// gdpr is known to be required, add script
|
||||
if (gdprRequired === 'true') {
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(script);
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(cmpScript);
|
||||
}
|
||||
|
||||
// haven't done a gdpr check, do it now
|
||||
if (gdprRequired === null) {
|
||||
(async function () {
|
||||
const response = await fetch(getLocaleEndpoint);
|
||||
const json = await response.json();
|
||||
const gdprRequiredBasedOnLocation = json.data.gdpr_required;
|
||||
// note we need gdpr and load script
|
||||
if (gdprRequiredBasedOnLocation) {
|
||||
localStorage.setItem('gdprRequired', 'true');
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(script);
|
||||
// $FlowFixMe
|
||||
document.head.appendChild(cmpScript);
|
||||
// note we don't need gdpr, save to session
|
||||
} else if (gdprRequiredBasedOnLocation === false) {
|
||||
localStorage.setItem('gdprRequired', 'false');
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
return () => {
|
||||
try {
|
||||
// $FlowFixMe
|
||||
document.head.removeChild(script);
|
||||
// $FlowFixMe
|
||||
document.head.removeChild(cmpScript);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
// ready for sync syncs, however after signin when hasVerifiedEmail, that syncs too.
|
||||
useEffect(() => {
|
||||
// signInSyncPref is cleared after sharedState loop.
|
||||
const syncLoopWithoutInterval = () => syncLoop(true);
|
||||
if (readyForSync && hasVerifiedEmail) {
|
||||
if (hasSignedIn && hasVerifiedEmail) {
|
||||
// In case we are syncing.
|
||||
syncLoop();
|
||||
// @if TARGET='web'
|
||||
window.addEventListener('focus', syncLoopWithoutInterval);
|
||||
// @endif
|
||||
}
|
||||
// @if TARGET='web'
|
||||
return () => {
|
||||
window.removeEventListener('focus', syncLoopWithoutInterval);
|
||||
};
|
||||
// @endif
|
||||
}, [readyForSync, hasVerifiedEmail, syncLoop]);
|
||||
|
||||
// We know someone is logging in or not when we get their user object
|
||||
// We'll use this to determine when it's time to pull preferences
|
||||
// This will no longer work if desktop users no longer get a user object from lbryinc
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
setReadyForPrefs(true);
|
||||
}
|
||||
}, [user, setReadyForPrefs]);
|
||||
}, [hasSignedIn, hasVerifiedEmail, syncLoop]);
|
||||
|
||||
useEffect(() => {
|
||||
if (syncError && isAuthenticated && !pathname.includes(PAGES.AUTH_WALLET_PASSWORD) && !currentModal) {
|
||||
@@ -389,7 +427,6 @@ function App(props: Props) {
|
||||
if (!hasSignedIn && hasVerifiedEmail) {
|
||||
signIn();
|
||||
setHasSignedIn(true);
|
||||
if (IS_WEB) setReadyForSync(true);
|
||||
}
|
||||
}, [hasVerifiedEmail, signIn, hasSignedIn]);
|
||||
|
||||
@@ -403,11 +440,8 @@ function App(props: Props) {
|
||||
}
|
||||
}, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]);
|
||||
|
||||
// @if TARGET='web'
|
||||
useDegradedPerformance(setLbryTvApiStatus, user);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='web'
|
||||
// Require an internal-api user on lbry.tv
|
||||
// This also prevents the site from loading in the un-authed state while we wait for internal-apis to return for the first time
|
||||
// It's not needed on desktop since there is no un-authed state
|
||||
@@ -418,16 +452,12 @@ function App(props: Props) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// @endif
|
||||
|
||||
if (syncFatalError) {
|
||||
if (isOnline && lbryTvApiStatus === STATUS_DOWN) {
|
||||
// TODO: Rename `SyncFatalError` since it has nothing to do with syncing.
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<SyncFatalError
|
||||
// @if TARGET='web'
|
||||
lbryTvApiStatus={lbryTvApiStatus}
|
||||
// @endif
|
||||
/>
|
||||
<SyncFatalError lbryTvApiStatus={lbryTvApiStatus} />
|
||||
</React.Suspense>
|
||||
);
|
||||
}
|
||||
@@ -469,30 +499,17 @@ function App(props: Props) {
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{/* @if TARGET='web' */}
|
||||
<YoutubeWelcome />
|
||||
{!SIMPLE_SITE && !shouldHideNag && <OpenInAppLink uri={uri} />}
|
||||
{!shouldHideNag && <NagContinueFirstRun />}
|
||||
{fromLbrytvParam && !seenSunsestMessage && !shouldHideNag && (
|
||||
<NagSunset email={hasVerifiedEmail} onClose={() => setSeenSunsetMessage(true)} />
|
||||
)}
|
||||
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && !shouldHideNag && (
|
||||
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
|
||||
)}
|
||||
{!SIMPLE_SITE && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
|
||||
<NagDataCollection onClose={handleAnalyticsDismiss} />
|
||||
)}
|
||||
{user === null && <NagNoUser />}
|
||||
{/* @endif */}
|
||||
{getStatusNag()}
|
||||
</React.Suspense>
|
||||
|
||||
{isReloadRequired && (
|
||||
<Nag
|
||||
message={__('A new version of Odysee is available.')}
|
||||
actionText={__('Refresh')}
|
||||
onClick={() => window.location.reload()}
|
||||
/>
|
||||
)}
|
||||
</React.Fragment>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import {
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlock,
|
||||
@@ -43,7 +43,7 @@ const select = (state, props) => {
|
||||
isBlocked,
|
||||
isToggling,
|
||||
isBlockingOrUnBlocking: makeSelectUriIsBlockingOrUnBlocking(props.uri)(state),
|
||||
creatorId: makeSelectClaimIdForUri(props.creatorUri)(state),
|
||||
creatorId: selectClaimIdForUri(state, props.creatorUri),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ type Props = {
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
isToggling: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, ?Number, boolean) => void,
|
||||
doCommentModBlock: (string, ?string, ?Number, boolean) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, ?string, ?string) => void,
|
||||
doCommentModUnBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, ?string, string, ?string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
@@ -41,7 +41,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
} else {
|
||||
doCommentModBlock(uri, undefined, false);
|
||||
doCommentModBlock(uri, undefined, undefined, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -50,7 +50,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsModerator(uri, creatorUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsModerator(uri, creatorUri, '');
|
||||
doCommentModBlockAsModerator(uri, undefined, creatorUri, undefined);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -59,7 +59,7 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsAdmin(uri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(uri, '');
|
||||
doCommentModBlockAsAdmin(uri, undefined, undefined);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ import { PAGE_SIZE } from 'constants/claim';
|
||||
import {
|
||||
makeSelectClaimsInChannelForPage,
|
||||
makeSelectFetchingChannelClaims,
|
||||
makeSelectClaimIsMine,
|
||||
selectClaimIsMine,
|
||||
makeSelectTotalPagesInChannelSearch,
|
||||
makeSelectClaimForUri,
|
||||
selectClaimForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { withRouter } from 'react-router';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
|
||||
import ChannelContent from './view';
|
||||
|
||||
@@ -20,16 +20,18 @@ const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const page = urlParams.get('page') || 0;
|
||||
const claim = props.uri && selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
pageOfClaimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state),
|
||||
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
|
||||
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
|
||||
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
channelIsMine: selectClaimIsMine(state, claim),
|
||||
channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state),
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
claim,
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
|
||||
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import CommentsList from 'component/commentsList';
|
||||
import Empty from 'component/common/empty';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
|
||||
const CommentsList = lazyImport(() => import('component/commentsList' /* webpackChunkName: "comments" */));
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -17,7 +19,9 @@ function ChannelDiscussion(props: Props) {
|
||||
}
|
||||
return (
|
||||
<section className="section">
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
||||
<React.Suspense fallback={null}>
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
||||
</React.Suspense>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
selectTitleForUri,
|
||||
selectThumbnailForUri,
|
||||
makeSelectCoverForUri,
|
||||
makeSelectMetadataItemForUri,
|
||||
makeSelectAmountForUri,
|
||||
@@ -21,8 +21,8 @@ import ChannelForm from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
||||
coverUrl: makeSelectCoverForUri(props.uri)(state),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
|
||||
|
||||
@@ -294,7 +294,7 @@ function ChannelForm(props: Props) {
|
||||
{params.coverUrl &&
|
||||
(coverError && isUpload.cover ? (
|
||||
<div className="channel-cover__custom--waiting">
|
||||
<p>{__('Uploaded image will be visible in a few minutes.')}</p>
|
||||
<p>{__('Uploaded image will be visible in a few minutes after you submit this form.')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<img className="channel-cover__custom" src={coverSrc} onError={() => setCoverError(true)} />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { selectClaimForUri, selectIsUriResolving } from 'redux/selectors/claims';
|
||||
import ChannelMentionSuggestion from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
claim: selectClaimForUri(state, props.uri),
|
||||
isResolvingUri: selectIsUriResolving(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(ChannelMentionSuggestion);
|
||||
@@ -1,35 +1,25 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { MAX_LIVESTREAM_COMMENTS } from 'constants/livestream';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { selectSubscriptionUris } from 'redux/selectors/subscriptions';
|
||||
import { withRouter } from 'react-router';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectCanonicalUrlForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { selectTopLevelCommentsForUri } from 'redux/selectors/comments';
|
||||
import { selectChannelMentionData } from 'redux/selectors/livestream';
|
||||
import ChannelMentionSuggestions from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const subscriptionUris = selectSubscriptions(state).map(({ uri }) => uri);
|
||||
const topLevelComments = selectTopLevelCommentsForUri(state, props.uri);
|
||||
|
||||
const commentorUris = [];
|
||||
// Avoid repeated commentors
|
||||
topLevelComments.map(({ channel_url }) => !commentorUris.includes(channel_url) && commentorUris.push(channel_url));
|
||||
|
||||
const getUnresolved = (uris) =>
|
||||
uris.map((uri) => !makeSelectClaimForUri(uri)(state) && uri).filter((uri) => uri !== false);
|
||||
const getCanonical = (uris) =>
|
||||
uris
|
||||
.map((uri) => makeSelectClaimForUri(uri)(state) && makeSelectClaimForUri(uri)(state).canonical_url)
|
||||
.filter((uri) => Boolean(uri));
|
||||
const maxComments = props.isLivestream ? MAX_LIVESTREAM_COMMENTS : -1;
|
||||
const data = selectChannelMentionData(state, props.uri, maxComments);
|
||||
|
||||
return {
|
||||
commentorUris,
|
||||
subscriptionUris,
|
||||
unresolvedCommentors: getUnresolved(commentorUris),
|
||||
unresolvedSubscriptions: getUnresolved(subscriptionUris),
|
||||
canonicalCreator: getCanonical([props.creatorUri])[0],
|
||||
canonicalCommentors: getCanonical(commentorUris),
|
||||
canonicalSubscriptions: getCanonical(subscriptionUris),
|
||||
commentorUris: data.commentorUris,
|
||||
subscriptionUris: selectSubscriptionUris(state),
|
||||
unresolvedCommentors: data.unresolvedCommentors,
|
||||
unresolvedSubscriptions: data.unresolvedSubscriptions,
|
||||
canonicalCreator: selectCanonicalUrlForUri(state, props.creatorUri),
|
||||
canonicalCommentors: data.canonicalCommentors,
|
||||
canonicalSubscriptions: data.canonicalSubscriptions,
|
||||
showMature: selectShowMatureContent(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { selectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectWinningUriForQuery } from 'redux/selectors/search';
|
||||
import ChannelMentionTopSuggestion from './view';
|
||||
@@ -8,7 +8,7 @@ const select = (state, props) => {
|
||||
const uriFromQuery = `lbry://${props.query}`;
|
||||
return {
|
||||
uriFromQuery,
|
||||
isResolvingUri: makeSelectIsUriResolving(uriFromQuery)(state),
|
||||
isResolvingUri: selectIsUriResolving(state, uriFromQuery),
|
||||
winningUri: makeSelectWinningUriForQuery(props.query)(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectStakedLevelForChannelUri,
|
||||
makeSelectTotalStakedAmountForChannelUri,
|
||||
selectClaimForUri,
|
||||
selectStakedLevelForChannelUri,
|
||||
selectTotalStakedAmountForChannelUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import ChannelStakedIndicator from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
channelClaim: makeSelectClaimForUri(props.uri)(state),
|
||||
amount: makeSelectTotalStakedAmountForChannelUri(props.uri)(state),
|
||||
level: makeSelectStakedLevelForChannelUri(props.uri)(state),
|
||||
channelClaim: selectClaimForUri(state, props.uri),
|
||||
amount: selectTotalStakedAmountForChannelUri(state, props.uri),
|
||||
level: selectStakedLevelForChannelUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(ChannelStakedIndicator);
|
||||
@@ -1,12 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectThumbnailForUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { selectThumbnailForUri, selectClaimForUri, selectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import ChannelThumbnail from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolving: makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: selectThumbnailForUri(state, props.uri),
|
||||
claim: selectClaimForUri(state, props.uri),
|
||||
isResolving: selectIsUriResolving(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
|
||||
@@ -92,7 +92,9 @@ function ChannelThumbnail(props: Props) {
|
||||
})}
|
||||
>
|
||||
{showDelayedMessage ? (
|
||||
<div className="channel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
<div className="channel-thumbnail--waiting">
|
||||
{__('This will be visible in a few minutes after you submit this form.')}
|
||||
</div>
|
||||
) : (
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||
import ChannelTitle from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import { selectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import { makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import ClaimInsufficientCredits from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, selectIsUriResolving } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { punctuationMarks } from 'util/remark-lbry';
|
||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import ClaimLink from './view';
|
||||
|
||||
@@ -25,8 +24,7 @@ const select = (state, props) => {
|
||||
uri,
|
||||
claim,
|
||||
fullUri: props.uri,
|
||||
isResolvingUri: makeSelectIsUriResolving(uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
isResolvingUri: selectIsUriResolving(state, uri),
|
||||
playingUri: selectPlayingUri(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,10 +15,6 @@ type Props = {
|
||||
description: ?string,
|
||||
isResolvingUri: boolean,
|
||||
doResolveUri: (string) => void,
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
playingUri: ?PlayingUri,
|
||||
parentCommentId?: string,
|
||||
isMarkdownPost?: boolean,
|
||||
@@ -43,21 +39,6 @@ class ClaimLink extends React.Component<Props> {
|
||||
this.resolve(this.props);
|
||||
}
|
||||
|
||||
isClaimBlackListed() {
|
||||
const { claim, blackListedOutpoints } = this.props;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
if (claim && blackListedOutpoints) {
|
||||
let blackListed = false;
|
||||
|
||||
blackListed = blackListedOutpoints.some(
|
||||
(outpoint) =>
|
||||
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
||||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
||||
);
|
||||
return blackListed;
|
||||
}
|
||||
}
|
||||
|
||||
resolve = (props: Props) => {
|
||||
const { isResolvingUri, doResolveUri, claim, uri } = props;
|
||||
|
||||
@@ -79,14 +60,13 @@ class ClaimLink extends React.Component<Props> {
|
||||
allowPreview,
|
||||
} = this.props;
|
||||
const isUnresolved = (!isResolvingUri && !claim) || !claim;
|
||||
const isBlacklisted = this.isClaimBlackListed();
|
||||
const isPlayingInline =
|
||||
playingUri &&
|
||||
playingUri.uri === uri &&
|
||||
((playingUri.source === 'comment' && parentCommentId === playingUri.commentId) ||
|
||||
playingUri.source === 'markdown');
|
||||
|
||||
if (isBlacklisted || isUnresolved) {
|
||||
if (isUnresolved) {
|
||||
return <span>{children}</span>;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ import { connect } from 'react-redux';
|
||||
import ClaimList from './view';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
|
||||
const select = (state) => ({
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||
});
|
||||
|
||||
export default connect(select)(ClaimList);
|
||||
@@ -10,23 +10,23 @@ import * as SETTINGS from 'constants/settings';
|
||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import ClaimListDiscover from './view';
|
||||
import { doFetchViewCount } from 'lbryinc';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = (state, props) => ({
|
||||
followedTags: selectFollowedTags(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
claimSearchByQueryLastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
loading: props.loading !== undefined ? props.loading : selectFetchingClaimSearch(state),
|
||||
showNsfw: selectShowMatureContent(state),
|
||||
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
|
||||
hideReposts: selectClientSetting(state, SETTINGS.HIDE_REPOSTS),
|
||||
languageSetting: selectLanguage(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||
});
|
||||
|
||||
const perform = {
|
||||
|
||||
@@ -21,6 +21,7 @@ import { useIsLargeScreen } from 'effects/use-screensize';
|
||||
type Props = {
|
||||
uris: Array<string>,
|
||||
prefixUris?: Array<string>,
|
||||
pins?: { urls: Array<string>, onlyPinForOrder?: string },
|
||||
name?: string,
|
||||
type: string,
|
||||
pageSize?: number,
|
||||
@@ -139,6 +140,7 @@ function ClaimListDiscover(props: Props) {
|
||||
feeAmount,
|
||||
uris,
|
||||
prefixUris,
|
||||
pins,
|
||||
tileLayout,
|
||||
hideFilters = false,
|
||||
claimIds,
|
||||
@@ -248,6 +250,7 @@ function ClaimListDiscover(props: Props) {
|
||||
has_source?: boolean,
|
||||
has_no_source?: boolean,
|
||||
limit_claims_per_channel?: number,
|
||||
remove_duplicates?: boolean,
|
||||
} = {
|
||||
page_size: dynamicPageSize,
|
||||
page,
|
||||
@@ -259,6 +262,7 @@ function ClaimListDiscover(props: Props) {
|
||||
not_channel_ids: isChannel ? undefined : mutedAndBlockedChannelIds,
|
||||
not_tags: !showNsfw ? MATURE_TAGS : [],
|
||||
order_by: resolveOrderByOption(orderParam, sortByParam),
|
||||
remove_duplicates: isChannel ? undefined : true,
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
@@ -464,6 +468,7 @@ function ClaimListDiscover(props: Props) {
|
||||
);
|
||||
|
||||
const renderUris = uris || claimSearchResult;
|
||||
injectPinUrls(renderUris, orderParam, pins);
|
||||
|
||||
// **************************************************************************
|
||||
// Helpers
|
||||
@@ -525,6 +530,25 @@ function ClaimListDiscover(props: Props) {
|
||||
return order_by;
|
||||
}
|
||||
|
||||
function injectPinUrls(uris, order, pins) {
|
||||
if (!pins || !pins.urls || (pins.onlyPinForOrder && pins.onlyPinForOrder !== order)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pinUrls = pins.urls;
|
||||
if (pinUrls && uris && uris.length > 2) {
|
||||
pinUrls.forEach((pin) => {
|
||||
if (uris.includes(pin)) {
|
||||
uris.splice(uris.indexOf(pin), 1);
|
||||
} else {
|
||||
uris.pop();
|
||||
}
|
||||
});
|
||||
|
||||
uris.splice(2, 0, ...pinUrls);
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||
import { selectFetchingClaimSearch } from 'redux/selectors/claims';
|
||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import ClaimListHeader from './view';
|
||||
@@ -11,7 +11,7 @@ const select = (state) => ({
|
||||
followedTags: selectFollowedTags(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
showNsfw: selectShowMatureContent(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||
languageSetting: selectLanguage(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { selectClaimForUri, selectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { doCollectionEdit, doFetchItemsInCollection } from 'redux/actions/collections';
|
||||
import { doPrepareEdit } from 'redux/actions/publish';
|
||||
import {
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from 'redux/selectors/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/content';
|
||||
@@ -34,7 +34,7 @@ import ClaimPreview from './view';
|
||||
import fs from 'fs';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri, false)(state);
|
||||
const claim = selectClaimForUri(state, props.uri, false); // @KP test no repost!
|
||||
const collectionId = props.collectionId;
|
||||
const repostedClaim = claim && claim.reposted_claim;
|
||||
const contentClaim = repostedClaim || claim;
|
||||
@@ -51,7 +51,7 @@ const select = (state, props) => {
|
||||
contentClaim,
|
||||
contentSigningChannel,
|
||||
contentChannelUri,
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(
|
||||
COLLECTIONS_CONSTS.WATCH_LATER_ID,
|
||||
contentPermanentUri
|
||||
@@ -63,7 +63,7 @@ const select = (state, props) => {
|
||||
channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(contentChannelUri, true)(state),
|
||||
isSubscribed: selectIsSubscribedForUri(state, contentChannelUri),
|
||||
channelIsAdminBlocked: makeSelectChannelIsAdminBlocked(props.uri)(state),
|
||||
isAdmin: selectHasAdminChannel(state),
|
||||
claimInCollection: makeSelectCollectionForIdHasClaimUrl(collectionId, contentPermanentUri)(state),
|
||||
@@ -92,7 +92,7 @@ const perform = (dispatch) => ({
|
||||
doChannelUnmute: (channelUri) => dispatch(doChannelUnmute(channelUri)),
|
||||
doCommentModBlock: (channelUri) => dispatch(doCommentModBlock(channelUri)),
|
||||
doCommentModUnBlock: (channelUri) => dispatch(doCommentModUnBlock(channelUri)),
|
||||
doCommentModBlockAsAdmin: (commenterUri, blockerId) => dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
|
||||
doCommentModBlockAsAdmin: (a, b, c) => dispatch(doCommentModBlockAsAdmin(a, b, c)),
|
||||
doCommentModUnBlockAsAdmin: (commenterUri, blockerId) =>
|
||||
dispatch(doCommentModUnBlockAsAdmin(commenterUri, blockerId)),
|
||||
doChannelSubscribe: (subscription) => dispatch(doChannelSubscribe(subscription)),
|
||||
|
||||
@@ -45,7 +45,7 @@ type Props = {
|
||||
doChannelUnmute: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (commenterUri: string, offendingCommentId: ?string, blockerId: ?string) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
@@ -237,7 +237,7 @@ function ClaimMenuList(props: Props) {
|
||||
if (channelIsAdminBlocked) {
|
||||
doCommentModUnBlockAsAdmin(contentChannelUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(contentChannelUri, '');
|
||||
doCommentModBlockAsAdmin(contentChannelUri, undefined, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectClaimForUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectClaimIsMine,
|
||||
selectIsUriResolving,
|
||||
selectClaimIsMine,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectReflectingClaimForUri,
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectTitleForUri,
|
||||
isStreamPlaceholderClaim,
|
||||
selectTitleForUri,
|
||||
selectDateForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
||||
@@ -22,10 +21,11 @@ import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doCollectionEdit } from 'redux/actions/collections';
|
||||
import { doFileGet } from 'redux/actions/file';
|
||||
import { selectBanStateForUri } from 'lbryinc';
|
||||
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
||||
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
@@ -33,26 +33,27 @@ const select = (state, props) => {
|
||||
const claim = props.uri && selectClaimForUri(state, props.uri);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
const isLivestream = isStreamPlaceholderClaim(claim);
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && selectDateForUri(state, props.uri),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
title: props.uri && selectTitleForUri(state, props.uri),
|
||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||
obscureNsfw: selectShowMatureContent(state) === false,
|
||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
claimIsMine: props.uri && selectClaimIsMine(state, claim),
|
||||
isResolvingUri: props.uri && selectIsUriResolving(state, props.uri),
|
||||
isResolvingRepost: props.uri && selectIsUriResolving(state, props.repostUrl),
|
||||
nsfw: claim ? isClaimNsfw(claim) : false,
|
||||
banState: selectBanStateForUri(state, props.uri),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
isSubscribed: props.uri && selectIsSubscribedForUri(state, props.uri),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
|
||||
isLivestream,
|
||||
isLivestreamActive: isLivestream && selectIsActiveLivestreamForUri(state, props.uri),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
|
||||
@@ -7,6 +7,7 @@ import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import { isURIValid } from 'util/lbryURI';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { isChannelClaim } from 'util/claim';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
@@ -135,7 +136,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
renderActions,
|
||||
hideMenu = false,
|
||||
// repostUrl,
|
||||
isLivestream, // need both? CHECK
|
||||
isLivestream,
|
||||
isLivestreamActive,
|
||||
collectionId,
|
||||
collectionIndex,
|
||||
@@ -146,6 +147,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
indexInContainer,
|
||||
channelSubCount,
|
||||
} = props;
|
||||
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
const listId = collectionId || collectionClaimId;
|
||||
@@ -179,7 +181,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
claim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const isChannelUri = claim ? claim.value_type === 'channel' : false;
|
||||
const isChannelUri = isChannelClaim(claim, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const repostedChannelUri =
|
||||
claim && claim.repost_channel_url && claim.value_type === 'channel'
|
||||
@@ -482,11 +484,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{claimIsMine && isLivestream && (
|
||||
<div className={'claim-preview__hints'}>
|
||||
<ClaimPreviewReset />
|
||||
</div>
|
||||
)}
|
||||
{/* Todo: check isLivestreamActive once we have that data consistently everywhere. */}
|
||||
{claim && isLivestream && <ClaimPreviewReset uri={uri} />}
|
||||
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={listId} />}
|
||||
</>
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectClaimIsMineForUri } from 'redux/selectors/claims';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import ClaimPreviewReset from './view';
|
||||
|
||||
const select = (state) => {
|
||||
const select = (state, props) => {
|
||||
const { claim_id: channelId, name: channelName } = selectActiveChannelClaim(state) || {};
|
||||
return {
|
||||
channelName,
|
||||
channelId,
|
||||
claimIsMine: props.uri && selectClaimIsMineForUri(state, props.uri),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,65 +1,34 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import Lbry from 'lbry';
|
||||
import { LIVESTREAM_KILL } from 'constants/livestream';
|
||||
import { SITE_HELP_EMAIL } from 'config';
|
||||
import { toHex } from 'util/hex';
|
||||
import Button from 'component/button';
|
||||
import { killStream } from '$web/src/livestreaming';
|
||||
import watchLivestreamStatus from '$web/src/livestreaming/long-polling';
|
||||
import 'scss/component/claim-preview-reset.scss';
|
||||
|
||||
// @Todo: move out of component.
|
||||
const getStreamData = async (channelId: string, channelName: string) => {
|
||||
if (!channelId || !channelName) throw new Error('Invalid channel data provided.');
|
||||
|
||||
const channelNameHex = toHex(channelName);
|
||||
let channelSignature;
|
||||
|
||||
try {
|
||||
channelSignature = await Lbry.channel_sign({ channel_id: channelId, hexdata: channelNameHex });
|
||||
if (!channelSignature || !channelSignature.signature || !channelSignature.signing_ts) {
|
||||
throw new Error('Error getting channel signature.');
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return {
|
||||
d: channelNameHex,
|
||||
s: channelSignature.signature,
|
||||
t: channelSignature.signing_ts,
|
||||
};
|
||||
};
|
||||
|
||||
// @Todo: move out of component.
|
||||
const killStream = async (channelId: string, payload: any) => {
|
||||
fetch(`${LIVESTREAM_KILL}/${channelId}`, {
|
||||
method: 'POST',
|
||||
mode: 'no-cors',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: new URLSearchParams(payload),
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res.status === 200) throw new Error('Kill stream API failed.');
|
||||
})
|
||||
.catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
};
|
||||
|
||||
type Props = {
|
||||
channelId: string,
|
||||
channelName: string,
|
||||
claimIsMine: boolean,
|
||||
doToast: ({ message: string, isError?: boolean }) => void,
|
||||
};
|
||||
|
||||
const ClaimPreviewReset = (props: Props) => {
|
||||
const { channelId, channelName, doToast } = props;
|
||||
const { channelId, channelName, claimIsMine, doToast } = props;
|
||||
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!claimIsMine) return;
|
||||
return watchLivestreamStatus(channelId, (state) => setIsLivestreaming(state));
|
||||
}, [channelId, setIsLivestreaming, claimIsMine]);
|
||||
|
||||
if (!claimIsMine || !isLivestreaming) return null;
|
||||
|
||||
const handleClick = async () => {
|
||||
try {
|
||||
const streamData = await getStreamData(channelId, channelName);
|
||||
await killStream(channelId, streamData);
|
||||
await killStream(channelId, channelName);
|
||||
doToast({ message: __('Live stream successfully reset.'), isError: false });
|
||||
} catch {
|
||||
doToast({ message: __('There was an error resetting the live stream.'), isError: true });
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectClaimForUri,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
} from 'redux/selectors/claims';
|
||||
import { selectClaimForUri, makeSelectClaimIsPending, isStreamPlaceholderClaim } from 'redux/selectors/claims';
|
||||
import { doClearPublish, doPrepareEdit } from 'redux/actions/publish';
|
||||
import { push } from 'connected-react-router';
|
||||
import ClaimPreviewSubtitle from './view';
|
||||
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
||||
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
@@ -17,8 +13,8 @@ const select = (state, props) => {
|
||||
return {
|
||||
claim,
|
||||
pending: makeSelectClaimIsPending(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
subCount: isChannel ? makeSelectSubCountForUri(props.uri)(state) : 0,
|
||||
isLivestream: isStreamPlaceholderClaim(claim),
|
||||
subCount: isChannel ? selectSubCountForUri(state, props.uri) : 0,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
selectIsUriResolving,
|
||||
getThumbnailFromClaim,
|
||||
selectTitleForUri,
|
||||
isStreamPlaceholderClaim,
|
||||
selectDateForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { doFileGet } from 'redux/actions/file';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectViewCountForUri, selectBanStateForUri } from 'lbryinc';
|
||||
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
||||
import { selectViewCountForUri, selectBanStateForUri } from 'lbryinc';
|
||||
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
@@ -21,21 +20,21 @@ const select = (state, props) => {
|
||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
const isLivestream = isStreamPlaceholderClaim(claim);
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && selectDateForUri(state, props.uri),
|
||||
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && selectIsUriResolving(state, props.uri),
|
||||
thumbnail: getThumbnailFromClaim(claim),
|
||||
title: props.uri && selectTitleForUri(state, props.uri),
|
||||
banState: selectBanStateForUri(state, props.uri),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
|
||||
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
||||
isMature: claim ? isClaimNsfw(claim) : false,
|
||||
isLivestream,
|
||||
isLivestreamActive: isLivestream && selectIsActiveLivestreamForUri(state, props.uri),
|
||||
viewCount: selectViewCountForUri(state, props.uri),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||
import ClaimPreviewTitle from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(ClaimPreviewTitle);
|
||||
@@ -1,12 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectClaimIsMine, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
||||
import ClaimProperties from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim,
|
||||
isSubscribed: selectIsSubscribedForUri(state, props.uri),
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, null)(ClaimProperties);
|
||||
@@ -6,7 +6,7 @@ import * as SETTINGS from 'constants/settings';
|
||||
import { MATURE_TAGS } from 'constants/tags';
|
||||
import { doFetchViewCount } from 'lbryinc';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectMutedAndBlockedChannelIds } from 'redux/selectors/blocked';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
@@ -15,7 +15,7 @@ import ClaimListDiscover from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const showNsfw = selectShowMatureContent(state);
|
||||
const hideReposts = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state);
|
||||
const hideReposts = selectClientSetting(state, SETTINGS.HIDE_REPOSTS);
|
||||
const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state);
|
||||
|
||||
return {
|
||||
@@ -85,6 +85,7 @@ function resolveSearchOptions(props) {
|
||||
not_channel_ids: mutedAndBlockedChannelIds,
|
||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||
stream_types: streamTypesParam,
|
||||
remove_duplicates: true,
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsStreamPlaceholder } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, selectIsStreamPlaceholderForUri } from 'redux/selectors/claims';
|
||||
import FileType from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestream: selectIsStreamPlaceholderForUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(FileType);
|
||||
@@ -1,10 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectCanonicalUrlForUri } from 'redux/selectors/claims';
|
||||
import { selectCanonicalUrlForUri } from 'redux/selectors/claims';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import ClaimUri from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
shortUrl: makeSelectCanonicalUrlForUri(props.uri)(state),
|
||||
shortUrl: selectCanonicalUrlForUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import CollectionContent from './view';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { selectClaimForUri, selectClaimIsMine } from 'redux/selectors/claims';
|
||||
import {
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
@@ -12,7 +12,7 @@ import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/content';
|
||||
const select = (state, props) => {
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const playingUrl = playingUri && playingUri.uri;
|
||||
const claim = makeSelectClaimForUri(playingUrl)(state);
|
||||
const claim = selectClaimForUri(state, playingUrl);
|
||||
const url = claim && claim.permanent_url;
|
||||
const loopList = selectListLoop(state);
|
||||
const loop = loopList && loopList.collectionId === props.id && loopList.loop;
|
||||
@@ -24,7 +24,7 @@ const select = (state, props) => {
|
||||
collection: makeSelectCollectionForId(props.id)(state),
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.id)(state),
|
||||
collectionName: makeSelectNameForCollectionId(props.id)(state),
|
||||
isMine: makeSelectClaimIsMine(url)(state),
|
||||
isMine: selectClaimIsMine(state, claim),
|
||||
loop,
|
||||
shuffle,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
selectTitleForUri,
|
||||
selectThumbnailForUri,
|
||||
makeSelectMetadataItemForUri,
|
||||
makeSelectAmountForUri,
|
||||
makeSelectClaimForUri,
|
||||
@@ -25,8 +25,8 @@ import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
||||
locations: makeSelectMetadataItemForUri(props.uri, 'locations')(state),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectIsUriResolving, makeSelectClaimIdForUri, makeSelectClaimForClaimId } from 'redux/selectors/claims';
|
||||
import { selectIsUriResolving, selectClaimIdForUri, makeSelectClaimForClaimId } from 'redux/selectors/claims';
|
||||
import {
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
@@ -10,7 +10,7 @@ import { doFetchItemsInCollection } from 'redux/actions/collections';
|
||||
import CollectionPreviewOverlay from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const collectionId = props.collectionId || (props.uri && selectClaimIdForUri(state, props.uri));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
@@ -22,7 +22,7 @@ const select = (state, props) => {
|
||||
collectionItemUrls: makeSelectUrlsForCollectionId(collectionId)(state), // ForId || ForUri
|
||||
pendingCollection: makeSelectPendingCollectionForId(collectionId)(state),
|
||||
claim,
|
||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||
isResolvingUri: collectionUri && selectIsUriResolving(state, collectionUri),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
selectIsUriResolving,
|
||||
getThumbnailFromClaim,
|
||||
selectTitleForUri,
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIdForUri,
|
||||
selectClaimIsNsfwForUri,
|
||||
selectClaimIdForUri,
|
||||
makeSelectClaimForClaimId,
|
||||
} from 'redux/selectors/claims';
|
||||
import {
|
||||
@@ -24,7 +24,7 @@ import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import CollectionPreviewTile from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const collectionId = props.collectionId || (props.uri && selectClaimIdForUri(state, props.uri));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
@@ -39,14 +39,14 @@ const select = (state, props) => {
|
||||
claim,
|
||||
isResolvingCollectionClaims: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
||||
channelClaim: collectionUri && makeSelectChannelForClaimUri(collectionUri)(state),
|
||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||
thumbnail: collectionUri && makeSelectThumbnailForUri(collectionUri)(state),
|
||||
title: collectionUri && makeSelectTitleForUri(collectionUri)(state),
|
||||
isResolvingUri: collectionUri && selectIsUriResolving(state, collectionUri),
|
||||
thumbnail: getThumbnailFromClaim(claim),
|
||||
title: collectionUri && selectTitleForUri(state, collectionUri),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(collectionUri)(state),
|
||||
isMature: selectClaimIsNsfwForUri(state, collectionUri),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const ALL = 'All';
|
||||
const PRIVATE = 'Private';
|
||||
const PUBLIC = 'Public';
|
||||
const COLLECTION_FILTERS = [ALL, PRIVATE, PUBLIC];
|
||||
const COLLECTION_SHOW_COUNT = 24;
|
||||
const COLLECTION_SHOW_COUNT = 12;
|
||||
|
||||
export default function CollectionsListMine(props: Props) {
|
||||
const {
|
||||
@@ -43,6 +43,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
const [filterType, setFilterType] = React.useState(ALL);
|
||||
const [searchText, setSearchText] = React.useState('');
|
||||
|
||||
const playlistPageUrl = `/$/${PAGES.PLAYLISTS}?type=${filterType}`;
|
||||
let collectionsToShow = [];
|
||||
if (filterType === ALL) {
|
||||
collectionsToShow = unpublishedCollectionsList.concat(publishedList);
|
||||
@@ -68,6 +69,10 @@ export default function CollectionsListMine(props: Props) {
|
||||
filteredCollections = collectionsToShow.slice(0, COLLECTION_SHOW_COUNT) || [];
|
||||
}
|
||||
|
||||
const totalLength = collectionsToShow ? collectionsToShow.length : 0;
|
||||
const filteredLength = filteredCollections.length;
|
||||
const isTruncated = totalLength > filteredLength;
|
||||
|
||||
const watchLater = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID);
|
||||
const favorites = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.FAVORITES_ID);
|
||||
const builtin = [watchLater, favorites];
|
||||
@@ -133,7 +138,19 @@ export default function CollectionsListMine(props: Props) {
|
||||
<div className="claim-grid__wrapper">
|
||||
<div className="claim-grid__header section">
|
||||
<h1 className="claim-grid__title">
|
||||
{__('Playlists')}
|
||||
<Button
|
||||
className="claim-grid__title"
|
||||
button="link"
|
||||
navigate={playlistPageUrl}
|
||||
label={
|
||||
<span className="claim-grid__title-span">
|
||||
{__('Playlists')}
|
||||
<div className="claim-grid__title--empty">
|
||||
<Icon className="icon--margin-right" icon={ICONS.STACK} />
|
||||
</div>
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
{!hasCollections && !fetchingCollections && (
|
||||
<div className="claim-grid__title--empty">{__('(Empty) --[indicates empty playlist]--')}</div>
|
||||
)}
|
||||
@@ -142,38 +159,55 @@ export default function CollectionsListMine(props: Props) {
|
||||
)}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="section__header--actions">
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__menu-group">
|
||||
{COLLECTION_FILTERS.map((value) => (
|
||||
<Button
|
||||
label={__(value)}
|
||||
key={value}
|
||||
button="alt"
|
||||
onClick={() => setFilterType(value)}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': filterType === value,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
<div className="section__header-action-stack">
|
||||
<div className="section__header--actions">
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__menu-group">
|
||||
{COLLECTION_FILTERS.map((value) => (
|
||||
<Button
|
||||
label={__(value)}
|
||||
key={value}
|
||||
button="alt"
|
||||
onClick={() => setFilterType(value)}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': filterType === value,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
className="wunderbar__input--inline"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
className="wunderbar__input--inline"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
<p className="collection-grid__results-summary">
|
||||
{isTruncated && (
|
||||
<>
|
||||
{__(`Showing %filtered% results of %total%`, {
|
||||
filtered: filteredLength,
|
||||
total: totalLength,
|
||||
})}
|
||||
{`${searchText ? ' (' + __('filtered') + ') ' : ' '}`}
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
button="link"
|
||||
navigate={playlistPageUrl}
|
||||
label={<span className="claim-grid__title-span">{__('View All Playlists')}</span>}
|
||||
/>
|
||||
</Form>
|
||||
</p>
|
||||
</div>
|
||||
{Boolean(hasCollections) && (
|
||||
<div>
|
||||
{/* TODO: fix above spacing hack */}
|
||||
<div className="claim-grid">
|
||||
{filteredCollections &&
|
||||
filteredCollections.length > 0 &&
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectStakedLevelForChannelUri,
|
||||
selectStakedLevelForChannelUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
selectMyChannelClaims,
|
||||
selectThumbnailForUri,
|
||||
selectHasChannels,
|
||||
} from 'redux/selectors/claims';
|
||||
import { doCommentUpdate, doCommentList } from 'redux/actions/comments';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
@@ -26,14 +26,14 @@ const select = (state, props) => {
|
||||
|
||||
return {
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
thumbnail: props.authorUri && makeSelectThumbnailForUri(props.authorUri)(state),
|
||||
thumbnail: props.authorUri && selectThumbnailForUri(state, props.authorUri),
|
||||
channelIsBlocked: props.authorUri && makeSelectChannelIsMuted(props.authorUri)(state),
|
||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
othersReacts: selectOthersReactsForComment(state, reactionKey),
|
||||
activeChannelClaim,
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
hasChannels: selectHasChannels(state),
|
||||
playingUri: selectPlayingUri(state),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(props.authorUri)(state),
|
||||
stakedLevel: selectStakedLevelForChannelUri(state, props.authorUri),
|
||||
linkedCommentAncestors: selectLinkedCommentAncestors(state),
|
||||
totalReplyPages: makeSelectTotalReplyPagesForParentId(props.commentId)(state),
|
||||
};
|
||||
|
||||
@@ -27,6 +27,7 @@ import CommentMenuList from 'component/commentMenuList';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import { parseSticker } from 'util/comments';
|
||||
|
||||
const AUTO_EXPAND_ALL_REPLIES = false;
|
||||
@@ -49,7 +50,7 @@ type Props = {
|
||||
commentModBlock: (string) => void,
|
||||
linkedCommentId?: string,
|
||||
linkedCommentAncestors: { [string]: Array<string> },
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
hasChannels: boolean,
|
||||
commentingEnabled: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
isTopLevel?: boolean,
|
||||
@@ -94,7 +95,7 @@ function Comment(props: Props) {
|
||||
linkedCommentId,
|
||||
linkedCommentAncestors,
|
||||
commentingEnabled,
|
||||
myChannels,
|
||||
hasChannels,
|
||||
doToast,
|
||||
isTopLevel,
|
||||
threadDepth,
|
||||
@@ -134,12 +135,12 @@ function Comment(props: Props) {
|
||||
const [page, setPage] = useState(showRepliesOnMount ? 1 : 0);
|
||||
const [advancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [displayDeadComment, setDisplayDeadComment] = React.useState(false);
|
||||
const hasChannels = myChannels && myChannels.length > 0;
|
||||
const likesCount = (othersReacts && othersReacts.like) || 0;
|
||||
const dislikesCount = (othersReacts && othersReacts.dislike) || 0;
|
||||
const totalLikesAndDislikes = likesCount + dislikesCount;
|
||||
const slimedToDeath = totalLikesAndDislikes >= 5 && dislikesCount / totalLikesAndDislikes > 0.8;
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const commentByOwnerOfContent = contentChannelClaim && contentChannelClaim.permanent_url === authorUri;
|
||||
const stickerFromMessage = parseSticker(message);
|
||||
|
||||
let channelOwnerOfContent;
|
||||
@@ -343,7 +344,7 @@ function Comment(props: Props) {
|
||||
</div>
|
||||
) : stickerFromMessage ? (
|
||||
<div className="sticker__comment">
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad />
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad loading="lazy" />
|
||||
</div>
|
||||
) : editedMessage.length >= LENGTH_TO_COLLAPSE ? (
|
||||
<Expandable>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import 'scss/component/_emote-selector.scss';
|
||||
import { EMOTES_24px as EMOTES } from 'constants/emotes';
|
||||
import { EMOTES_48px as EMOTES } from 'constants/emotes';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import EMOJIS from 'emoji-dictionary';
|
||||
@@ -32,8 +32,6 @@ export default function EmoteSelector(props: Props) {
|
||||
|
||||
<div className="emoteSelector__list">
|
||||
<div className="emoteSelector__listRow">
|
||||
<div className="emoteSelector__listRowTitle">{__('Global Emotes')}</div>
|
||||
|
||||
<div className="emoteSelector__listRowItems">
|
||||
{OLD_QUICK_EMOJIS.map((emoji) => (
|
||||
<Button
|
||||
@@ -50,7 +48,7 @@ export default function EmoteSelector(props: Props) {
|
||||
|
||||
return (
|
||||
<Button
|
||||
key={String(emote)}
|
||||
key={emoteName}
|
||||
title={emoteName}
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectMyChannelClaims,
|
||||
selectClaimForUri,
|
||||
selectClaimIsMine,
|
||||
selectHasChannels,
|
||||
selectFetchingMyChannels,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
@@ -14,15 +14,18 @@ import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
|
||||
const select = (state, props) => ({
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
isFetchingChannels: selectFetchingMyChannels(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
return {
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
hasChannels: selectHasChannels(state),
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
isFetchingChannels: selectFetchingMyChannels(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
createComment: (comment, claimId, parentId, txid, payment_intent_id, environment, sticker) =>
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function StickerSelector(props: Props) {
|
||||
className="button--file-action"
|
||||
onClick={() => onSelect(sticker)}
|
||||
>
|
||||
<OptimizedImage src={sticker.url} waitLoad />
|
||||
<OptimizedImage src={sticker.url} waitLoad loading="lazy" />
|
||||
{sticker.price && sticker.price > 0 && (
|
||||
<CreditAmount superChatLight amount={sticker.price} size={2} isFiat />
|
||||
)}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { buildValidSticker } from 'util/comments';
|
||||
import { FF_MAX_CHARS_IN_COMMENT, FF_MAX_CHARS_IN_LIVESTREAM_COMMENT } from 'constants/form-field';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
@@ -42,7 +43,7 @@ type Props = {
|
||||
activeChannel: string,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
bottom: boolean,
|
||||
channels: ?Array<ChannelClaim>,
|
||||
hasChannels: boolean,
|
||||
claim: StreamClaim,
|
||||
claimIsMine: boolean,
|
||||
embed?: boolean,
|
||||
@@ -71,7 +72,7 @@ export function CommentCreate(props: Props) {
|
||||
const {
|
||||
activeChannelClaim,
|
||||
bottom,
|
||||
channels,
|
||||
hasChannels,
|
||||
claim,
|
||||
claimIsMine,
|
||||
embed,
|
||||
@@ -117,12 +118,14 @@ export function CommentCreate(props: Props) {
|
||||
const [commentValue, setCommentValue] = React.useState('');
|
||||
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [stickerSelector, setStickerSelector] = React.useState();
|
||||
const [activeTab, setActiveTab] = React.useState('');
|
||||
const [activeTab, setActiveTab] = React.useState();
|
||||
const [tipError, setTipError] = React.useState();
|
||||
const [deletedComment, setDeletedComment] = React.useState(false);
|
||||
const [pauseQuickSend, setPauseQuickSend] = React.useState(false);
|
||||
const [showEmotes, setShowEmotes] = React.useState(false);
|
||||
const [disableReviewButton, setDisableReviewButton] = React.useState();
|
||||
const [exchangeRate, setExchangeRate] = React.useState();
|
||||
const [canReceiveFiatTip, setCanReceiveFiatTip] = React.useState(undefined);
|
||||
|
||||
const selectedMentionIndex =
|
||||
commentValue.indexOf('@', selectionIndex) === selectionIndex
|
||||
@@ -143,7 +146,6 @@ export function CommentCreate(props: Props) {
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channelUri = claim && (claim.signing_channel ? claim.signing_channel.permanent_url : claim.permanent_url);
|
||||
const hasChannels = channels && channels.length;
|
||||
const charCount = commentValue ? commentValue.length : 0;
|
||||
const disabled = deletedComment || isSubmitting || isFetchingChannels || !commentValue.length || pauseQuickSend;
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
@@ -152,6 +154,7 @@ export function CommentCreate(props: Props) {
|
||||
const minTip = (channelSettings && channelSettings.min_tip_amount_comment) || 0;
|
||||
const minAmount = minTip || minSuper || 0;
|
||||
const minAmountMet = minAmount === 0 || tipAmount >= minAmount;
|
||||
const stickerPrice = selectedSticker && selectedSticker.price;
|
||||
|
||||
const minAmountRef = React.useRef(minAmount);
|
||||
minAmountRef.current = minAmount;
|
||||
@@ -168,7 +171,7 @@ export function CommentCreate(props: Props) {
|
||||
setStickerSelector(false);
|
||||
|
||||
if (sticker.price && sticker.price > 0) {
|
||||
setActiveTab(TAB_FIAT);
|
||||
setActiveTab(canReceiveFiatTip ? TAB_FIAT : TAB_LBC);
|
||||
setIsSupportComment(true);
|
||||
}
|
||||
}
|
||||
@@ -316,7 +319,7 @@ export function CommentCreate(props: Props) {
|
||||
if (setQuickReply) setQuickReply(res);
|
||||
|
||||
if (res && res.signature) {
|
||||
setCommentValue('');
|
||||
if (!stickerValue) setCommentValue('');
|
||||
setReviewingSupportComment(false);
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
@@ -370,12 +373,45 @@ export function CommentCreate(props: Props) {
|
||||
return () => clearTimeout(timer);
|
||||
}, [pauseQuickSend]);
|
||||
|
||||
// Stickers: Get LBC-USD exchange rate if hasn't yet and selected a paid sticker
|
||||
React.useEffect(() => {
|
||||
if (stickerPrice && !exchangeRate) Lbryio.getExchangeRates().then(({ LBC_USD }) => setExchangeRate(LBC_USD));
|
||||
}, [exchangeRate, stickerPrice]);
|
||||
|
||||
// Stickers: Check if creator has a tip account saved (on selector so that if a paid sticker is selected,
|
||||
// it defaults to LBC tip instead of USD)
|
||||
React.useEffect(() => {
|
||||
if (!stripeEnvironment || !stickerSelector || canReceiveFiatTip !== undefined) return;
|
||||
|
||||
const channelClaimId = claim.signing_channel ? claim.signing_channel.claim_id : claim.claim_id;
|
||||
const tipChannelName = claim.signing_channel ? claim.signing_channel.name : claim.name;
|
||||
|
||||
Lbryio.call(
|
||||
'account',
|
||||
'check',
|
||||
{
|
||||
channel_claim_id: channelClaimId,
|
||||
channel_name: tipChannelName,
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((accountCheckResponse) => {
|
||||
if (accountCheckResponse === true && canReceiveFiatTip !== true) {
|
||||
setCanReceiveFiatTip(true);
|
||||
} else {
|
||||
setCanReceiveFiatTip(false);
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}, [canReceiveFiatTip, claim.claim_id, claim.name, claim.signing_channel, stickerSelector]);
|
||||
|
||||
// **************************************************************************
|
||||
// Render
|
||||
// **************************************************************************
|
||||
|
||||
const getActionButton = (title: string, icon: string, handleClick: () => void) => (
|
||||
<Button title={title} button="alt" icon={icon} onClick={handleClick} />
|
||||
const getActionButton = (title: string, label?: string, icon: string, handleClick: () => void) => (
|
||||
<Button title={title} label={label} button="alt" icon={icon} onClick={handleClick} />
|
||||
);
|
||||
|
||||
if (channelSettings && !channelSettings.comments_enabled) {
|
||||
@@ -410,6 +446,7 @@ export function CommentCreate(props: Props) {
|
||||
|
||||
return (
|
||||
<Form
|
||||
onSubmit={() => {}}
|
||||
className={classnames('commentCreate', {
|
||||
'commentCreate--reply': isReply,
|
||||
'commentCreate--nestedReply': isNested,
|
||||
@@ -427,10 +464,15 @@ export function CommentCreate(props: Props) {
|
||||
</div>
|
||||
|
||||
<div className="commentCreate__stickerPreviewImage">
|
||||
<OptimizedImage src={selectedSticker && selectedSticker.url} waitLoad />
|
||||
<OptimizedImage src={selectedSticker && selectedSticker.url} waitLoad loading="lazy" />
|
||||
</div>
|
||||
|
||||
{selectedSticker.price && <FilePrice customPrice={selectedSticker.price} isFiat />}
|
||||
{selectedSticker.price && exchangeRate && (
|
||||
<FilePrice
|
||||
customPrices={{ priceFiat: selectedSticker.price, priceLBC: selectedSticker.price / exchangeRate }}
|
||||
isFiat
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
) : isReviewingSupportComment && activeChannelClaim ? (
|
||||
<div className="commentCreate__supportCommentPreview">
|
||||
@@ -477,7 +519,7 @@ export function CommentCreate(props: Props) {
|
||||
label={
|
||||
<span className="commentCreate__labelWrapper">
|
||||
{!livestream && (
|
||||
<div className="commentCreate__label">{isReply ? __('Replying as ') : __('Comment as ')}</div>
|
||||
<div className="commentCreate__label">{(isReply ? __('Replying as') : __('Comment as')) + ' '}</div>
|
||||
)}
|
||||
<SelectChannel tiny />
|
||||
</span>
|
||||
@@ -499,13 +541,14 @@ export function CommentCreate(props: Props) {
|
||||
</>
|
||||
)}
|
||||
|
||||
{(isSupportComment || (isReviewingStickerComment && selectedSticker && selectedSticker.price)) && (
|
||||
{(isSupportComment || (isReviewingStickerComment && stickerPrice)) && (
|
||||
<WalletTipAmountSelector
|
||||
activeTab={activeTab}
|
||||
amount={tipAmount}
|
||||
claim={claim}
|
||||
convertedAmount={convertedAmount}
|
||||
customTipAmount={selectedSticker && selectedSticker.price}
|
||||
customTipAmount={stickerPrice}
|
||||
exchangeRate={exchangeRate}
|
||||
fiatConversion={selectedSticker && !!selectedSticker.price}
|
||||
onChange={(amount) => setTipAmount(amount)}
|
||||
setConvertedAmount={setConvertedAmount}
|
||||
@@ -536,14 +579,7 @@ export function CommentCreate(props: Props) {
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Send')}
|
||||
disabled={
|
||||
(isSupportComment && (tipError || disableReviewButton)) ||
|
||||
(selectedSticker &&
|
||||
selectedSticker.price &&
|
||||
(activeTab === TAB_FIAT
|
||||
? tipAmount < selectedSticker.price
|
||||
: convertedAmount && convertedAmount < selectedSticker.price))
|
||||
}
|
||||
disabled={isSupportComment && (tipError || disableReviewButton)}
|
||||
onClick={() => {
|
||||
if (isSupportComment) {
|
||||
handleSupportComment();
|
||||
@@ -591,33 +627,43 @@ export function CommentCreate(props: Props) {
|
||||
{/** Stickers/Support Buttons **/}
|
||||
{!supportDisabled && !stickerSelector && (
|
||||
<>
|
||||
{isReviewingStickerComment ? (
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Different Sticker')}
|
||||
onClick={() => {
|
||||
setReviewingStickerComment(false);
|
||||
setIsSupportComment(false);
|
||||
setStickerSelector(true);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
getActionButton(__('Stickers'), ICONS.TAG, () => {
|
||||
{getActionButton(
|
||||
__('Stickers'),
|
||||
isReviewingStickerComment ? __('Different Sticker') : undefined,
|
||||
ICONS.STICKER,
|
||||
() => {
|
||||
if (isReviewingStickerComment) setReviewingStickerComment(false);
|
||||
setIsSupportComment(false);
|
||||
setStickerSelector(true);
|
||||
})
|
||||
}
|
||||
)}
|
||||
|
||||
{!claimIsMine && (
|
||||
<>
|
||||
{(!isSupportComment || activeTab !== TAB_LBC) &&
|
||||
getActionButton(
|
||||
__('Credits'),
|
||||
isSupportComment ? __('Switch to Credits') : undefined,
|
||||
ICONS.LBC,
|
||||
() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
}
|
||||
)}
|
||||
|
||||
{stripeEnvironment &&
|
||||
(!isSupportComment || activeTab !== TAB_FIAT) &&
|
||||
getActionButton(
|
||||
__('Cash'),
|
||||
isSupportComment ? __('Switch to Cash') : undefined,
|
||||
ICONS.FINANCE,
|
||||
() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
}
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{!claimIsMine &&
|
||||
getActionButton(__('LBC'), ICONS.LBC, () => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
})}
|
||||
{!claimIsMine &&
|
||||
stripeEnvironment &&
|
||||
getActionButton(__('Cash'), ICONS.FINANCE, () => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -635,7 +681,7 @@ export function CommentCreate(props: Props) {
|
||||
if (isSupportComment || isReviewingSupportComment) {
|
||||
if (!isReviewingSupportComment) setIsSupportComment(false);
|
||||
setReviewingSupportComment(false);
|
||||
if (selectedSticker && selectedSticker.price) {
|
||||
if (stickerPrice) {
|
||||
setReviewingStickerComment(false);
|
||||
setStickerSelector(false);
|
||||
setSelectedSticker(null);
|
||||
|
||||
@@ -4,24 +4,22 @@ import { doCommentPin, doCommentModAddDelegate } from 'redux/actions/comments';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import {
|
||||
makeSelectChannelPermUrlForClaimUri,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { selectClaimIsMine, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectModerationDelegatorsById } from 'redux/selectors/comments';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import CommentMenuList from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
contentChannelPermanentUrl: makeSelectChannelPermUrlForClaimUri(props.uri)(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
playingUri: selectPlayingUri(state),
|
||||
moderationDelegatorsById: selectModerationDelegatorsById(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
return {
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
playingUri: selectPlayingUri(state),
|
||||
moderationDelegatorsById: selectModerationDelegatorsById(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
|
||||
@@ -24,7 +24,6 @@ type Props = {
|
||||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
contentChannelPermanentUrl: any,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
playingUri: ?PlayingUri,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
@@ -43,11 +42,11 @@ function CommentMenuList(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
claim,
|
||||
claimIsMine,
|
||||
authorUri,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
activeChannelClaim,
|
||||
contentChannelPermanentUrl,
|
||||
isTopLevel,
|
||||
isPinned,
|
||||
playingUri,
|
||||
@@ -71,6 +70,8 @@ function CommentMenuList(props: Props) {
|
||||
} = useHistory();
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const contentChannelPermanentUrl = contentChannelClaim && contentChannelClaim.permanent_url;
|
||||
|
||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
||||
@@ -84,10 +85,12 @@ function CommentMenuList(props: Props) {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
||||
commentId,
|
||||
commentIsMine,
|
||||
contentChannelPermanentUrl,
|
||||
deleterClaim: activeChannelClaim,
|
||||
deleterIsModOrAdmin: activeChannelIsAdmin || activeChannelIsModerator,
|
||||
creatorClaim: commentIsMine ? undefined : contentChannelClaim,
|
||||
supportAmount,
|
||||
setQuickReply,
|
||||
});
|
||||
@@ -102,7 +105,7 @@ function CommentMenuList(props: Props) {
|
||||
|
||||
function getBlockOptionElem() {
|
||||
const isPersonalBlockTheOnlyOption = !activeChannelIsModerator && !activeChannelIsAdmin;
|
||||
const isTimeoutBlockAvailable = (claim && claim.is_my_output) || activeChannelIsModerator;
|
||||
const isTimeoutBlockAvailable = claimIsMine || activeChannelIsModerator;
|
||||
const personalPermanentBlockOnly = isPersonalBlockTheOnlyOption && !isTimeoutBlockAvailable;
|
||||
|
||||
function getSubtitle() {
|
||||
@@ -201,7 +204,9 @@ function CommentMenuList(props: Props) {
|
||||
|
||||
{!disableRemove &&
|
||||
activeChannelClaim &&
|
||||
(activeChannelClaim.permanent_url === authorUri ||
|
||||
(activeChannelIsModerator ||
|
||||
activeChannelIsAdmin ||
|
||||
activeChannelClaim.permanent_url === authorUri ||
|
||||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
|
||||
<div className="menu__link">
|
||||
@@ -215,7 +220,13 @@ function CommentMenuList(props: Props) {
|
||||
<>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri })}
|
||||
onSelect={() =>
|
||||
openModal(MODALS.BLOCK_CHANNEL, {
|
||||
contentUri: uri,
|
||||
commenterUri: authorUri,
|
||||
offendingCommentId: commentId,
|
||||
})
|
||||
}
|
||||
>
|
||||
{getBlockOptionElem()}
|
||||
</MenuItem>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import Comment from './view';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectClaimIsMine, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectMyReactsForComment, selectOthersReactsForComment } from 'redux/selectors/comments';
|
||||
@@ -11,10 +11,11 @@ const select = (state, props) => {
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
const reactionKey = activeChannelId ? `${props.commentId}:${activeChannelId}` : props.commentId;
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
myReacts: selectMyReactsForComment(state, reactionKey),
|
||||
othersReacts: selectOthersReactsForComment(state, reactionKey),
|
||||
activeChannelId,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import {
|
||||
selectClaimForUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectClaimIsMine,
|
||||
selectFetchingMyChannels,
|
||||
selectMyClaimIdsRaw,
|
||||
} from 'redux/selectors/claims';
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
makeSelectTotalCommentsCountForUri,
|
||||
selectOthersReacts,
|
||||
selectMyReacts,
|
||||
makeSelectCommentIdsForUri,
|
||||
selectCommentIdsForUri,
|
||||
selectSettingsByChannelId,
|
||||
selectPinnedCommentsForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
@@ -24,6 +25,7 @@ import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import CommentsList from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
const topLevelComments = selectTopLevelCommentsForUri(state, props.uri);
|
||||
|
||||
@@ -36,12 +38,12 @@ const select = (state, props) => {
|
||||
topLevelComments,
|
||||
resolvedComments,
|
||||
myChannelIds: selectMyClaimIdsRaw(state),
|
||||
allCommentIds: makeSelectCommentIdsForUri(props.uri)(state),
|
||||
allCommentIds: selectCommentIdsForUri(state, props.uri),
|
||||
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
isFetchingCommentsById: selectIsFetchingCommentsById(state),
|
||||
isFetchingReacts: selectIsFetchingReacts(state),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUris } from 'redux/actions/claims';
|
||||
import { makeSelectClaimIsMine, selectMyChannelClaims, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectClaimIsMineForUri, selectMyChannelClaimIds, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectIsFetchingCommentsByParentId, selectRepliesForParentId } from 'redux/selectors/comments';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import CommentsReplies from './view';
|
||||
@@ -15,9 +15,9 @@ const select = (state, props) => {
|
||||
return {
|
||||
fetchedReplies,
|
||||
resolvedReplies,
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claimIsMine: selectClaimIsMineForUri(state, props.uri),
|
||||
userCanComment: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
myChannelIds: selectMyChannelClaimIds(state),
|
||||
isFetchingByParentId: selectIsFetchingCommentsByParentId(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ type Props = {
|
||||
uri: string,
|
||||
parentId: string,
|
||||
claimIsMine: boolean,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
myChannelIds: ?Array<string>,
|
||||
linkedCommentId?: string,
|
||||
userCanComment: boolean,
|
||||
threadDepth: number,
|
||||
@@ -30,7 +30,7 @@ function CommentsReplies(props: Props) {
|
||||
fetchedReplies,
|
||||
resolvedReplies,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
myChannelIds,
|
||||
linkedCommentId,
|
||||
userCanComment,
|
||||
threadDepth,
|
||||
@@ -95,11 +95,7 @@ function CommentsReplies(props: Props) {
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={
|
||||
comment.channel_id &&
|
||||
myChannels &&
|
||||
myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
||||
}
|
||||
commentIsMine={comment.channel_id && myChannelIds && myChannelIds.includes(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
commentingEnabled={userCanComment}
|
||||
supportAmount={comment.support_amount}
|
||||
|
||||
@@ -1,102 +1,112 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { formatCredits, formatFullPrice } from 'util/format-credits';
|
||||
import classnames from 'classnames';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import { formatCredits, formatFullPrice } from 'util/format-credits';
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
amount: number,
|
||||
amount?: number,
|
||||
className?: string,
|
||||
customAmounts?: { amountFiat: number, amountLBC: number },
|
||||
fee?: boolean,
|
||||
isEstimate?: boolean,
|
||||
isFiat?: boolean,
|
||||
noFormat?: boolean,
|
||||
precision: number,
|
||||
showFree: boolean,
|
||||
showFullPrice: boolean,
|
||||
showPlus: boolean,
|
||||
isEstimate?: boolean,
|
||||
showLBC?: boolean,
|
||||
fee?: boolean,
|
||||
className?: string,
|
||||
noFormat?: boolean,
|
||||
showPlus: boolean,
|
||||
size?: number,
|
||||
superChat?: boolean,
|
||||
superChatLight?: boolean,
|
||||
isFiat?: boolean,
|
||||
};
|
||||
|
||||
class CreditAmount extends React.PureComponent<Props> {
|
||||
static defaultProps = {
|
||||
noFormat: false,
|
||||
precision: 2,
|
||||
showFree: false,
|
||||
showFullPrice: false,
|
||||
showPlus: false,
|
||||
showLBC: true,
|
||||
noFormat: false,
|
||||
showPlus: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
amount,
|
||||
precision,
|
||||
showFullPrice,
|
||||
showFree,
|
||||
showPlus,
|
||||
isEstimate,
|
||||
fee,
|
||||
showLBC,
|
||||
className,
|
||||
customAmounts,
|
||||
fee,
|
||||
isEstimate,
|
||||
isFiat,
|
||||
noFormat,
|
||||
precision,
|
||||
showFree,
|
||||
showFullPrice,
|
||||
showLBC,
|
||||
showPlus,
|
||||
size,
|
||||
superChat,
|
||||
superChatLight,
|
||||
isFiat,
|
||||
} = this.props;
|
||||
const minimumRenderableAmount = 10 ** (-1 * precision);
|
||||
|
||||
// return null, otherwise it will try and convert undefined to a string
|
||||
if (amount === undefined) {
|
||||
return null;
|
||||
}
|
||||
const fullPrice = formatFullPrice(amount, 2);
|
||||
const isFree = parseFloat(amount) === 0;
|
||||
if (amount === undefined && customAmounts === undefined) return null;
|
||||
|
||||
let formattedAmount;
|
||||
if (showFullPrice) {
|
||||
formattedAmount = fullPrice;
|
||||
} else {
|
||||
formattedAmount =
|
||||
amount > 0 && amount < minimumRenderableAmount
|
||||
? `<${minimumRenderableAmount}`
|
||||
: formatCredits(amount, precision, true);
|
||||
}
|
||||
function getAmountText(amount: number, isFiat?: boolean) {
|
||||
const fullPrice = formatFullPrice(amount, 2);
|
||||
const isFree = parseFloat(amount) === 0;
|
||||
let formattedAmount;
|
||||
|
||||
let amountText;
|
||||
if (showFree && isFree) {
|
||||
amountText = __('Free');
|
||||
} else {
|
||||
amountText = noFormat ? amount : formattedAmount;
|
||||
|
||||
if (showPlus && amount > 0) {
|
||||
amountText = `+${amountText}`;
|
||||
if (showFullPrice) {
|
||||
formattedAmount = fullPrice;
|
||||
} else {
|
||||
formattedAmount =
|
||||
amount > 0 && amount < minimumRenderableAmount
|
||||
? `<${minimumRenderableAmount}`
|
||||
: formatCredits(amount, precision, true);
|
||||
}
|
||||
|
||||
if (showLBC && !isFiat) {
|
||||
amountText = <LbcSymbol postfix={amountText} size={size} />;
|
||||
} else if (showLBC && isFiat) {
|
||||
amountText = <p style={{ display: 'inline' }}> ${(Math.round(Number(amountText) * 100) / 100).toFixed(2)}</p>;
|
||||
}
|
||||
if (showFree && isFree) {
|
||||
return __('Free');
|
||||
} else {
|
||||
let amountText = noFormat ? amount : formattedAmount;
|
||||
|
||||
if (fee) {
|
||||
amountText = __('%amount% fee', { amount: amountText });
|
||||
if (showPlus && amount > 0) {
|
||||
amountText = `+${amountText}`;
|
||||
}
|
||||
|
||||
if (showLBC && !isFiat) {
|
||||
amountText = <LbcSymbol postfix={amountText} size={size} />;
|
||||
} else if (showLBC && isFiat) {
|
||||
amountText = <p style={{ display: 'inline' }}> ${(Math.round(Number(amountText) * 100) / 100).toFixed(2)}</p>;
|
||||
}
|
||||
|
||||
if (fee) {
|
||||
amountText = __('%amount% fee', { amount: amountText });
|
||||
}
|
||||
|
||||
return amountText;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<span
|
||||
title={fullPrice}
|
||||
title={amount ? formatFullPrice(amount, 2) : ''}
|
||||
className={classnames(className, {
|
||||
'super-chat': superChat,
|
||||
'super-chat--light': superChatLight,
|
||||
})}
|
||||
>
|
||||
<span className="credit-amount">{amountText}</span>
|
||||
{customAmounts
|
||||
? Object.values(customAmounts).map((amount, index) => (
|
||||
<span key={String(amount)} className="credit-amount">
|
||||
{getAmountText(Number(amount), !index)}
|
||||
</span>
|
||||
))
|
||||
: amount && <span className="credit-amount">{getAmountText(amount, isFiat)}</span>}
|
||||
|
||||
{isEstimate ? (
|
||||
<span className="credit-amount__estimate" title={__('This is an estimate and does not include data fees')}>
|
||||
|
||||
@@ -239,7 +239,7 @@ export class FormField extends React.PureComponent<Props> {
|
||||
{...inputProps}
|
||||
/>
|
||||
<div className="form-field__textarea-info">
|
||||
{!noEmojis && (
|
||||
{!noEmojis && openEmoteMenu && (
|
||||
<Button
|
||||
type="alt"
|
||||
className="button--file-action"
|
||||
|
||||
@@ -2534,4 +2534,32 @@ export const icons = {
|
||||
<line x1="15" y1="9" x2="15.01" y2="9" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.STICKER]: buildIcon(
|
||||
<g>
|
||||
<path d="M7.13,9a.38.38,0,1,1-.38.38A.38.38,0,0,1,7.13,9" />
|
||||
<path d="M5.51,15.42A7.34,7.34,0,0,0,12,19.34a7.83,7.83,0,0,0,.92-.06" />
|
||||
<path d="M23.24,11.52A11.25,11.25,0,1,0,12,23.25h.5" />
|
||||
<path d="M14.45,9.66a2.31,2.31,0,0,1,3.91,0" />
|
||||
<line x1="23.24" y1="11.52" x2="12.5" y2="23.24" />
|
||||
<path d="M12.5,23.24v-1A10.74,10.74,0,0,1,23.24,11.52" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.EDUCATION]: buildIcon(
|
||||
<g>
|
||||
<path d="M12,14c0-1.455,2.964-3.381,8.484-3.494a.508.508,0,0,1,.516.5v8.5a.5.5,0,0,1-.5.5c-5.533.11-8.5,2.038-8.5,3.5,0-1.457-2.971-3.385-8.5-3.5a.5.5,0,0,1-.5-.5v-8.5a.508.508,0,0,1,.516-.5C9.035,10.62,12,12.546,12,14Z" />
|
||||
<path d="M12 14.001L12 23.376" />
|
||||
<path d="M10,14.742A20.1,20.1,0,0,0,5.52,13.7" />
|
||||
<path d="M10,17.742a20.265,20.265,0,0,0-4.521-1.048" />
|
||||
<path d="M14,14.742a20.2,20.2,0,0,1,4.523-1.048" />
|
||||
<path d="M14,17.742a20.213,20.213,0,0,1,4.524-1.048" />
|
||||
<path d="M4.566,9A7.5,7.5,0,1,1,19.434,9" />
|
||||
<path d="M9.624,9,9.189,7.259a1,1,0,0,0-.97-.758H4.651" />
|
||||
<path d="M17.99,3.5H15.281a1,1,0,0,0-.97.758l-.5,2a1,1,0,0,0,.97,1.242h1.052l.245,1.469" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.POP_CULTURE]: buildIcon(
|
||||
<g>
|
||||
<path d="M23.5,12.11a7,7,0,0,1-3.27,5.59.26.26,0,0,1-.32,0,.27.27,0,0,1-.05-.31A2.71,2.71,0,0,0,20,17c.65-1.4.5-2.85-.34-3.25s-2,.41-2.67,1.77c.06-.93-.26-1.7-.86-1.88-1.27-.4-1.77,1.24-4.17,5.44-2.44-4.27-2.9-5.84-4.17-5.44-.6.18-.92.95-.86,1.88-.66-1.36-1.84-2.15-2.67-1.77S3.31,15.63,4,17a2.71,2.71,0,0,0,.18.34.27.27,0,0,1,0,.31.26.26,0,0,1-.32,0A7,7,0,0,1,.5,12.11C.5,8.93,3.17,6.18,7,4.9a.25.25,0,0,1,.32.3L7,6.73a3.37,3.37,0,0,0,.78,3,1,1,0,0,0,1.1.28,1,1,0,0,0,.65-.94V5.61a.25.25,0,0,1,.4-.2l1.6,1.2h1l1.6-1.2a.25.25,0,0,1,.4.2V9.05a1,1,0,0,0,.65.94,1,1,0,0,0,1.1-.28,3.35,3.35,0,0,0,.78-3L16.65,5.2A.25.25,0,0,1,17,4.9C20.83,6.18,23.5,8.93,23.5,12.11Z" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
@@ -1,26 +1,34 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import remark from 'remark';
|
||||
import remarkAttr from 'remark-attr';
|
||||
import remarkStrip from 'strip-markdown';
|
||||
import remarkEmoji from 'remark-emoji';
|
||||
import remarkBreaks from 'remark-breaks';
|
||||
import remarkFrontMatter from 'remark-frontmatter';
|
||||
import reactRenderer from 'remark-react';
|
||||
import MarkdownLink from 'component/markdownLink';
|
||||
import defaultSchema from 'hast-util-sanitize/lib/github.json';
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, SIMPLE_SITE } from 'config';
|
||||
import { formattedEmote, inlineEmote } from 'util/remark-emote';
|
||||
import { formattedLinks, inlineLinks } from 'util/remark-lbry';
|
||||
import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp';
|
||||
import { formattedEmote, inlineEmote } from 'util/remark-emote';
|
||||
import ZoomableImage from 'component/zoomableImage';
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, SIMPLE_SITE } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as React from 'react';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
import defaultSchema from 'hast-util-sanitize/lib/github.json';
|
||||
import MarkdownLink from 'component/markdownLink';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import reactRenderer from 'remark-react';
|
||||
import remark from 'remark';
|
||||
import remarkAttr from 'remark-attr';
|
||||
import remarkBreaks from 'remark-breaks';
|
||||
import remarkEmoji from 'remark-emoji';
|
||||
import remarkFrontMatter from 'remark-frontmatter';
|
||||
import remarkStrip from 'strip-markdown';
|
||||
import ZoomableImage from 'component/zoomableImage';
|
||||
|
||||
const RE_EMOTE = /:\+1:|:-1:|:[\w-]+:/;
|
||||
|
||||
function isEmote(title, src) {
|
||||
return title && RE_EMOTE.test(title) && src.includes('static.odycdn.com/emoticons');
|
||||
}
|
||||
|
||||
function isStakeEnoughForPreview(stakedLevel) {
|
||||
return !stakedLevel || stakedLevel >= CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS;
|
||||
}
|
||||
|
||||
type SimpleTextProps = {
|
||||
children?: React.Node,
|
||||
};
|
||||
@@ -103,8 +111,8 @@ const SimpleImageLink = (props: ImageLinkProps) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (title && RE_EMOTE.test(title) && src.includes('static.odycdn.com/emoticons')) {
|
||||
return <OptimizedImage title={title} src={src} />;
|
||||
if (isEmote(title, src)) {
|
||||
return <OptimizedImage src={src} title={title} className="emote" waitLoad loading="lazy" />;
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -134,13 +142,6 @@ const REPLACE_REGEX = /(<iframe\s+src=["'])(.*?(?=))(["']\s*><\/iframe>)/g;
|
||||
// ****************************************************************************
|
||||
// ****************************************************************************
|
||||
|
||||
function isStakeEnoughForPreview(stakedLevel) {
|
||||
return !stakedLevel || stakedLevel >= CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS;
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// ****************************************************************************
|
||||
|
||||
const MarkdownPreview = (props: MarkdownProps) => {
|
||||
const {
|
||||
content,
|
||||
@@ -173,10 +174,6 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
})
|
||||
: '';
|
||||
|
||||
const initialQuote = strippedContent.split(' ').find((word) => word.length > 0 || word.charAt(0) === '>');
|
||||
let stripQuote;
|
||||
if (initialQuote && initialQuote.charAt(0) === '>') stripQuote = true;
|
||||
|
||||
const remarkOptions: Object = {
|
||||
sanitize: schema,
|
||||
fragment: React.Fragment,
|
||||
@@ -194,18 +191,17 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
),
|
||||
// Workaraund of remarkOptions.Fragment
|
||||
div: React.Fragment,
|
||||
img: isStakeEnoughForPreview(stakedLevel)
|
||||
? ZoomableImage
|
||||
: (imgProps) => (
|
||||
<SimpleImageLink
|
||||
src={imgProps.src}
|
||||
alt={imgProps.alt}
|
||||
title={imgProps.title}
|
||||
helpText={
|
||||
SIMPLE_SITE ? __("This channel isn't staking enough LBRY Credits for inline image previews.") : ''
|
||||
}
|
||||
/>
|
||||
),
|
||||
img: (imgProps) =>
|
||||
isStakeEnoughForPreview(stakedLevel) && !isEmote(imgProps.title, imgProps.src) ? (
|
||||
<ZoomableImage {...imgProps} />
|
||||
) : (
|
||||
<SimpleImageLink
|
||||
src={imgProps.src}
|
||||
alt={imgProps.alt}
|
||||
title={imgProps.title}
|
||||
helpText={SIMPLE_SITE ? __("This channel isn't staking enough Credits for inline image previews.") : ''}
|
||||
/>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -217,22 +213,10 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
};
|
||||
|
||||
// Strip all content and just render text
|
||||
if (strip || stripQuote) {
|
||||
if (strip) {
|
||||
// Remove new lines and extra space
|
||||
remarkOptions.remarkReactComponents.p = SimpleText;
|
||||
return stripQuote ? (
|
||||
<span dir="auto" className="markdown-preview">
|
||||
<blockquote>
|
||||
{
|
||||
remark()
|
||||
.use(remarkStrip)
|
||||
.use(remarkFrontMatter, ['yaml'])
|
||||
.use(reactRenderer, remarkOptions)
|
||||
.processSync(content).contents
|
||||
}
|
||||
</blockquote>
|
||||
</span>
|
||||
) : (
|
||||
return (
|
||||
<span dir="auto" className="markdown-preview">
|
||||
{
|
||||
remark()
|
||||
|
||||
@@ -20,7 +20,8 @@ function Paginate(props: Props) {
|
||||
const { search } = location;
|
||||
const [textValue, setTextValue] = React.useState('');
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const initialPage = disableHistory ? 1 : Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
||||
const urlParamPage = Number(urlParams.get(PAGINATE_PARAM));
|
||||
const initialPage = disableHistory ? 1 : urlParamPage || 1;
|
||||
const [currentPage, setCurrentPage] = React.useState(initialPage);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
@@ -47,6 +48,12 @@ function Paginate(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (urlParamPage) {
|
||||
setCurrentPage(urlParamPage);
|
||||
}
|
||||
}, [urlParamPage, setCurrentPage]);
|
||||
|
||||
return (
|
||||
// Hide the paginate controls if we are loading or there is only one page
|
||||
// It should still be rendered to trigger the onPageChange callback
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectDateForUri } from 'redux/selectors/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import DateTime from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
date: props.date || selectDateForUri(state, props.uri),
|
||||
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
||||
clock24h: selectClientSetting(state, SETTINGS.CLOCK_24H),
|
||||
});
|
||||
export default connect(select)(DateTime);
|
||||
@@ -1,12 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
||||
import FirstRunEmailCollection from './view';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
|
||||
const select = (state) => ({
|
||||
emailCollectionAcknowledged: makeSelectClientSetting(SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED)(state),
|
||||
emailCollectionAcknowledged: selectClientSetting(state, SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED),
|
||||
email: selectEmailToVerify(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectThumbnailForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectThumbnailForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { doFetchCostInfoForUri, makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { doFetchCostInfoForUri, selectCostInfoForUri } from 'lbryinc';
|
||||
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doAnaltyicsPurchaseEvent } from 'redux/actions/app';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
|
||||
|
||||
import ChannelThumbnail from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
thumbnail: selectThumbnailForUri(state, props.uri),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
floatingPlayerEnabled: selectClientSetting(state, SETTINGS.FLOATING_PLAYER),
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as ICONS from 'constants/icons';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import React, { useRef } from 'react';
|
||||
import { generateEmbedUrl } from 'util/web';
|
||||
import { generateEmbedUrl, generateEmbedIframeData } from 'util/web';
|
||||
|
||||
type Props = {
|
||||
copyable: string,
|
||||
@@ -22,7 +22,7 @@ export default function EmbedTextArea(props: Props) {
|
||||
const input = useRef();
|
||||
|
||||
const streamUrl = generateEmbedUrl(name, claimId, includeStartTime, startTime, referralCode);
|
||||
let embedText = `<iframe id="lbry-iframe" width="560" height="315" src="${streamUrl}" allowfullscreen></iframe>`;
|
||||
const { html: embedText } = generateEmbedIframeData(streamUrl);
|
||||
|
||||
function copyToClipboard() {
|
||||
const topRef = input.current;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
selectMyChannelClaims,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
selectClaimIsMine,
|
||||
selectClaimForUri,
|
||||
selectHasChannels,
|
||||
selectIsStreamPlaceholderForUri,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectStreamingUrlForUri, makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
||||
import { doPrepareEdit } from 'redux/actions/publish';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectCostInfoForUri } from 'lbryinc';
|
||||
import { doSetPlayingUri, doPlayUri } from 'redux/actions/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doOpenModal, doSetActiveChannel, doSetIncognito, doAnalyticsView } from 'redux/actions/app';
|
||||
@@ -17,17 +17,21 @@ import fs from 'fs';
|
||||
import FileActions from './view';
|
||||
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
isLivestreamClaim: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
reactionsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
hasChannels: selectHasChannels(state),
|
||||
isLivestreamClaim: selectIsStreamPlaceholderForUri(state, props.uri),
|
||||
reactionsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
|
||||
@@ -27,7 +27,7 @@ type Props = {
|
||||
fileInfo: FileListItem,
|
||||
costInfo: ?{ cost: number },
|
||||
renderMode: string,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
hasChannels: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
clearPlayingUri: () => void,
|
||||
hideRepost?: boolean,
|
||||
@@ -47,7 +47,7 @@ function FileActions(props: Props) {
|
||||
costInfo,
|
||||
renderMode,
|
||||
prepareEdit,
|
||||
myChannels,
|
||||
hasChannels,
|
||||
clearPlayingUri,
|
||||
doToast,
|
||||
hideRepost,
|
||||
@@ -63,7 +63,6 @@ function FileActions(props: Props) {
|
||||
const isMobile = useIsMobile();
|
||||
const webShareable = costInfo && costInfo.cost === 0 && RENDER_MODES.WEB_SHAREABLE_MODES.includes(renderMode);
|
||||
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
||||
const hasChannels = myChannels && myChannels.length > 0;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const { signing_channel: signingChannel } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'redux/selectors/claims';
|
||||
import { selectClaimForUri, makeSelectMetadataForUri, selectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import FileDescription from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, {
|
||||
doOpenModal,
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import { selectClaimIsMine, selectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import {
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectDownloadingForUri,
|
||||
makeSelectLoadingForUri,
|
||||
makeSelectStreamingUrlForUri,
|
||||
} from 'redux/selectors/file_info';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectCostInfoForUri } from 'lbryinc';
|
||||
import { doOpenModal, doAnalyticsView } from 'redux/actions/app';
|
||||
import { doSetPlayingUri, doPlayUri } from 'redux/actions/content';
|
||||
import FileDownloadLink from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
||||
loading: makeSelectLoadingForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
||||
loading: makeSelectLoadingForUri(props.uri)(state),
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
claim,
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimWasPurchased, makeSelectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { makeSelectCostInfoForUri, doFetchCostInfoForUri, makeSelectFetchingCostInfoForUri } from 'lbryinc';
|
||||
import { selectClaimForUri, makeSelectClaimWasPurchased, selectClaimIsMine } from 'redux/selectors/claims';
|
||||
import { selectCostInfoForUri, doFetchCostInfoForUri, selectFetchingCostInfoForUri } from 'lbryinc';
|
||||
import FilePrice from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
fetching: makeSelectFetchingCostInfoForUri(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
fetching: selectFetchingCostInfoForUri(state, props.uri),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, { doFetchCostInfoForUri })(FilePrice);
|
||||
@@ -16,7 +16,7 @@ type Props = {
|
||||
type?: string,
|
||||
uri: string,
|
||||
// below props are just passed to <CreditAmount />
|
||||
customPrice: number,
|
||||
customPrices?: { priceFiat: number, priceLBC: number },
|
||||
hideFree?: boolean, // hide the file price if it's free
|
||||
isFiat?: boolean,
|
||||
showLBC?: boolean,
|
||||
@@ -50,10 +50,10 @@ class FilePrice extends React.PureComponent<Props> {
|
||||
claimWasPurchased,
|
||||
type,
|
||||
claimIsMine,
|
||||
customPrice,
|
||||
customPrices,
|
||||
} = this.props;
|
||||
|
||||
if (!customPrice && (claimIsMine || !costInfo || !costInfo.cost || (!costInfo.cost && hideFree))) return null;
|
||||
if (!customPrices && (claimIsMine || !costInfo || !costInfo.cost || (!costInfo.cost && hideFree))) return null;
|
||||
|
||||
const className = classnames(claimWasPurchased ? 'filePrice__key' : 'filePrice', {
|
||||
'filePrice--filepage': type === 'filepage',
|
||||
@@ -66,7 +66,10 @@ class FilePrice extends React.PureComponent<Props> {
|
||||
</span>
|
||||
) : (
|
||||
<CreditAmount
|
||||
amount={costInfo ? costInfo.cost : customPrice}
|
||||
amount={costInfo ? costInfo.cost : undefined}
|
||||
customAmounts={
|
||||
customPrices ? { amountFiat: customPrices.priceFiat, amountLBC: customPrices.priceLBC } : undefined
|
||||
}
|
||||
className={className}
|
||||
isEstimate={!!costInfo && !costInfo.includesData}
|
||||
isFiat={isFiat}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectDownloadPathForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
||||
import { makeSelectClaimForUri, makeSelectThumbnailForUri, makeSelectContentTypeForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, selectThumbnailForUri, makeSelectContentTypeForUri } from 'redux/selectors/claims';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'redux/selectors/content';
|
||||
import FileRender from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state);
|
||||
const autoplay = props.embedded ? false : selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA);
|
||||
return {
|
||||
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
||||
currentTheme: selectClientSetting(state, SETTINGS.THEME),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
thumbnail: selectThumbnailForUri(state, props.uri),
|
||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||
downloadPath: makeSelectDownloadPathForUri(props.uri)(state),
|
||||
fileExtension: makeSelectFileExtensionForUri(props.uri)(state),
|
||||
|
||||
@@ -36,7 +36,6 @@ type Props = {
|
||||
autoplay: boolean,
|
||||
renderMode: string,
|
||||
thumbnail: string,
|
||||
desktopPlayStartTime?: number,
|
||||
className?: string,
|
||||
};
|
||||
|
||||
@@ -70,29 +69,13 @@ class FileRender extends React.PureComponent<Props> {
|
||||
}
|
||||
|
||||
renderViewer() {
|
||||
const {
|
||||
currentTheme,
|
||||
contentType,
|
||||
downloadPath,
|
||||
fileExtension,
|
||||
streamingUrl,
|
||||
uri,
|
||||
renderMode,
|
||||
desktopPlayStartTime,
|
||||
} = this.props;
|
||||
const { currentTheme, contentType, downloadPath, fileExtension, streamingUrl, uri, renderMode } = this.props;
|
||||
const source = streamingUrl;
|
||||
|
||||
switch (renderMode) {
|
||||
case RENDER_MODES.AUDIO:
|
||||
case RENDER_MODES.VIDEO:
|
||||
return (
|
||||
<VideoViewer
|
||||
uri={uri}
|
||||
source={source}
|
||||
contentType={contentType}
|
||||
desktopPlayStartTime={desktopPlayStartTime}
|
||||
/>
|
||||
);
|
||||
return <VideoViewer uri={uri} source={source} contentType={contentType} />;
|
||||
case RENDER_MODES.IMAGE:
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectTitleForUri, makeSelectClaimIsNsfw, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import { selectTitleForUri, selectClaimIsNsfwForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
||||
import {
|
||||
makeSelectNextUrlForCollectionAndUrl,
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
selectPlayingUri,
|
||||
makeSelectFileRenderModeForUri,
|
||||
} from 'redux/selectors/content';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectCostInfoForUri } from 'lbryinc';
|
||||
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doFetchRecommendedContent } from 'redux/actions/search';
|
||||
import { doAnaltyicsPurchaseEvent } from 'redux/actions/app';
|
||||
@@ -30,15 +30,15 @@ const select = (state, props) => {
|
||||
uri,
|
||||
primaryUri,
|
||||
playingUri,
|
||||
title: makeSelectTitleForUri(uri)(state),
|
||||
title: selectTitleForUri(state, uri),
|
||||
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
||||
mature: makeSelectClaimIsNsfw(uri)(state),
|
||||
mature: selectClaimIsNsfwForUri(state, uri),
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
||||
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
|
||||
floatingPlayerEnabled: selectClientSetting(state, SETTINGS.FLOATING_PLAYER),
|
||||
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
||||
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
|
||||
costInfo: makeSelectCostInfoForUri(uri)(state),
|
||||
videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE),
|
||||
costInfo: selectCostInfoForUri(state, uri),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
|
||||
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
|
||||
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
|
||||
|
||||
@@ -19,9 +19,64 @@ import { isURIEqual } from 'util/lbryURI';
|
||||
import AutoplayCountdown from 'component/autoplayCountdown';
|
||||
|
||||
const IS_DESKTOP_MAC = typeof process === 'object' ? process.platform === 'darwin' : false;
|
||||
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 60;
|
||||
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 100;
|
||||
export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper';
|
||||
|
||||
function getScreenWidth() {
|
||||
if (document && document.documentElement) {
|
||||
return document.documentElement.clientWidth;
|
||||
} else {
|
||||
return window.innerWidth;
|
||||
}
|
||||
}
|
||||
|
||||
function getScreenHeight() {
|
||||
if (document && document.documentElement) {
|
||||
return document.documentElement.clientHeight;
|
||||
} else {
|
||||
return window.innerHeight;
|
||||
}
|
||||
}
|
||||
|
||||
function getFloatingPlayerRect() {
|
||||
// TODO: use 'fileViewerRect'?
|
||||
const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
|
||||
const elem = document.querySelector(`.${FLOATING_PLAYER_CLASS}`);
|
||||
if (elem) {
|
||||
return elem.getBoundingClientRect();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function clampRectToScreen(x, y, rect) {
|
||||
if (rect) {
|
||||
const ESTIMATED_SCROLL_BAR_PX = 50;
|
||||
const screenW = getScreenWidth();
|
||||
const screenH = getScreenHeight();
|
||||
|
||||
if (x + rect.width > screenW - ESTIMATED_SCROLL_BAR_PX) {
|
||||
x = screenW - rect.width - ESTIMATED_SCROLL_BAR_PX;
|
||||
}
|
||||
|
||||
if (y + rect.height > screenH) {
|
||||
y = screenH - rect.height;
|
||||
}
|
||||
}
|
||||
|
||||
return { x, y };
|
||||
}
|
||||
|
||||
function calculateRelativePos(x, y) {
|
||||
return {
|
||||
x: x / getScreenWidth(),
|
||||
y: y / getScreenHeight(),
|
||||
};
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// ****************************************************************************
|
||||
|
||||
type Props = {
|
||||
isFloating: boolean,
|
||||
fileInfo: FileListItem,
|
||||
@@ -76,7 +131,6 @@ export default function FileRenderFloating(props: Props) {
|
||||
const mainFilePlaying = !isFloating && primaryUri && isURIEqual(uri, primaryUri);
|
||||
|
||||
const [fileViewerRect, setFileViewerRect] = useState();
|
||||
const [desktopPlayStartTime, setDesktopPlayStartTime] = useState();
|
||||
const [wasDragging, setWasDragging] = useState(false);
|
||||
const [doNavigate, setDoNavigate] = useState(false);
|
||||
const [playNextUrl, setPlayNextUrl] = useState(true);
|
||||
@@ -85,10 +139,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
x: -25,
|
||||
y: window.innerHeight - 400,
|
||||
});
|
||||
const [relativePos, setRelativePos] = useState({
|
||||
x: 0,
|
||||
y: 0,
|
||||
});
|
||||
const relativePosRef = React.useRef({ x: 0, y: 0 });
|
||||
|
||||
const navigateUrl =
|
||||
playingUri &&
|
||||
@@ -103,93 +154,49 @@ export default function FileRenderFloating(props: Props) {
|
||||
? __("It looks like you deleted or moved this file. We're rebuilding it now. It will only take a few seconds.")
|
||||
: __('Loading');
|
||||
|
||||
function getScreenWidth() {
|
||||
if (document && document.documentElement) {
|
||||
return document.documentElement.clientWidth;
|
||||
} else {
|
||||
return window.innerWidth;
|
||||
}
|
||||
function restoreToRelativePosition() {
|
||||
const newX = Math.round(relativePosRef.current.x * getScreenWidth());
|
||||
const newY = Math.round(relativePosRef.current.y * getScreenHeight());
|
||||
setPosition(clampRectToScreen(newX, newY, getFloatingPlayerRect()));
|
||||
}
|
||||
|
||||
function getScreenHeight() {
|
||||
if (document && document.documentElement) {
|
||||
return document.documentElement.clientHeight;
|
||||
} else {
|
||||
return window.innerHeight;
|
||||
}
|
||||
}
|
||||
const clampToScreenOnResize = React.useCallback(
|
||||
debounce(() => {
|
||||
restoreToRelativePosition();
|
||||
}, DEBOUNCE_WINDOW_RESIZE_HANDLER_MS),
|
||||
[]
|
||||
);
|
||||
|
||||
const clampToScreen = React.useCallback((pos) => {
|
||||
const ESTIMATED_SCROLL_BAR_PX = 50;
|
||||
const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
|
||||
const fpPlayerElem = document.querySelector(`.${FLOATING_PLAYER_CLASS}`);
|
||||
|
||||
if (fpPlayerElem) {
|
||||
if (pos.x + fpPlayerElem.getBoundingClientRect().width > getScreenWidth() - ESTIMATED_SCROLL_BAR_PX) {
|
||||
pos.x = getScreenWidth() - fpPlayerElem.getBoundingClientRect().width - ESTIMATED_SCROLL_BAR_PX;
|
||||
}
|
||||
if (pos.y + fpPlayerElem.getBoundingClientRect().height > getScreenHeight()) {
|
||||
pos.y = getScreenHeight() - fpPlayerElem.getBoundingClientRect().height;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Updated 'relativePos' based on persisted 'position':
|
||||
const stringifiedPosition = JSON.stringify(position);
|
||||
// ???
|
||||
useEffect(() => {
|
||||
const jsonPosition = JSON.parse(stringifiedPosition);
|
||||
|
||||
setRelativePos({
|
||||
x: jsonPosition.x / getScreenWidth(),
|
||||
y: jsonPosition.y / getScreenHeight(),
|
||||
});
|
||||
}, [stringifiedPosition]);
|
||||
|
||||
// Ensure player is within screen when 'isFloating' changes.
|
||||
useEffect(() => {
|
||||
const jsonPosition = JSON.parse(stringifiedPosition);
|
||||
|
||||
if (isFloating) {
|
||||
// When the player begins floating, remove the comment source
|
||||
// so that it doesn't try to resize again in case of going back
|
||||
// to the origin's comment section and fail to position correctly
|
||||
if (isComment && playingUri) clearSecondarySource(playingUri.uri);
|
||||
|
||||
let pos = { x: jsonPosition.x, y: jsonPosition.y };
|
||||
clampToScreen(pos);
|
||||
if (pos.x !== position.x || pos.y !== position.y) {
|
||||
setPosition({ x: pos.x, y: pos.y });
|
||||
}
|
||||
}
|
||||
}, [
|
||||
clampToScreen,
|
||||
clearSecondarySource,
|
||||
isComment,
|
||||
isFloating,
|
||||
playingUri,
|
||||
position.x,
|
||||
position.y,
|
||||
setPosition,
|
||||
stringifiedPosition,
|
||||
]);
|
||||
}, [isFloating, isComment, clearSecondarySource, playingUri]);
|
||||
|
||||
// Initial update for relativePosRef:
|
||||
useEffect(() => {
|
||||
relativePosRef.current = calculateRelativePos(position.x, position.y);
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// Ensure player is within screen when 'isFloating' changes.
|
||||
useEffect(() => {
|
||||
if (isFloating) {
|
||||
restoreToRelativePosition();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [isFloating]);
|
||||
|
||||
// Listen to main-window resizing and adjust the fp position accordingly:
|
||||
useEffect(() => {
|
||||
const handleMainWindowResize = debounce(() => {
|
||||
let newPos = {
|
||||
x: Math.round(relativePos.x * getScreenWidth()),
|
||||
y: Math.round(relativePos.y * getScreenHeight()),
|
||||
};
|
||||
clampToScreen(newPos);
|
||||
setPosition({ x: newPos.x, y: newPos.y });
|
||||
}, DEBOUNCE_WINDOW_RESIZE_HANDLER_MS);
|
||||
|
||||
window.addEventListener('resize', handleMainWindowResize);
|
||||
return () => window.removeEventListener('resize', handleMainWindowResize);
|
||||
|
||||
// 'relativePos' is needed in the dependency list to avoid stale closure.
|
||||
// Otherwise, this could just be changed to a one-time effect.
|
||||
}, [clampToScreen, relativePos.x, relativePos.y, setPosition]);
|
||||
if (isFloating) {
|
||||
window.addEventListener('resize', clampToScreenOnResize);
|
||||
return () => window.removeEventListener('resize', clampToScreenOnResize);
|
||||
}
|
||||
}, [isFloating, clampToScreenOnResize]);
|
||||
|
||||
const handleResize = React.useCallback(() => {
|
||||
const element = mainFilePlaying
|
||||
@@ -234,18 +241,6 @@ export default function FileRenderFloating(props: Props) {
|
||||
};
|
||||
}, [handleResize]);
|
||||
|
||||
useEffect(() => {
|
||||
// @if TARGET='app'
|
||||
setDesktopPlayStartTime(Date.now());
|
||||
// @endif
|
||||
|
||||
return () => {
|
||||
// @if TARGET='app'
|
||||
setDesktopPlayStartTime(undefined);
|
||||
// @endif
|
||||
};
|
||||
}, [uri]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isFloating) {
|
||||
doFetchRecommendedContent(uri, mature);
|
||||
@@ -295,24 +290,26 @@ export default function FileRenderFloating(props: Props) {
|
||||
}
|
||||
|
||||
function handleDragMove(e, ui) {
|
||||
setWasDragging(true);
|
||||
const { x, y } = position;
|
||||
const newX = x + ui.deltaX;
|
||||
const newY = y + ui.deltaY;
|
||||
setPosition({
|
||||
x: newX,
|
||||
y: newY,
|
||||
});
|
||||
const newX = ui.x;
|
||||
const newY = ui.y;
|
||||
|
||||
// Mark as dragging if the position changed and we were not dragging before.
|
||||
if (!wasDragging && (newX !== x || newY !== y)) {
|
||||
setWasDragging(true);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDragStop(e) {
|
||||
function handleDragStop(e, ui) {
|
||||
if (wasDragging) {
|
||||
e.stopPropagation();
|
||||
setWasDragging(false);
|
||||
setRelativePos({
|
||||
x: position.x / getScreenWidth(),
|
||||
y: position.y / getScreenHeight(),
|
||||
});
|
||||
}
|
||||
|
||||
let newPos = { x: ui.x, y: ui.y };
|
||||
if (newPos.x !== position.x || newPos.y !== position.y) {
|
||||
newPos = clampRectToScreen(newPos.x, newPos.y, getFloatingPlayerRect());
|
||||
setPosition(newPos);
|
||||
relativePosRef.current = calculateRelativePos(newPos.x, newPos.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,6 +331,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
'content__viewer--inline': !isFloating,
|
||||
'content__viewer--secondary': isComment,
|
||||
'content__viewer--theater-mode': !isFloating && videoTheaterMode,
|
||||
'content__viewer--disable-click': wasDragging,
|
||||
})}
|
||||
style={
|
||||
!isFloating && fileViewerRect
|
||||
@@ -363,13 +361,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
)}
|
||||
|
||||
{isReadyToPlay ? (
|
||||
<FileRender
|
||||
className="draggable"
|
||||
uri={uri}
|
||||
// @if TARGET='app'
|
||||
desktopPlayStartTime={desktopPlayStartTime}
|
||||
// @endif
|
||||
/>
|
||||
<FileRender className="draggable" uri={uri} />
|
||||
) : (
|
||||
<>
|
||||
{collectionId && !canViewFile ? (
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doPlayUri, doSetPlayingUri, doSetPrimaryUri } from 'redux/actions/content';
|
||||
import { makeSelectThumbnailForUri, makeSelectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import { selectThumbnailForUri, makeSelectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectCostInfoForUri } from 'lbryinc';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { withRouter } from 'react-router';
|
||||
import {
|
||||
makeSelectIsPlaying,
|
||||
makeSelectShouldObscurePreview,
|
||||
makeSelectInsufficientCreditsForUri,
|
||||
selectShouldObscurePreviewForUri,
|
||||
selectInsufficientCreditsForUri,
|
||||
makeSelectFileRenderModeForUri,
|
||||
} from 'redux/selectors/content';
|
||||
import FileRenderInitiator from './view';
|
||||
@@ -23,13 +23,13 @@ const select = (state, props) => {
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
return {
|
||||
claimThumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
claimThumbnail: selectThumbnailForUri(state, props.uri),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
|
||||
obscurePreview: selectShouldObscurePreviewForUri(state, props.uri),
|
||||
isPlaying: makeSelectIsPlaying(props.uri)(state),
|
||||
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
insufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
|
||||
autoplay: selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA),
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
|
||||
@@ -6,14 +6,14 @@ import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selector
|
||||
import { withRouter } from 'react-router';
|
||||
import { doAnalyticsView } from 'redux/actions/app';
|
||||
import FileRenderInline from './view';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectCostInfoForUri } from 'lbryinc';
|
||||
|
||||
const select = (state, props) => ({
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
isPlaying: selectPrimaryUri(state) === props.uri,
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
costInfo: selectCostInfoForUri(state, props.uri),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -3,27 +3,30 @@ import React from 'react';
|
||||
import DateTime from 'component/dateTime';
|
||||
import FileViewCount from 'component/fileViewCount';
|
||||
import FileActions from 'component/fileActions';
|
||||
import ClaimPreviewReset from 'component/claimPreviewReset';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
livestream?: boolean,
|
||||
activeViewers?: number,
|
||||
isLive?: boolean,
|
||||
};
|
||||
|
||||
function FileSubtitle(props: Props) {
|
||||
const { uri, livestream = false, activeViewers, isLive = false } = props;
|
||||
const { uri, livestream = false, isLive = false } = props;
|
||||
|
||||
return (
|
||||
<div className="media__subtitle--between">
|
||||
<div className="file__viewdate">
|
||||
{livestream ? <span>{__('Right now')}</span> : <DateTime uri={uri} show={DateTime.SHOW_DATE} />}
|
||||
<>
|
||||
<div className="media__subtitle--between">
|
||||
<div className="file__viewdate">
|
||||
{livestream ? <span>{__('Right now')}</span> : <DateTime uri={uri} show={DateTime.SHOW_DATE} />}
|
||||
|
||||
<FileViewCount uri={uri} livestream={livestream} activeViewers={activeViewers} isLive={isLive} />
|
||||
<FileViewCount uri={uri} livestream={livestream} isLive={isLive} />
|
||||
</div>
|
||||
|
||||
<FileActions uri={uri} hideRepost={livestream} livestream={livestream} />
|
||||
</div>
|
||||
|
||||
<FileActions uri={uri} hideRepost={livestream} livestream={livestream} />
|
||||
</div>
|
||||
{livestream && isLive && <ClaimPreviewReset uri={uri} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectTitleForUri } from 'redux/selectors/claims';
|
||||
import { selectTitleForUri } from 'redux/selectors/claims';
|
||||
import FileTitleSection from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(FileTitleSection);
|
||||
@@ -1,21 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
||||
import { makeSelectTitleForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import { makeSelectViewersForId } from 'redux/selectors/livestream';
|
||||
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
||||
import { selectTitleForUri, selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import FileTitleSection from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const viewers = claim && makeSelectViewersForId(claim.claim_id)(state);
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
const channelClaimId = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
|
||||
const channelUri = claim && claim.signing_channel ? claim.signing_channel.canonical_url : undefined;
|
||||
const subCount = channelUri && makeSelectSubCountForUri(channelUri)(state);
|
||||
const subCount = channelUri && selectSubCountForUri(state, channelUri);
|
||||
|
||||
return {
|
||||
viewers,
|
||||
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
|
||||
title: selectTitleForUri(state, props.uri),
|
||||
channelClaimId,
|
||||
subCount,
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ type Props = {
|
||||
isNsfwBlocked: boolean,
|
||||
livestream?: boolean,
|
||||
isLive?: boolean,
|
||||
viewers?: number,
|
||||
subCount: number,
|
||||
channelClaimId?: string,
|
||||
fetchSubCount: (string) => void,
|
||||
@@ -35,7 +34,6 @@ function FileTitleSection(props: Props) {
|
||||
isNsfwBlocked,
|
||||
livestream = false,
|
||||
isLive = false,
|
||||
viewers,
|
||||
subCount,
|
||||
channelClaimId,
|
||||
fetchSubCount,
|
||||
@@ -66,7 +64,7 @@ function FileTitleSection(props: Props) {
|
||||
body={
|
||||
<React.Fragment>
|
||||
<ClaimInsufficientCredits uri={uri} />
|
||||
<FileSubtitle uri={uri} isLive={isLive} livestream={livestream} activeViewers={viewers} />
|
||||
<FileSubtitle uri={uri} isLive={isLive} livestream={livestream} />
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectMediaTypeForUri } from 'redux/selectors/file_info';
|
||||
import { makeSelectClaimIsStreamPlaceholder } from 'redux/selectors/claims';
|
||||
import { selectIsStreamPlaceholderForUri } from 'redux/selectors/claims';
|
||||
import FileType from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
mediaType: makeSelectMediaTypeForUri(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestream: selectIsStreamPlaceholderForUri(state, props.uri),
|
||||
});
|
||||
|
||||
export default connect(select)(FileType);
|
||||
@@ -1,9 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
selectClaimForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectClaimIsMine,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet';
|
||||
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
||||
@@ -12,15 +12,19 @@ import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import FileValues from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
|
||||
return {
|
||||
claim,
|
||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { doFetchViewCount, makeSelectViewCountForUri } from 'lbryinc';
|
||||
import { selectClaimIdForUri } from 'redux/selectors/claims';
|
||||
import { selectViewersForId } from 'redux/selectors/livestream';
|
||||
import { doFetchViewCount, selectViewCountForUri } from 'lbryinc';
|
||||
import { doAnalyticsView } from 'redux/actions/app';
|
||||
import FileViewCount from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const claimId = selectClaimIdForUri(state, props.uri);
|
||||
return {
|
||||
claimId,
|
||||
viewCount: selectViewCountForUri(state, props.uri),
|
||||
activeViewers: props.livestream && claimId ? selectViewersForId(state, claimId) : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
fetchViewCount: (claimId) => dispatch(doFetchViewCount(claimId)),
|
||||
|
||||
Loaded 100 of 318 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user