hide some file page buttons with SIMPLE_SITE flag

This commit is contained in:
Sean Yesmunt 2020-07-24 14:00:17 -04:00
parent 5ea87b76c9
commit e10647b5a2
5 changed files with 52 additions and 26 deletions

View file

@ -22,7 +22,7 @@ const config = {
SITE_CANONICAL_URL: process.env.SITE_CANONICAL_URL,
DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE,
AUTO_FOLLOW_CHANNELS: process.env.AUTO_FOLLOW_CHANNELS,
SIMPLE_SITE: process.env.SIMPLE_SITE === 'false',
SIMPLE_SITE: process.env.SIMPLE_SITE === 'true',
PINNED_URI_1: process.env.PINNED_URI_1,
PINNED_LABEL_1: process.env.PINNED_LABEL_1,
PINNED_URI_2: process.env.PINNED_URI_2,

View file

@ -6,9 +6,19 @@ import Button from 'component/button';
type Props = {
href?: string,
navigate?: string,
icon?: string,
description?: string,
};
export default function HelpLink(props: Props) {
const { href, navigate } = props;
return <Button className="icon--help" icon={ICONS.HELP} description={__('Help')} href={href} navigate={navigate} />;
const { href, navigate, icon, description } = props;
return (
<Button
className="icon--help"
icon={icon || ICONS.HELP}
description={description || __('Help')}
href={href}
navigate={navigate}
/>
);
}

View file

@ -1,5 +1,6 @@
// @flow
import type { Node } from 'react';
import { SIMPLE_SITE } from 'config';
import * as PAGES from 'constants/pages';
import * as CS from 'constants/claim_search';
import * as MODALS from 'constants/modal_types';
@ -64,28 +65,30 @@ function FileActions(props: Props) {
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })}
/>
<div className="button-group">
<Button
button="alt"
icon={ICONS.REPOST}
label={__('Repost')}
requiresAuth={IS_WEB}
onClick={() => openModal(MODALS.REPOST, { uri })}
/>
{claim.meta.reposted > 0 && (
{!SIMPLE_SITE && (
<div className="button-group">
<Button
button="alt"
label={claim.meta.reposted}
icon={ICONS.REPOST}
label={__('Repost')}
requiresAuth={IS_WEB}
navigate={`/$/${PAGES.DISCOVER}?${CS.REPOSTED_URI_KEY}=${encodeURIComponent(uri)}`}
onClick={() => openModal(MODALS.REPOST, { uri })}
/>
)}
</div>
{claim.meta.reposted > 0 && (
<Button
button="alt"
label={claim.meta.reposted}
requiresAuth={IS_WEB}
navigate={`/$/${PAGES.DISCOVER}?${CS.REPOSTED_URI_KEY}=${encodeURIComponent(uri)}`}
/>
)}
</div>
)}
<ClaimSupportButton uri={uri} />
</ActionWrapper>
<ActionWrapper>
<FileDownloadLink uri={uri} />
{!SIMPLE_SITE && <FileDownloadLink uri={uri} />}
{claimIsMine && (
<Button
@ -108,7 +111,7 @@ function FileActions(props: Props) {
onClick={() => openModal(MODALS.CONFIRM_FILE_REMOVE, { uri })}
/>
)}
{!claimIsMine && (
{!claimIsMine && !SIMPLE_SITE && (
<Button
title={__('Report content')}
button="alt"

View file

@ -1,9 +1,10 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri, makeSelectPendingAmountByUri } from 'lbry-redux';
import { makeSelectClaimForUri, makeSelectPendingAmountByUri, makeSelectClaimIsMine } from 'lbry-redux';
import FileSubtitle from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
});
export default connect(select)(FileSubtitle);

View file

@ -1,29 +1,41 @@
// @flow
import { SIMPLE_SITE } from 'config';
import * as ICONS from 'constants/icons';
import React from 'react';
import DateTime from 'component/dateTime';
import FileViewCount from 'component/fileViewCount';
import CreditAmount from 'component/common/credit-amount';
import HelpLink from 'component/common/help-link';
type Props = {
uri: string,
claim: StreamClaim,
pendingAmount: string,
claimIsMine: boolean,
};
function FileSubtitle(props: Props) {
const { uri, claim, pendingAmount } = props;
const { uri, claim, pendingAmount, claimIsMine } = props;
const claimId = claim && claim.claim_id;
return (
<div className="media__subtitle--between">
<DateTime uri={uri} show={DateTime.SHOW_DATE} />
<span>
<CreditAmount
badge={false}
amount={parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount)}
precision={2}
/>
{' • ' /* this is bad, but it's quick! */}
{!SIMPLE_SITE && (
<>
<CreditAmount
badge={false}
amount={parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount)}
precision={2}
/>
{' • ' /* this is bad, but it's quick! */}
</>
)}
<FileViewCount uri={uri} />
{claimId && !claimIsMine && SIMPLE_SITE && (
<HelpLink description={__('Report content')} icon={ICONS.REPORT} href={`https://lbry.com/dmca/${claimId}`} />
)}
</span>
</div>
);