Fix edit redirects on file pages

This commit is contained in:
Raphael Wickihalder 2022-07-13 21:33:09 +02:00
parent a56ddecc0f
commit f97f3b380b
No known key found for this signature in database
GPG key ID: 05179BB92383243D
2 changed files with 8 additions and 10 deletions

View file

@ -1,21 +1,20 @@
// @flow
import * as PAGES from 'constants/pages';
import * as ICONS from 'constants/icons';
import { buildURI } from 'util/lbryURI';
import React from 'react';
import FileActionButton from 'component/common/file-action-button';
type Props = {
isLivestreamClaim: boolean,
claimType: string,
// redux
claim: ?Claim,
channelName: ?string,
claimIsMine: boolean,
doPrepareEdit: (claim: Claim, uri: string) => void,
doPrepareEdit: (claim: Claim, uri: string, claimType: string) => void,
};
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
// 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 (
<FileActionButton
title={isLivestreamClaim ? __('Update or Publish Replay') : __('Edit')}
label={isLivestreamClaim ? __('Update or Publish Replay') : __('Edit')}
title={claimType === 'livestream' ? __('Update or Publish Replay') : __('Edit')}
label={claimType === 'livestream' ? __('Update or Publish Replay') : __('Edit')}
icon={ICONS.EDIT}
navigate={`/$/${PAGES.UPLOAD}`}
onClick={!claim ? undefined : () => doPrepareEdit(claim, editUri)}
onClick={!claim ? undefined : () => doPrepareEdit(claim, editUri, claimType)}
/>
);
}

View file

@ -131,7 +131,7 @@ export default function FileActions(props: Props) {
{claimIsMine && !isMobile && (
<>
<ClaimPublishButton uri={uri} isLivestreamClaim={isLivestreamClaim} />
<ClaimPublishButton uri={uri} claimType={claimType} />
<ClaimDeleteButton uri={uri} />
</>
)}
@ -168,7 +168,7 @@ export default function FileActions(props: Props) {
className="comment__menu-option"
onSelect={() => {
doPrepareEdit(claim, editUri, claimType);
push(`/$/${PAGES.UPLOAD}`);
// push(`/$/${PAGES.UPLOAD}`);
}}
>
<div className="menu__link">