final code touches

This commit is contained in:
saltrafael 2021-06-12 10:46:04 -03:00 committed by jessopb
parent d553c1170e
commit 6629ea6041
2 changed files with 25 additions and 25 deletions

View file

@ -82,7 +82,7 @@ function ClaimMenuList(props: Props) {
} = props; } = props;
const incognito = channelUri && !(channelUri.includes('@')); const incognito = channelUri && !(channelUri.includes('@'));
const signingChannel = claim && (claim.signing_channel || claim); const signingChannel = claim && (claim.signing_channel || claim);
const permanentUrl = String(signingChannel && signingChannel.permanent_url); const permanentUrl = String(channelUri);
const isChannel = !incognito && signingChannel === claim; const isChannel = !incognito && signingChannel === claim;
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0)); const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow'); const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow');
@ -138,7 +138,6 @@ function ClaimMenuList(props: Props) {
if (!isChannel) { if (!isChannel) {
const signingChannelName = signingChannel && signingChannel.name; const signingChannelName = signingChannel && signingChannel.name;
let editUri;
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = { const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
streamName: claim.name, streamName: claim.name,
streamClaimId: claim.claim_id, streamClaimId: claim.claim_id,
@ -146,7 +145,7 @@ function ClaimMenuList(props: Props) {
if (signingChannelName) { if (signingChannelName) {
uriObject.channelName = signingChannelName; uriObject.channelName = signingChannelName;
} }
editUri = buildURI(uriObject); const editUri = buildURI(uriObject);
push(`/$/${PAGES.UPLOAD}`); push(`/$/${PAGES.UPLOAD}`);
prepareEdit(claim, editUri, fileInfo); prepareEdit(claim, editUri, fileInfo);
@ -160,7 +159,7 @@ function ClaimMenuList(props: Props) {
if (!isRepost && !isChannel) { if (!isRepost && !isChannel) {
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri }); openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
} else { } else {
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)), isRepost }); openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)) });
} }
} }
@ -189,14 +188,14 @@ function ClaimMenuList(props: Props) {
</MenuButton> </MenuButton>
<MenuList className="menu__list"> <MenuList className="menu__list">
{!incognito && (!claimIsMine ? (!isChannelPage && {!incognito && !isRepost && (!claimIsMine ? (!isChannelPage &&
<MenuItem className="comment__menu-option" onSelect={handleFollow}> <MenuItem className="comment__menu-option" onSelect={handleFollow}>
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={ICONS.SUBSCRIBE} /> <Icon aria-hidden icon={ICONS.SUBSCRIBE} />
{subscriptionLabel} {subscriptionLabel}
</div> </div>
</MenuItem> </MenuItem>
) : (!isRepost && ) : (
<MenuItem className="comment__menu-option" onSelect={handleAnalytics}> <MenuItem className="comment__menu-option" onSelect={handleAnalytics}>
<div className="menu__link"> <div className="menu__link">
<Icon aria-hidden icon={ICONS.ANALYTICS} /> <Icon aria-hidden icon={ICONS.ANALYTICS} />
@ -205,15 +204,6 @@ function ClaimMenuList(props: Props) {
</MenuItem> </MenuItem>
))} ))}
{!isChannelPage && (
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.LBC} />
{__('Support')}
</div>
</MenuItem>
)}
{hasExperimentalUi && ( {hasExperimentalUi && (
<> <>
{/* WATCH LATER */} {/* WATCH LATER */}
@ -273,15 +263,25 @@ function ClaimMenuList(props: Props) {
</div> </div>
</MenuItem> </MenuItem>
)} )}
{!isChannelPage && ( </>
<hr className="menu__separator" /> )}
)}
{!isChannelPage && (
<>
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.LBC} />
{__('Support')}
</div>
</MenuItem>
<hr className="menu__separator" />
</> </>
)} )}
{!isMyCollection && ( {!isMyCollection && (
<> <>
{(!claimIsMine || channelIsBlocked) && channelUri ? !incognito && ( {(!claimIsMine || channelIsBlocked) && channelUri
? !incognito && !isRepost && (
<> <>
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}> <MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
<div className="menu__link"> <div className="menu__link">
@ -318,7 +318,9 @@ function ClaimMenuList(props: Props) {
)} )}
</> </>
)} )}
<hr className="menu__separator" /> {!isRepost && (
<hr className="menu__separator" />
)}
</> </>
)} )}

View file

@ -15,17 +15,15 @@ type Props = {
tx: Txo, tx: Txo,
claim: GenericClaim, claim: GenericClaim,
cb: () => void, cb: () => void,
isRepost: boolean,
}; };
export default function ModalRevokeClaim(props: Props) { export default function ModalRevokeClaim(props: Props) {
const { tx, claim, closeModal, abandonTxo, abandonClaim, cb, isRepost } = props; const { tx, claim, closeModal, abandonTxo, abandonClaim, cb } = props;
const { value_type: valueType, type, normalized_name: name, is_my_input: isSupport } = tx || claim; const { value_type: valueType, type, normalized_name: name, is_my_input: isSupport } = tx || claim;
const [channelName, setChannelName] = useState(''); const [channelName, setChannelName] = useState('');
const shouldConfirmChannel = !isRepost && ( const shouldConfirmChannel =
valueType === txnTypes.CHANNEL || type === txnTypes.CHANNEL || (type === txnTypes.UPDATE && name.startsWith('@')) valueType === txnTypes.CHANNEL || type === txnTypes.CHANNEL || (type === txnTypes.UPDATE && name.startsWith('@'));
);
function getButtonLabel(type: string, isSupport: boolean) { function getButtonLabel(type: string, isSupport: boolean) {
if (isSupport && type === txnTypes.SUPPORT) { if (isSupport && type === txnTypes.SUPPORT) {