mirror of
https://github.com/wassname/talk.git
synced 2026-08-06 13:41:02 +08:00
[CORL-1033] don't show view conversation link if callback is not defined (#2934)
* don't show view conversation link if callback is not defined * remove unnecessary callback
This commit is contained in:
@@ -59,7 +59,7 @@ interface Props {
|
||||
onReject: () => void;
|
||||
onFeature: () => void;
|
||||
onUsernameClick: (id?: string) => void;
|
||||
onConversationClick: (id?: string) => void;
|
||||
onConversationClick: (() => void) | null;
|
||||
onFocusOrClick: () => void;
|
||||
mini?: boolean;
|
||||
hideUsername?: boolean;
|
||||
@@ -168,9 +168,6 @@ const ModerateCard: FunctionComponent<Props> = ({
|
||||
onUsernameClick(inReplyTo.id);
|
||||
}
|
||||
}, [onUsernameClick, inReplyTo]);
|
||||
const viewConversationClick = useCallback(() => {
|
||||
onConversationClick();
|
||||
}, [onConversationClick]);
|
||||
return (
|
||||
<Card
|
||||
className={cn(
|
||||
@@ -231,14 +228,16 @@ const ModerateCard: FunctionComponent<Props> = ({
|
||||
>
|
||||
{commentBody}
|
||||
</CommentContent>
|
||||
<div className={styles.viewContext}>
|
||||
<Button iconLeft variant="text" onClick={viewConversationClick}>
|
||||
<ButtonIcon>question_answer</ButtonIcon>
|
||||
<Localized id="moderate-comment-viewConversation">
|
||||
<span>View conversation</span>
|
||||
</Localized>
|
||||
</Button>
|
||||
</div>
|
||||
{onConversationClick && (
|
||||
<div className={styles.viewContext}>
|
||||
<Button iconLeft variant="text" onClick={onConversationClick}>
|
||||
<ButtonIcon>question_answer</ButtonIcon>
|
||||
<Localized id="moderate-comment-viewConversation">
|
||||
<span>View conversation</span>
|
||||
</Localized>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={cn(styles.separator, {
|
||||
[styles.ruledSeparator]: !mini,
|
||||
|
||||
@@ -162,15 +162,12 @@ const ModerateCardContainer: FunctionComponent<Props> = ({
|
||||
[usernameClicked, comment]
|
||||
);
|
||||
|
||||
const onConversationClicked = useCallback(
|
||||
(id?: string) => {
|
||||
if (!conversationClicked) {
|
||||
return;
|
||||
}
|
||||
conversationClicked(id || comment.id);
|
||||
},
|
||||
[conversationClicked, comment]
|
||||
);
|
||||
const onConversationClicked = useCallback(() => {
|
||||
if (!conversationClicked) {
|
||||
return;
|
||||
}
|
||||
conversationClicked(comment.id);
|
||||
}, [conversationClicked, comment]);
|
||||
|
||||
const handleModerateStory = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
@@ -250,7 +247,9 @@ const ModerateCardContainer: FunctionComponent<Props> = ({
|
||||
onReject={handleReject}
|
||||
onFeature={onFeature}
|
||||
onUsernameClick={onUsernameClicked}
|
||||
onConversationClick={onConversationClicked}
|
||||
onConversationClick={
|
||||
conversationClicked ? onConversationClicked : null
|
||||
}
|
||||
selected={selected}
|
||||
selectPrev={selectPrev}
|
||||
selectNext={selectNext}
|
||||
|
||||
Reference in New Issue
Block a user