Fix edit redirects on file pages
This commit is contained in:
parent
a56ddecc0f
commit
f97f3b380b
2 changed files with 8 additions and 10 deletions
|
@ -1,21 +1,20 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as PAGES from 'constants/pages';
|
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import { buildURI } from 'util/lbryURI';
|
import { buildURI } from 'util/lbryURI';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FileActionButton from 'component/common/file-action-button';
|
import FileActionButton from 'component/common/file-action-button';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isLivestreamClaim: boolean,
|
claimType: string,
|
||||||
// redux
|
// redux
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
channelName: ?string,
|
channelName: ?string,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
doPrepareEdit: (claim: Claim, uri: string) => void,
|
doPrepareEdit: (claim: Claim, uri: string, claimType: string) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ClaimPublishButton(props: Props) {
|
function ClaimPublishButton(props: Props) {
|
||||||
const { isLivestreamClaim, claim, channelName, claimIsMine, doPrepareEdit } = props;
|
const { claimType, claim, channelName, claimIsMine, doPrepareEdit } = props;
|
||||||
|
|
||||||
// We want to use the short form uri for editing
|
// We want to use the short form uri for editing
|
||||||
// This is what the user is used to seeing, they don't care about the claim id
|
// This is what the user is used to seeing, they don't care about the claim id
|
||||||
|
@ -34,11 +33,10 @@ function ClaimPublishButton(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FileActionButton
|
<FileActionButton
|
||||||
title={isLivestreamClaim ? __('Update or Publish Replay') : __('Edit')}
|
title={claimType === 'livestream' ? __('Update or Publish Replay') : __('Edit')}
|
||||||
label={isLivestreamClaim ? __('Update or Publish Replay') : __('Edit')}
|
label={claimType === 'livestream' ? __('Update or Publish Replay') : __('Edit')}
|
||||||
icon={ICONS.EDIT}
|
icon={ICONS.EDIT}
|
||||||
navigate={`/$/${PAGES.UPLOAD}`}
|
onClick={!claim ? undefined : () => doPrepareEdit(claim, editUri, claimType)}
|
||||||
onClick={!claim ? undefined : () => doPrepareEdit(claim, editUri)}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ export default function FileActions(props: Props) {
|
||||||
|
|
||||||
{claimIsMine && !isMobile && (
|
{claimIsMine && !isMobile && (
|
||||||
<>
|
<>
|
||||||
<ClaimPublishButton uri={uri} isLivestreamClaim={isLivestreamClaim} />
|
<ClaimPublishButton uri={uri} claimType={claimType} />
|
||||||
<ClaimDeleteButton uri={uri} />
|
<ClaimDeleteButton uri={uri} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -168,7 +168,7 @@ export default function FileActions(props: Props) {
|
||||||
className="comment__menu-option"
|
className="comment__menu-option"
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
doPrepareEdit(claim, editUri, claimType);
|
doPrepareEdit(claim, editUri, claimType);
|
||||||
push(`/$/${PAGES.UPLOAD}`);
|
// push(`/$/${PAGES.UPLOAD}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="menu__link">
|
<div className="menu__link">
|
||||||
|
|
Loading…
Reference in a new issue