Allow direct linking a repost create component
This commit is contained in:
parent
e60813de03
commit
0a962b1884
3 changed files with 22 additions and 2 deletions
|
@ -19,6 +19,7 @@ type Props = {
|
||||||
disabled: ?boolean,
|
disabled: ?boolean,
|
||||||
children: ?Node,
|
children: ?Node,
|
||||||
navigate: ?string,
|
navigate: ?string,
|
||||||
|
navigateTarget?: string,
|
||||||
className: ?string,
|
className: ?string,
|
||||||
description: ?string,
|
description: ?string,
|
||||||
type: string,
|
type: string,
|
||||||
|
@ -59,6 +60,7 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
disabled,
|
disabled,
|
||||||
children,
|
children,
|
||||||
navigate,
|
navigate,
|
||||||
|
navigateTarget,
|
||||||
className,
|
className,
|
||||||
description,
|
description,
|
||||||
button,
|
button,
|
||||||
|
@ -157,7 +159,7 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
// TODO: replace the below with an outbound link tracker for matomo
|
// TODO: replace the below with an outbound link tracker for matomo
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
target={isAnInternalLink ? '' : '_blank'}
|
target={navigateTarget || (isAnInternalLink ? '' : '_blank')}
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
href={href || navigate}
|
href={href || navigate}
|
||||||
className={combinedClassName}
|
className={combinedClassName}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
|
import * as PAGES from 'constants/pages';
|
||||||
import { MINIMUM_PUBLISH_BID, INVALID_NAME_ERROR } from 'constants/claim';
|
import { MINIMUM_PUBLISH_BID, INVALID_NAME_ERROR } from 'constants/claim';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
|
@ -16,6 +17,7 @@ import HelpLink from 'component/common/help-link';
|
||||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||||
import BidHelpText from 'component/publishBid/bid-help-text';
|
import BidHelpText from 'component/publishBid/bid-help-text';
|
||||||
import Spinner from 'component/spinner';
|
import Spinner from 'component/spinner';
|
||||||
|
import { REPOST_PARAMS } from 'page/repost/view';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
doToast: ({ message: string }) => void,
|
doToast: ({ message: string }) => void,
|
||||||
|
@ -42,6 +44,7 @@ type Props = {
|
||||||
activeChannelClaim: ?ChannelClaim,
|
activeChannelClaim: ?ChannelClaim,
|
||||||
fetchingMyChannels: boolean,
|
fetchingMyChannels: boolean,
|
||||||
incognito: boolean,
|
incognito: boolean,
|
||||||
|
isRepostPage?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function RepostCreate(props: Props) {
|
function RepostCreate(props: Props) {
|
||||||
|
@ -68,6 +71,7 @@ function RepostCreate(props: Props) {
|
||||||
activeChannelClaim,
|
activeChannelClaim,
|
||||||
fetchingMyChannels,
|
fetchingMyChannels,
|
||||||
incognito,
|
incognito,
|
||||||
|
isRepostPage,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const defaultName = name || (claim && claim.name) || '';
|
const defaultName = name || (claim && claim.name) || '';
|
||||||
|
@ -290,6 +294,19 @@ function RepostCreate(props: Props) {
|
||||||
<Card
|
<Card
|
||||||
title={__('Repost')}
|
title={__('Repost')}
|
||||||
className="repost-wrapper"
|
className="repost-wrapper"
|
||||||
|
subtitle={
|
||||||
|
isRepostPage ? undefined : (
|
||||||
|
<Button
|
||||||
|
button="link"
|
||||||
|
label={__('Open Repost in new tab')}
|
||||||
|
iconRight={ICONS.EXTERNAL}
|
||||||
|
href={`/$/${PAGES.REPOST_NEW}?${REPOST_PARAMS.FROM}=${encodeURIComponent(uri)}&to=${encodeURIComponent(
|
||||||
|
enteredRepostName
|
||||||
|
)}`}
|
||||||
|
navigateTarget="_blank"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
actions={
|
actions={
|
||||||
<div>
|
<div>
|
||||||
<ChannelSelector />
|
<ChannelSelector />
|
||||||
|
|
|
@ -6,7 +6,7 @@ import RepostCreate from 'component/repostCreate';
|
||||||
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
||||||
import useThrottle from 'effects/use-throttle';
|
import useThrottle from 'effects/use-throttle';
|
||||||
|
|
||||||
const REPOST_PARAMS = {
|
export const REPOST_PARAMS = {
|
||||||
FROM: 'from',
|
FROM: 'from',
|
||||||
TO: 'to',
|
TO: 'to',
|
||||||
REDIRECT: 'redirect',
|
REDIRECT: 'redirect',
|
||||||
|
@ -67,6 +67,7 @@ function RepostPage(props: Props) {
|
||||||
contentUri={contentUri}
|
contentUri={contentUri}
|
||||||
setContentUri={setContentUri}
|
setContentUri={setContentUri}
|
||||||
setRepostUri={setRepostUri}
|
setRepostUri={setRepostUri}
|
||||||
|
isRepostPage
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in a new issue