removed remaining refs to PAGES.REPOST

This commit is contained in:
Bradley 2022-02-26 20:55:37 -06:00 committed by infinite-persistence
parent 98154a1921
commit d7506850b3
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
13 changed files with 15 additions and 179 deletions

View file

@ -1,9 +0,0 @@
import { connect } from 'react-redux';
import { doOpenModal } from 'redux/actions/app';
import ClaimRepostButton from './view';
const perform = {
doOpenModal,
};
export default connect(null, perform)(ClaimRepostButton);

View file

@ -1,32 +0,0 @@
// @flow
import * as MODALS from 'constants/modal_types';
import * as ICONS from 'constants/icons';
import React from 'react';
import classnames from 'classnames';
import Button from 'component/button';
import Tooltip from 'component/common/tooltip';
type Props = {
uri: string,
fileAction?: boolean,
doOpenModal: (string, {}) => void,
};
export default function ClaimRepostButton(props: Props) {
const { uri, fileAction, doOpenModal } = props;
console.log('uri', uri);
return (
<Tooltip title={__('Repost this claim')} arrow={false}>
<Button
button={!fileAction ? 'alt' : undefined}
className={classnames({ 'button--file-action': fileAction })}
icon={ICONS.REPOST}
iconSize={fileAction ? 22 : undefined}
label={__('Repost')}
onClick={() => doOpenModal(MODALS.REPOST, { uri })}
/>
</Tooltip>
);
}

View file

