more flow
This commit is contained in:
parent
11a4524c4c
commit
98df8b265f
25 changed files with 77 additions and 43 deletions
|
@ -24,7 +24,7 @@ module.name_mapper='^modal\(.*\)$' -> '<PROJECT_ROOT>/ui/modal\1'
|
||||||
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/ui/app\1'
|
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/ui/app\1'
|
||||||
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/ui/native\1'
|
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/ui/native\1'
|
||||||
module.name_mapper='^analytics\(.*\)$' -> '<PROJECT_ROOT>/ui/analytics\1'
|
module.name_mapper='^analytics\(.*\)$' -> '<PROJECT_ROOT>/ui/analytics\1'
|
||||||
module.name_mapper='^recsys\(.*\)$' -> '<PROJECT_ROOT>/ui/recsys\1'
|
module.name_mapper='^recsys\(.*\)$' -> '<PROJECT_ROOT>/extras/recsys\1'
|
||||||
module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/ui/rewards\1'
|
module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/ui/rewards\1'
|
||||||
module.name_mapper='^i18n\(.*\)$' -> '<PROJECT_ROOT>/ui/i18n\1'
|
module.name_mapper='^i18n\(.*\)$' -> '<PROJECT_ROOT>/ui/i18n\1'
|
||||||
module.name_mapper='^effects\(.*\)$' -> '<PROJECT_ROOT>/ui/effects\1'
|
module.name_mapper='^effects\(.*\)$' -> '<PROJECT_ROOT>/ui/effects\1'
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { Lbryio } from 'lbryinc';
|
import { Lbryio } from 'lbryinc';
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
|
|
||||||
export const doFetchViewCount = (claimIdCsv: string) => dispatch => {
|
export const doFetchViewCount = (claimIdCsv: string) => (dispatch: Dispatch) => {
|
||||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_STARTED });
|
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_STARTED });
|
||||||
|
|
||||||
return Lbryio.call('file', 'view_count', { claim_id: claimIdCsv })
|
return Lbryio.call('file', 'view_count', { claim_id: claimIdCsv })
|
||||||
|
@ -15,7 +15,7 @@ export const doFetchViewCount = (claimIdCsv: string) => dispatch => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doFetchSubCount = (claimId: string) => dispatch => {
|
export const doFetchSubCount = (claimId: string) => (dispatch: Dispatch) => {
|
||||||
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_STARTED });
|
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_STARTED });
|
||||||
|
|
||||||
return Lbryio.call('subscription', 'sub_count', { claim_id: claimId })
|
return Lbryio.call('subscription', 'sub_count', { claim_id: claimId })
|
||||||
|
|
|
@ -55,7 +55,7 @@ reducers[ACTIONS.UPDATE_UPLOAD_PROGRESS] = (state: TvState, action) => {
|
||||||
return { ...state, currentUploads };
|
return { ...state, currentUploads };
|
||||||
};
|
};
|
||||||
|
|
||||||
export function webReducer(state = defaultState, action) {
|
export function webReducer(state: TvState = defaultState, action: any) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
return state;
|
return state;
|
||||||
|
|
3
extras/recsys/index.js
Normal file
3
extras/recsys/index.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import Recsys from './recsys';
|
||||||
|
|
||||||
|
export { Recsys };
|
|
@ -253,7 +253,7 @@ function ChannelForm(props: Props) {
|
||||||
let nameError;
|
let nameError;
|
||||||
if (!name && name !== undefined) {
|
if (!name && name !== undefined) {
|
||||||
nameError = __('A name is required for your url');
|
nameError = __('A name is required for your url');
|
||||||
} else if (!isNameValid(name, false)) {
|
} else if (!isNameValid(name)) {
|
||||||
nameError = INVALID_NAME_ERROR;
|
nameError = INVALID_NAME_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { AVATAR_DEFAULT } from 'config';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
uri: ?string,
|
uri: string,
|
||||||
className?: string,
|
className?: string,
|
||||||
thumbnailPreview: ?string,
|
thumbnailPreview: ?string,
|
||||||
obscure?: boolean,
|
obscure?: boolean,
|
||||||
|
|
|
@ -175,12 +175,13 @@ function ClaimMenuList(props: Props) {
|
||||||
|
|
||||||
function handleFollow() {
|
function handleFollow() {
|
||||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||||
|
if (channelName) {
|
||||||
subscriptionHandler({
|
subscriptionHandler({
|
||||||
channelName: '@' + channelName,
|
channelName: '@' + channelName,
|
||||||
uri: contentChannelUri,
|
uri: contentChannelUri,
|
||||||
notificationsDisabled: true,
|
notificationsDisabled: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleToggleMute() {
|
function handleToggleMute() {
|
||||||
|
@ -203,7 +204,7 @@ function ClaimMenuList(props: Props) {
|
||||||
if (!isChannel) {
|
if (!isChannel) {
|
||||||
const signingChannelName = contentSigningChannel && contentSigningChannel.name;
|
const signingChannelName = contentSigningChannel && contentSigningChannel.name;
|
||||||
|
|
||||||
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
|
const uriObject: LbryUrlObj = {
|
||||||
streamName: claim.name,
|
streamName: claim.name,
|
||||||
streamClaimId: claim.claim_id,
|
streamClaimId: claim.claim_id,
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Props = {
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
pending?: boolean,
|
pending?: boolean,
|
||||||
type: string,
|
type: string,
|
||||||
beginPublish: (string) => void,
|
beginPublish: (?string) => void,
|
||||||
isLivestream: boolean,
|
isLivestream: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ function FileActions(props: Props) {
|
||||||
// We will select the claim id before they publish
|
// We will select the claim id before they publish
|
||||||
let editUri;
|
let editUri;
|
||||||
if (claimIsMine) {
|
if (claimIsMine) {
|
||||||
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
|
const uriObject: LbryUrlObj = {
|
||||||
streamName: claim.name,
|
streamName: claim.name,
|
||||||
streamClaimId: claim.claim_id,
|
streamClaimId: claim.claim_id,
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default function FileRenderFloating(props: Props) {
|
||||||
const playingUriSource = playingUri && playingUri.source;
|
const playingUriSource = playingUri && playingUri.source;
|
||||||
const isComment = playingUriSource === 'comment';
|
const isComment = playingUriSource === 'comment';
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const mainFilePlaying = !isFloating && isURIEqual(uri, primaryUri);
|
const mainFilePlaying = !isFloating && primaryUri && isURIEqual(uri, primaryUri);
|
||||||
|
|
||||||
const [fileViewerRect, setFileViewerRect] = useState();
|
const [fileViewerRect, setFileViewerRect] = useState();
|
||||||
const [desktopPlayStartTime, setDesktopPlayStartTime] = useState();
|
const [desktopPlayStartTime, setDesktopPlayStartTime] = useState();
|
||||||
|
|
|
@ -57,11 +57,18 @@ function Invited(props: Props) {
|
||||||
|
|
||||||
// always follow if it's a channel
|
// always follow if it's a channel
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (fullUri && !isSubscribed) {
|
if (fullUri && !isSubscribed && fullUri) {
|
||||||
channelSubscribe({
|
let channelName;
|
||||||
channelName: parseURI(fullUri).claimName,
|
try {
|
||||||
uri: fullUri,
|
const { claimName } = parseURI(fullUri);
|
||||||
});
|
channelName = claimName;
|
||||||
|
} catch (e) {}
|
||||||
|
if (channelName) {
|
||||||
|
channelSubscribe({
|
||||||
|
channelName: channelName,
|
||||||
|
uri: fullUri,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [fullUri, isSubscribed, channelSubscribe]);
|
}, [fullUri, isSubscribed, channelSubscribe]);
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,12 @@ export default function Notification(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let channelName;
|
let channelName;
|
||||||
try {
|
if (channelUrl) {
|
||||||
const { claimName } = parseURI(channelUrl);
|
try {
|
||||||
channelName = claimName;
|
const { claimName } = parseURI(channelUrl);
|
||||||
} catch (e) {}
|
channelName = claimName;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
const notificationTitle = notification_parameters.device.title;
|
const notificationTitle = notification_parameters.device.title;
|
||||||
const titleSplit = notificationTitle.split(' ');
|
const titleSplit = notificationTitle.split(' ');
|
||||||
|
|
|
@ -8,7 +8,7 @@ import Card from 'component/common/card';
|
||||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import RecSys from 'extras/recsys/recsys';
|
import RecSys from 'recsys';
|
||||||
|
|
||||||
const VIEW_ALL_RELATED = 'view_all_related';
|
const VIEW_ALL_RELATED = 'view_all_related';
|
||||||
const VIEW_MORE_FROM = 'view_more_from';
|
const VIEW_MORE_FROM = 'view_more_from';
|
||||||
|
|
|
@ -115,7 +115,7 @@ type Props = {
|
||||||
welcomeVersion: number,
|
welcomeVersion: number,
|
||||||
hasNavigated: boolean,
|
hasNavigated: boolean,
|
||||||
setHasNavigated: () => void,
|
setHasNavigated: () => void,
|
||||||
setReferrer: (string) => void,
|
setReferrer: (?string) => void,
|
||||||
hasUnclaimedRefereeReward: boolean,
|
hasUnclaimedRefereeReward: boolean,
|
||||||
homepageData: any,
|
homepageData: any,
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ type Props = {
|
||||||
doResolveUris: (Array<string>) => void,
|
doResolveUris: (Array<string>) => void,
|
||||||
hideLink?: boolean,
|
hideLink?: boolean,
|
||||||
setChannelActive: (boolean) => void,
|
setChannelActive: (boolean) => void,
|
||||||
beginPublish: (string) => void,
|
beginPublish: (?string) => void,
|
||||||
pendingIds: Array<string>,
|
pendingIds: Array<string>,
|
||||||
isResolvingWinningUri: boolean,
|
isResolvingWinningUri: boolean,
|
||||||
winningClaim: ?Claim,
|
winningClaim: ?Claim,
|
||||||
|
@ -44,8 +44,6 @@ export default function SearchTopClaim(props: Props) {
|
||||||
let winningUriIsChannel;
|
let winningUriIsChannel;
|
||||||
try {
|
try {
|
||||||
const { isChannel, streamName, channelName } = parseURI(uriFromQuery);
|
const { isChannel, streamName, channelName } = parseURI(uriFromQuery);
|
||||||
const { isChannel: winnerIsChannel } = parseURI(winningUri);
|
|
||||||
winningUriIsChannel = winnerIsChannel;
|
|
||||||
if (!isChannel) {
|
if (!isChannel) {
|
||||||
channelUriFromQuery = `lbry://@${query}`;
|
channelUriFromQuery = `lbry://@${query}`;
|
||||||
name = streamName;
|
name = streamName;
|
||||||
|
@ -54,6 +52,13 @@ export default function SearchTopClaim(props: Props) {
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (winningUri) {
|
||||||
|
try {
|
||||||
|
const { isChannel: winnerIsChannel } = parseURI(winningUri);
|
||||||
|
winningUriIsChannel = winnerIsChannel;
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setChannelActive && winningUriIsChannel && setChannelActive(true);
|
setChannelActive && winningUriIsChannel && setChannelActive(true);
|
||||||
}, [setChannelActive, winningUriIsChannel]);
|
}, [setChannelActive, winningUriIsChannel]);
|
||||||
|
@ -111,7 +116,11 @@ export default function SearchTopClaim(props: Props) {
|
||||||
<I18nMessage
|
<I18nMessage
|
||||||
tokens={{
|
tokens={{
|
||||||
repost: (
|
repost: (
|
||||||
<Button button="link" onClick={() => push(`/$/${PAGES.REPOST_NEW}?to=${name}`)} label={__('Repost')} />
|
<Button
|
||||||
|
button="link"
|
||||||
|
onClick={() => push(`/$/${PAGES.REPOST_NEW}${name ? `?to=${name}` : ''}`)}
|
||||||
|
label={__('Repost')}
|
||||||
|
/>
|
||||||
),
|
),
|
||||||
publish: (
|
publish: (
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -45,8 +45,18 @@ export default function SubscribeButton(props: Props) {
|
||||||
const uiNotificationsEnabled = (user && user.experimental_ui) || ENABLE_UI_NOTIFICATIONS;
|
const uiNotificationsEnabled = (user && user.experimental_ui) || ENABLE_UI_NOTIFICATIONS;
|
||||||
|
|
||||||
const { channelName: rawChannelName } = parseURI(uri);
|
const { channelName: rawChannelName } = parseURI(uri);
|
||||||
const { channelName } = parseURI(permanentUrl);
|
|
||||||
const claimName = '@' + channelName;
|
let channelName;
|
||||||
|
|
||||||
|
if (permanentUrl) {
|
||||||
|
try {
|
||||||
|
const { channelName: name } = parseURI(permanentUrl);
|
||||||
|
if (name) {
|
||||||
|
channelName = name;
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
const claimName = channelName && '@' + channelName;
|
||||||
|
|
||||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||||
const subscriptionLabel = isSubscribed
|
const subscriptionLabel = isSubscribed
|
||||||
|
@ -86,7 +96,7 @@ export default function SubscribeButton(props: Props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return permanentUrl ? (
|
return permanentUrl && claimName ? (
|
||||||
<div className="button-group">
|
<div className="button-group">
|
||||||
<Button
|
<Button
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
|
|
|
@ -231,7 +231,7 @@ function ChannelPage(props: Props) {
|
||||||
<ChannelThumbnail className="channel__thumbnail--channel-page" uri={uri} allowGifs hideStakedIndicator />
|
<ChannelThumbnail className="channel__thumbnail--channel-page" uri={uri} allowGifs hideStakedIndicator />
|
||||||
<h1 className="channel__title">
|
<h1 className="channel__title">
|
||||||
<TruncatedText lines={2} showTooltip>
|
<TruncatedText lines={2} showTooltip>
|
||||||
{title || '@' + channelName}
|
{title || (channelName && '@' + channelName)}
|
||||||
</TruncatedText>
|
</TruncatedText>
|
||||||
<ChannelStakedIndicator uri={uri} large />
|
<ChannelStakedIndicator uri={uri} large />
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -157,7 +157,7 @@ function ShowPage(props: Props) {
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
button="secondary"
|
button="secondary"
|
||||||
onClick={() => push(`/$/${PAGES.REPOST_NEW}${contentName ? `to=${contentName}` : ''}`)}
|
onClick={() => push(`/$/${PAGES.REPOST_NEW}${contentName ? `?to=${contentName}` : ''}`)}
|
||||||
label={__('Repost Something')}
|
label={__('Repost Something')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default function YoutubeSync(props: Props) {
|
||||||
function handleChannelChange(e) {
|
function handleChannelChange(e) {
|
||||||
const { value } = e.target;
|
const { value } = e.target;
|
||||||
setChannel(value);
|
setChannel(value);
|
||||||
if (!isNameValid(value, 'false')) {
|
if (!isNameValid(value)) {
|
||||||
setNameError(INVALID_NAME_ERROR);
|
setNameError(INVALID_NAME_ERROR);
|
||||||
} else {
|
} else {
|
||||||
setNameError();
|
setNameError();
|
||||||
|
|
|
@ -121,7 +121,7 @@ function handleClaimAction(state: State, action: any): State {
|
||||||
let newResolvingUrls = new Set(state.resolvingUris);
|
let newResolvingUrls = new Set(state.resolvingUris);
|
||||||
let myClaimIds = new Set(state.myClaims);
|
let myClaimIds = new Set(state.myClaims);
|
||||||
|
|
||||||
Object.entries(resolveInfo).forEach(([url, resolveResponse]: [string, ResolveResponse]) => {
|
Object.entries(resolveInfo).forEach(([url, resolveResponse]) => {
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
const { claimsInChannel, stream, channel: channelFromResolve, collection } = resolveResponse;
|
const { claimsInChannel, stream, channel: channelFromResolve, collection } = resolveResponse;
|
||||||
const channel = channelFromResolve || (stream && stream.signing_channel);
|
const channel = channelFromResolve || (stream && stream.signing_channel);
|
||||||
|
|
|
@ -99,10 +99,9 @@ export default handleActions(
|
||||||
} else {
|
} else {
|
||||||
const parsedSubscriptions = subscriptions.map((uri) => {
|
const parsedSubscriptions = subscriptions.map((uri) => {
|
||||||
const { channelName } = parseURI(uri);
|
const { channelName } = parseURI(uri);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uri,
|
uri,
|
||||||
channelName: `@${channelName}`,
|
channelName: channelName ? `@${channelName}` : '',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
newSubscriptions = parsedSubscriptions;
|
newSubscriptions = parsedSubscriptions;
|
||||||
|
|
|
@ -289,10 +289,11 @@ export function GetLinksData(
|
||||||
streamTypes: null,
|
streamTypes: null,
|
||||||
channelIds: subscribedChannels.map((subscription: Subscription) => {
|
channelIds: subscribedChannels.map((subscription: Subscription) => {
|
||||||
const { channelClaimId } = parseURI(subscription.uri);
|
const { channelClaimId } = parseURI(subscription.uri);
|
||||||
return channelClaimId;
|
if (channelClaimId) return channelClaimId;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
// $FlowFixMe flow thinks this might not be Array<string>
|
||||||
rowData.push(RECENT_FROM_FOLLOWING);
|
rowData.push(RECENT_FROM_FOLLOWING);
|
||||||
}
|
}
|
||||||
if (isHomepage && !CUSTOM_HOMEPAGE) {
|
if (isHomepage && !CUSTOM_HOMEPAGE) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// @flow
|
// Disabled flow in this copy. This copy is for uncompiled web server ES5 require()s.
|
||||||
require('proxy-polyfill');
|
require('proxy-polyfill');
|
||||||
|
|
||||||
const CHECK_DAEMON_STARTED_TRY_NUMBER = 200;
|
const CHECK_DAEMON_STARTED_TRY_NUMBER = 200;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// Disabled flow in this copy. This copy is for uncompiled web server ES5 require()s.
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production';
|
||||||
const channelNameMinLength = 1;
|
const channelNameMinLength = 1;
|
||||||
const claimIdMaxLength = 40;
|
const claimIdMaxLength = 40;
|
||||||
|
|
|
@ -79,6 +79,7 @@ let baseConfig = {
|
||||||
homepages: process.env.CUSTOM_HOMEPAGE === 'true' ? path.resolve(__dirname, 'custom/homepages/v2/index.js') : ('homepages/index.js'),
|
homepages: process.env.CUSTOM_HOMEPAGE === 'true' ? path.resolve(__dirname, 'custom/homepages/v2/index.js') : ('homepages/index.js'),
|
||||||
memes: process.env.CUSTOM_HOMEPAGE === 'true' ? path.resolve(__dirname, 'custom/homepages/meme/index.js') : path.resolve(__dirname, 'homepages/meme/index.js'),
|
memes: process.env.CUSTOM_HOMEPAGE === 'true' ? path.resolve(__dirname, 'custom/homepages/meme/index.js') : path.resolve(__dirname, 'homepages/meme/index.js'),
|
||||||
lbryinc: 'extras/lbryinc',
|
lbryinc: 'extras/lbryinc',
|
||||||
|
recsys: 'extras/recsys',
|
||||||
// Build optimizations for 'redux-persist-transform-filter'
|
// Build optimizations for 'redux-persist-transform-filter'
|
||||||
'redux-persist-transform-filter': 'redux-persist-transform-filter/index.js',
|
'redux-persist-transform-filter': 'redux-persist-transform-filter/index.js',
|
||||||
'lodash.get': 'lodash-es/get',
|
'lodash.get': 'lodash-es/get',
|
||||||
|
|
Loading…
Reference in a new issue