Skip to content

Commit

Permalink
Merge branch 'master' into account-deletion-no-useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
keikari authored Aug 31, 2023
2 parents 017859c + 8a70a51 commit 00fef51
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 5 deletions.
1 change: 1 addition & 0 deletions static/app-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2951,6 +2951,7 @@
"Remove all content from the account and forfeit credits left on the account to Odysee" : "Remove all content from the account and forfeit credits left on the account to Odysee",
"Remove content and send deletion request" : "Remove content and send deletion request",
"Remove content" : "Remove content",
"IMPORTANT: this donation is sent without a comment. If you want to include a comment, click the $ next to the comment input area.": "IMPORTANT: this donation is sent without a comment. If you want to include a comment, click the $ next to the comment input area.",

"--end--": "--end--"
}
12 changes: 9 additions & 3 deletions ui/component/comment/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
COMMENT_PAGE_SIZE_REPLIES,
LINKED_COMMENT_QUERY_PARAM,
THREAD_COMMENT_QUERY_PARAM,
THRESHOLD_MS,
} from 'constants/comment';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
import { SITE_NAME, SIMPLE_SITE, ENABLE_COMMENT_REACTIONS } from 'config';
Expand Down Expand Up @@ -155,11 +156,11 @@ function CommentView(props: Props & StateProps & DispatchProps) {
is_pinned: isPinned,
support_amount: supportAmount,
replies: numDirectReplies,
timestamp,
} = comment;
const claimName = authorTitle || author;

const timePosted = timestamp * 1000;
const timePosted = comment.timestamp * 1000;
const commentIsEdited = parseInt(comment.signing_ts) - comment.timestamp > THRESHOLD_MS.IS_EDITED / 1000;
const commentIsMine = channelId && myChannelIds && myChannelIds.includes(channelId);

const isMobile = useIsMobile();
Expand Down Expand Up @@ -380,7 +381,12 @@ function CommentView(props: Props & StateProps & DispatchProps) {
<Button
className="comment__time"
onClick={handleTimeClick}
label={<DateTime date={timePosted} timeAgo />}
label={
<>
<DateTime date={timePosted} timeAgo />
{commentIsEdited && <span className="comment__edited">{__('(edited)')}</span>}
</>
}
/>

{supportAmount > 0 && <CreditAmount isFiat={isFiat} amount={supportAmount} superChatLight size={12} />}
Expand Down
6 changes: 6 additions & 0 deletions ui/component/walletTipAmountSelector/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ function WalletTipAmountSelector(props: Props) {
(!canReceiveFiatTips
? getHelpMessage(__('Only creators that verify cash accounts can receive tips.'))
: getHelpMessage(__('Send a tip directly from your attached card.')))}
{activeTab === TAB_FIAT &&
getHelpMessage(
__(
'IMPORTANT: this donation is sent without a comment. If you want to include a comment, click the $ next to the comment input area.'
)
)}
</>
);
}
Expand Down
4 changes: 4 additions & 0 deletions ui/constants/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ export const BLOCK_LEVEL = {
ADMIN: 'admin',
};

export const THRESHOLD_MS = {
IS_EDITED: 5 * 1000,
};

export const COMMENT_PAGE_SIZE_TOP_LEVEL = 10;
export const COMMENT_PAGE_SIZE_REPLIES = 10;
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default function PaidContentOvelay(props: Props) {
icon={sdkFeeRequired ? ICONS.LBC : fiatIconToUse}
button="primary"
label={label}
requiresAuth
{...clickProps}
/>
);
Expand Down
3 changes: 2 additions & 1 deletion ui/modal/modalAffirmPurchase/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { connect } from 'react-redux';
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
import { selectPlayingUri } from 'redux/selectors/content';
import { selectInsufficientCreditsForUri, selectPlayingUri } from 'redux/selectors/content';
import { doHideModal, doAnaltyicsPurchaseEvent } from 'redux/actions/app';
import { makeSelectMetadataForUri } from 'redux/selectors/claims';
import ModalAffirmPurchase from './view';

const select = (state, props) => ({
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
metadata: makeSelectMetadataForUri(props.uri)(state),
playingUri: selectPlayingUri(state),
});
Expand Down
22 changes: 21 additions & 1 deletion ui/modal/modalAffirmPurchase/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React from 'react';
import classnames from 'classnames';
import analytics from 'analytics';
import ClaimInsufficientCredits from 'component/claimInsufficientCredits';
import FilePrice from 'component/filePrice';
import { Modal } from 'modal/modal';
import Card from 'component/common/card';
Expand All @@ -13,6 +14,7 @@ import { isURIEqual } from 'util/lbryURI';
const ANIMATION_LENGTH = 2500;

type Props = {
isInsufficientCredits: boolean,
closeModal: () => void,
loadVideo: (string, (GetResponse) => void) => void,
uri: string,
Expand All @@ -25,7 +27,17 @@ type Props = {
};

function ModalAffirmPurchase(props: Props) {
const { closeModal, loadVideo, metadata, uri, analyticsPurchaseEvent, playingUri, setPlayingUri, cancelCb } = props;
const {
isInsufficientCredits,
closeModal,
loadVideo,
metadata,
uri,
analyticsPurchaseEvent,
playingUri,
setPlayingUri,
cancelCb,
} = props;
const [success, setSuccess] = React.useState(false);
const [purchasing, setPurchasing] = React.useState(false);
const modalTitle = __('Confirm Purchase');
Expand Down Expand Up @@ -81,6 +93,14 @@ function ModalAffirmPurchase(props: Props) {
// eslint-disable-next-line react-hooks/exhaustive-deps -- on mount
}, []);

if (isInsufficientCredits) {
return (
<Modal type="card" isOpen onAborted={cancelPurchase}>
<Card title={__('Insufficient credits')} subtitle={<ClaimInsufficientCredits uri={uri} />} />
</Modal>
);
}

return (
<Modal type="card" isOpen contentLabel={modalTitle} onAborted={cancelPurchase}>
<Card
Expand Down
4 changes: 4 additions & 0 deletions ui/scss/component/_comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ $thumbnailWidthSmall: 2rem;
}
}

.comment__edited {
margin-left: var(--spacing-xxxxs);
}

.comment__menu {
align-self: flex-end;
line-height: 1;
Expand Down

0 comments on commit 00fef51

Please sign in to comment.