@ -8,7 +8,7 @@ import {
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info'; import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
import { doEditForChannel } from 'redux/actions/publish'; import { doEditForChannel } from 'redux/actions/publish';
import { selectCostInfoForUri } from 'lbryinc'; import { selectCostInfoForUri } from 'lbryinc';
import { doClearPlayingUri, doDownloadUri } from 'redux/actions/content'; import { doDownloadUri } from 'redux/actions/content';
import { doToast } from 'redux/actions/notifications'; import { doToast } from 'redux/actions/notifications';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import FileActions from './view'; import FileActions from './view';
@ -36,7 +36,6 @@ const select = (state, props) => {
const perform = { const perform = {
doOpenModal, doOpenModal,
doEditForChannel, doEditForChannel,
doClearPlayingUri,
doToast, doToast,
doDownloadUri, doDownloadUri,
}; };

View file

@ -11,7 +11,6 @@ import * as COLLECTIONS_CONSTS from 'constants/collections';
import * as RENDER_MODES from 'constants/file_render_modes'; import * as RENDER_MODES from 'constants/file_render_modes';
import ClaimSupportButton from 'component/claimSupportButton'; import ClaimSupportButton from 'component/claimSupportButton';
import ClaimCollectionAddButton from 'component/claimCollectionAddButton'; import ClaimCollectionAddButton from 'component/claimCollectionAddButton';
import ClaimRepostButton from 'component/claimRepostButton';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import FileReactions from 'component/fileReactions'; import FileReactions from 'component/fileReactions';
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button'; import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
@ -33,7 +32,6 @@ type Props = {
disableDownloadButton: boolean, disableDownloadButton: boolean,
doOpenModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void, doOpenModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void,
doEditForChannel: (claim: Claim, uri: string) => void, doEditForChannel: (claim: Claim, uri: string) => void,
doClearPlayingUri: () => void,
doToast: (data: { message: string }) => void, doToast: (data: { message: string }) => void,
doDownloadUri: (uri: string) => void, doDownloadUri: (uri: string) => void,
}; };
@ -52,14 +50,13 @@ export default function FileActions(props: Props) {
disableDownloadButton, disableDownloadButton,
doOpenModal, doOpenModal,
doEditForChannel, doEditForChannel,
doClearPlayingUri,
doToast, doToast,
doDownloadUri, doDownloadUri,
} = props; } = props;
const { const {
push, push,
location: { pathname, search }, location: { search },
} = useHistory(); } = useHistory();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
@ -103,16 +100,15 @@ export default function FileActions(props: Props) {
} }
}, [downloadClicked, streamingUrl, fileName]); }, [downloadClicked, streamingUrl, fileName]);
// TODO: don't want to redirect. need to instead show modal
function handleRepostClick() { function handleRepostClick() {
if (!hasChannels) { if (!hasChannels) {
doClearPlayingUri();
push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`);
doToast({ message: __('A channel is required to repost on %SITE_NAME%', { SITE_NAME }) }); doToast({ message: __('A channel is required to repost on %SITE_NAME%', { SITE_NAME }) });
} else { return;
push(`/$/${PAGES.REPOST_NEW}?from=${encodeURIComponent(uri)}&redirect=${encodeURIComponent(pathname)}`);
} }
doOpenModal(MODALS.REPOST, { uri });
} }
return ( return (
<div className="media__actions"> <div className="media__actions">
{ENABLE_FILE_REACTIONS && <FileReactions uri={uri} />} {ENABLE_FILE_REACTIONS && <FileReactions uri={uri} />}
@ -121,9 +117,7 @@ export default function FileActions(props: Props) {
<ClaimCollectionAddButton uri={uri} fileAction /> <ClaimCollectionAddButton uri={uri} fileAction />
<ClaimRepostButton uri={uri} pathname={pathname} fileAction /> {!hideRepost && !isMobile && !isLivestreamClaim && (
{/* {!hideRepost && !isMobile && !isLivestreamClaim && (
<Tooltip title={__('Repost')} arrow={false}> <Tooltip title={__('Repost')} arrow={false}>
<Button <Button
button="alt" button="alt"
@ -136,7 +130,7 @@ export default function FileActions(props: Props) {
onClick={handleRepostClick} onClick={handleRepostClick}
/> />
</Tooltip> </Tooltip>
)} */} )}
<Tooltip title={__('Share')} arrow={false}> <Tooltip title={__('Share')} arrow={false}>
<Button <Button

View file

@ -252,28 +252,6 @@ function RepostCreate(props: Props) {
const repostClaimId = contentClaimId || enteredClaimId; const repostClaimId = contentClaimId || enteredClaimId;
// const getRedirect = (entered, passed, redirect) => {
// if (redirect) {
// return redirect;
// } else if (entered) {
// try {
// const { claimName } = parseURI(entered);
// return claimName ? `/${claimName}` : '/';
// } catch (e) {
// return '/';
// }
// } else if (passed) {
// try {
// const { claimName } = parseURI(passed);
// return claimName ? `/${claimName}` : '/';
// } catch (e) {
// return '/';
// }
// } else {
// return '/';
// }
// };
function handleSubmit() { function handleSubmit() {
if (enteredRepostName && repostBid && repostClaimId) { if (enteredRepostName && repostBid && repostClaimId) {
doRepost({ doRepost({

View file

@ -83,7 +83,6 @@ const PasswordSetPage = lazyImport(() => import('page/passwordSet' /* webpackChu
const PublishPage = lazyImport(() => import('page/publish' /* webpackChunkName: "publish" */)); const PublishPage = lazyImport(() => import('page/publish' /* webpackChunkName: "publish" */));
const ReportContentPage = lazyImport(() => import('page/reportContent' /* webpackChunkName: "reportContent" */)); const ReportContentPage = lazyImport(() => import('page/reportContent' /* webpackChunkName: "reportContent" */));
const ReportPage = lazyImport(() => import('page/report' /* webpackChunkName: "report" */)); const ReportPage = lazyImport(() => import('page/report' /* webpackChunkName: "report" */));
const RepostNew = lazyImport(() => import('page/repost' /* webpackChunkName: "repost" */));
const RewardsPage = lazyImport(() => import('page/rewards' /* webpackChunkName: "rewards" */)); const RewardsPage = lazyImport(() => import('page/rewards' /* webpackChunkName: "rewards" */));
const RewardsVerifyPage = lazyImport(() => import('page/rewardsVerify' /* webpackChunkName: "rewardsVerify" */)); const RewardsVerifyPage = lazyImport(() => import('page/rewardsVerify' /* webpackChunkName: "rewardsVerify" */));
const SearchPage = lazyImport(() => import('page/search' /* webpackChunkName: "search" */)); const SearchPage = lazyImport(() => import('page/search' /* webpackChunkName: "search" */));
@ -347,7 +346,6 @@ function AppRouter(props: Props) {
/> />
<PrivateRoute {...props} path={`/$/${PAGES.INVITE}`} component={InvitePage} /> <PrivateRoute {...props} path={`/$/${PAGES.INVITE}`} component={InvitePage} />
<PrivateRoute {...props} path={`/$/${PAGES.CHANNEL_NEW}`} component={ChannelNew} /> <PrivateRoute {...props} path={`/$/${PAGES.CHANNEL_NEW}`} component={ChannelNew} />
<PrivateRoute {...props} path={`/$/${PAGES.REPOST_NEW}`} component={RepostNew} />
<PrivateRoute {...props} path={`/$/${PAGES.UPLOADS}`} component={FileListPublished} /> <PrivateRoute {...props} path={`/$/${PAGES.UPLOADS}`} component={FileListPublished} />
<PrivateRoute {...props} path={`/$/${PAGES.CREATOR_DASHBOARD}`} component={CreatorDashboard} /> <PrivateRoute {...props} path={`/$/${PAGES.CREATOR_DASHBOARD}`} component={CreatorDashboard} />
<PrivateRoute {...props} path={`/$/${PAGES.UPLOAD}`} component={PublishPage} /> <PrivateRoute {...props} path={`/$/${PAGES.UPLOAD}`} component={PublishPage} />

View file

@ -48,7 +48,6 @@ export const PAGE_TITLE = {
[PAGES.RECEIVE]: 'Your address', [PAGES.RECEIVE]: 'Your address',
[PAGES.REPORT]: 'Report an issue or request a feature', [PAGES.REPORT]: 'Report an issue or request a feature',
[PAGES.REPORT_CONTENT]: 'Report content', [PAGES.REPORT_CONTENT]: 'Report content',
[PAGES.REPOST_NEW]: 'Repost',
[PAGES.REWARDS]: 'Rewards', [PAGES.REWARDS]: 'Rewards',
[PAGES.REWARDS_VERIFY]: 'Verify to earn Credits', [PAGES.REWARDS_VERIFY]: 'Verify to earn Credits',
[PAGES.SEARCH]: 'Search', [PAGES.SEARCH]: 'Search',

View file

@ -45,7 +45,6 @@ exports.REPORT = 'report';
exports.REPORT_CONTENT = 'report_content'; exports.REPORT_CONTENT = 'report_content';
exports.REWARDS = 'rewards'; exports.REWARDS = 'rewards';
exports.REWARDS_VERIFY = 'rewards/verify'; exports.REWARDS_VERIFY = 'rewards/verify';
exports.REPOST_NEW = 'repost';
exports.SEND = 'send'; exports.SEND = 'send';
exports.SETTINGS = 'settings'; exports.SETTINGS = 'settings';
exports.SETTINGS_STRIPE_CARD = 'settings/card'; exports.SETTINGS_STRIPE_CARD = 'settings/card';

View file

@ -1,15 +0,0 @@
import { connect } from 'react-redux';
import { doResolveUri } from 'redux/actions/claims';
import { selectBalance } from 'redux/selectors/wallet';
import RepostPage from './view';
const select = (state, props) => ({
balance: selectBalance(state),
});
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
});
export default connect(select, perform)(RepostPage);

View file

@ -1,77 +0,0 @@
// @flow
import React from 'react';
import Page from 'component/page';
import { useHistory } from 'react-router';
import RepostCreate from 'component/repostCreate';
import YrblWalletEmpty from 'component/yrblWalletEmpty';
import useThrottle from 'effects/use-throttle';
import classnames from 'classnames';
type Props = {
balance: number,
resolveUri: string => void,
};
function RepostPage(props: Props) {
const { balance, resolveUri } = props;
const REPOST_FROM = 'from';
const REPOST_TO = 'to';
const REDIRECT = 'redirect';
const {
location: { search },
} = useHistory();
const urlParams = new URLSearchParams(search);
const repostFrom = urlParams.get(REPOST_FROM);
const redirectUri = urlParams.get(REDIRECT);
const repostTo = urlParams.get(REPOST_TO);
const [contentUri, setContentUri] = React.useState('');
const [repostUri, setRepostUri] = React.useState('');
const throttledContentValue = useThrottle(contentUri, 500);
const throttledRepostValue = useThrottle(repostUri, 500);
React.useEffect(() => {
if (throttledContentValue) {
resolveUri(throttledContentValue);
}
}, [throttledContentValue, resolveUri]);
React.useEffect(() => {
if (throttledRepostValue) {
resolveUri(throttledRepostValue);
}
}, [throttledRepostValue, resolveUri]);
React.useEffect(() => {
if (repostTo) {
resolveUri(repostTo);
}
}, [repostTo, resolveUri]);
const decodedFrom = repostFrom && decodeURIComponent(repostFrom);
return (
<Page
noFooter
noSideNavigation
backout={{
title: __('Repost'),
backLabel: __('Back'),
}}
>
{balance === 0 && <YrblWalletEmpty />}
<div className={classnames({ 'card--disabled': balance === 0 })}>
<RepostCreate
uri={decodedFrom}
name={repostTo}
redirectUri={redirectUri}
repostUri={repostUri}
contentUri={contentUri}
setContentUri={setContentUri}
setRepostUri={setRepostUri}
/>
</div>
</Page>
);
}
export default RepostPage;

View file

@ -16,6 +16,7 @@ import {
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { doResolveUri } from 'redux/actions/claims'; import { doResolveUri } from 'redux/actions/claims';
import { doBeginPublish } from 'redux/actions/publish'; import { doBeginPublish } from 'redux/actions/publish';
import { doOpenModal } from 'redux/actions/app';
import { doFetchItemsInCollection } from 'redux/actions/collections'; import { doFetchItemsInCollection } from 'redux/actions/collections';
import { isStreamPlaceholderClaim } from 'util/claim'; import { isStreamPlaceholderClaim } from 'util/claim';
import { normalizeURI } from 'util/lbryURI'; import { normalizeURI } from 'util/lbryURI';
@ -91,6 +92,7 @@ const perform = {
doResolveUri, doResolveUri,
doBeginPublish, doBeginPublish,
doFetchItemsInCollection, doFetchItemsInCollection,
doOpenModal,
}; };
export default withRouter(connect(select, perform)(ShowPage)); export default withRouter(connect(select, perform)(ShowPage));

View file

@ -1,9 +1,8 @@
// @flow // @flow
import { DOMAIN, ENABLE_NO_SOURCE_CLAIMS } from 'config'; import { DOMAIN, ENABLE_NO_SOURCE_CLAIMS } from 'config';
import * as PAGES from 'constants/pages';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { lazyImport } from 'util/lazyImport'; import { lazyImport } from 'util/lazyImport';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import ChannelPage from 'page/channel'; import ChannelPage from 'page/channel';
import Page from 'component/page'; import Page from 'component/page';
@ -13,6 +12,7 @@ import Yrbl from 'component/yrbl';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
import { parseURI } from 'util/lbryURI'; import { parseURI } from 'util/lbryURI';
import * as COLLECTIONS_CONSTS from 'constants/collections'; import * as COLLECTIONS_CONSTS from 'constants/collections';
import * as MODALS from 'constants/modal_types';
const AbandonedChannelPreview = lazyImport(() => const AbandonedChannelPreview = lazyImport(() =>
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */) import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
@ -40,6 +40,7 @@ type Props = {
doResolveUri: (uri: string, returnCached: boolean, resolveReposts: boolean, options: any) => void, doResolveUri: (uri: string, returnCached: boolean, resolveReposts: boolean, options: any) => void,
doBeginPublish: (name: ?string) => void, doBeginPublish: (name: ?string) => void,
doFetchItemsInCollection: ({ collectionId: string }) => void, doFetchItemsInCollection: ({ collectionId: string }) => void,
doOpenModal: (string, {}) => void,
}; };
export default function ShowPage(props: Props) { export default function ShowPage(props: Props) {
@ -62,9 +63,9 @@ export default function ShowPage(props: Props) {
doResolveUri, doResolveUri,
doBeginPublish, doBeginPublish,
doFetchItemsInCollection, doFetchItemsInCollection,
doOpenModal,
} = props; } = props;
const { push } = useHistory();
const { search, pathname, hash } = location; const { search, pathname, hash } = location;
const urlParams = new URLSearchParams(search); const urlParams = new URLSearchParams(search);
const linkedCommentId = urlParams.get('lc'); const linkedCommentId = urlParams.get('lc');
@ -190,8 +191,8 @@ export default function ShowPage(props: Props) {
/> />
<Button <Button
button="secondary" button="secondary"
onClick={() => push(`/$/${PAGES.REPOST_NEW}${contentName ? `?to=${contentName}` : ''}`)}
label={__('Repost Something')} label={__('Repost Something')}
onClick={() => doOpenModal(MODALS.REPOST, {})}
/> />
</div> </div>
) )

View file

@ -31,7 +31,6 @@ function TopPage(props: Props) {
streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined} streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined}
meta={ meta={
<div className="search__top-links"> <div className="search__top-links">
{/* <Button button="secondary" navigate={`/$/${PAGES.REPOST_NEW}?to=${queryName}`} label={__('Repost Here')} /> */}
<Button button="secondary" onClick={() => doOpenModal(MODALS.REPOST, {})} label={__('Repost Here')} /> <Button button="secondary" onClick={() => doOpenModal(MODALS.REPOST, {})} label={__('Repost Here')} />
<Button button="secondary" onClick={() => beginPublish(queryName)} label={__('Publish Here')} /> <Button button="secondary" onClick={() => beginPublish(queryName)} label={__('Publish Here')} />
</div> </div>