Fix #6356 Clicking tasks on My Tasks should open up the task details (#6399)

This commit is contained in:
Sachin Chaurasiya 2022-07-28 15:13:33 +05:30 committed by GitHub
parent 92597fc265
commit dd3d4cb926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 13 deletions

View File

@ -138,7 +138,10 @@ const FeedCardHeader: FC<FeedHeaderProp> = ({
<UserPopOverCard userName={createdBy}> <UserPopOverCard userName={createdBy}>
<span <span
className="thread-author tw-cursor-pointer" className="thread-author tw-cursor-pointer"
onClick={() => onTitleClickHandler(createdBy)}> onClick={(e) => {
e.stopPropagation();
onTitleClickHandler(createdBy);
}}>
{createdBy} {createdBy}
</span> </span>
</UserPopOverCard> </UserPopOverCard>

View File

@ -62,12 +62,14 @@ const PopoverContent: FC<Props> = ({
const deleteButtonCheck = const deleteButtonCheck =
threadId && postId && onConfirmation && isAuthor && !isThread; threadId && postId && onConfirmation && isAuthor && !isThread;
const handleDelete = () => { const handleDelete = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
onConfirmation && onConfirmation({ state: true, postId: postId, threadId }); onConfirmation && onConfirmation({ state: true, postId: postId, threadId });
onPopoverHide(); onPopoverHide();
}; };
const handleReply = () => { const handleReply = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
onReply && onReply(); onReply && onReply();
onPopoverHide(); onPopoverHide();
@ -142,7 +144,7 @@ const PopoverContent: FC<Props> = ({
visible={visible} visible={visible}
zIndex={9999} zIndex={9999}
onVisibleChange={handleVisibleChange}> onVisibleChange={handleVisibleChange}>
<button> <button onClick={(e) => e.stopPropagation()}>
<SVGIcons <SVGIcons
alt="add-reaction" alt="add-reaction"
icon={Icons.REACTION} icon={Icons.REACTION}

View File

@ -55,7 +55,9 @@ const ActivityFeedEditor: FC<ActivityFeedEditorProp> = ({
}; };
return ( return (
<div className={classNames('tw-relative', className)}> <div
className={classNames('tw-relative', className)}
onClick={(e) => e.stopPropagation()}>
<FeedEditor <FeedEditor
defaultValue={defaultValue} defaultValue={defaultValue}
placeHolder={placeHolder} placeHolder={placeHolder}

View File

@ -33,7 +33,9 @@ export const SendButton: FC<SendButtonProp> = ({
onSaveHandler, onSaveHandler,
}) => { }) => {
return ( return (
<div className="tw-absolute tw-right-2 tw-bottom-2 tw-flex tw-flex-row tw-items-center tw-justify-end"> <div
className="tw-absolute tw-right-2 tw-bottom-2 tw-flex tw-flex-row tw-items-center tw-justify-end"
onClick={(e) => e.stopPropagation()}>
<PopOver <PopOver
html={ html={
<Fragment> <Fragment>

View File

@ -14,11 +14,13 @@
import { Card } from 'antd'; import { Card } from 'antd';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import React, { FC, Fragment } from 'react'; import React, { FC, Fragment } from 'react';
import { useHistory } from 'react-router-dom';
import { import {
Post, Post,
ThreadTaskStatus, ThreadTaskStatus,
ThreadType, ThreadType,
} from '../../../generated/entity/feed/thread'; } from '../../../generated/entity/feed/thread';
import { getTaskDetailPath } from '../../../utils/TasksUtils';
import AssigneeList from '../../common/AssigneeList/AssigneeList'; import AssigneeList from '../../common/AssigneeList/AssigneeList';
import { leftPanelAntCardStyle } from '../../containers/PageLayout'; import { leftPanelAntCardStyle } from '../../containers/PageLayout';
import ActivityFeedCard from '../ActivityFeedCard/ActivityFeedCard'; import ActivityFeedCard from '../ActivityFeedCard/ActivityFeedCard';
@ -39,6 +41,7 @@ const FeedListBody: FC<FeedListBodyProp> = ({
onConfirmation, onConfirmation,
updateThreadHandler, updateThreadHandler,
}) => { }) => {
const history = useHistory();
const toggleReplyEditor = (id: string) => { const toggleReplyEditor = (id: string) => {
onThreadIdSelect(selectedThreadId === id ? '' : id); onThreadIdSelect(selectedThreadId === id ? '' : id);
}; };
@ -89,6 +92,12 @@ const FeedListBody: FC<FeedListBodyProp> = ({
); );
}; };
const handleCardClick = (taskId: number, isTask: boolean) => {
if (isTask) {
history.push(getTaskDetailPath(String(taskId)));
}
};
return ( return (
<Fragment> <Fragment>
{updatedFeedList {updatedFeedList
@ -124,7 +133,10 @@ const FeedListBody: FC<FeedListBodyProp> = ({
border: isTask border: isTask
? '1px solid #C6B5F6' ? '1px solid #C6B5F6'
: leftPanelAntCardStyle.border, : leftPanelAntCardStyle.border,
}}> }}
onClick={() =>
feed.task && handleCardClick(feed.task.id, isTask)
}>
{isTask && ( {isTask && (
<TaskBadge status={feed.task?.status as ThreadTaskStatus} /> <TaskBadge status={feed.task?.status as ThreadTaskStatus} />
)} )}

View File

@ -13,12 +13,14 @@
import { Card } from 'antd'; import { Card } from 'antd';
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
import React, { FC, Fragment } from 'react'; import React, { FC, Fragment } from 'react';
import { useHistory } from 'react-router-dom';
import { import {
Post, Post,
ThreadTaskStatus, ThreadTaskStatus,
ThreadType, ThreadType,
} from '../../../generated/entity/feed/thread'; } from '../../../generated/entity/feed/thread';
import { getFeedListWithRelativeDays } from '../../../utils/FeedUtils'; import { getFeedListWithRelativeDays } from '../../../utils/FeedUtils';
import { getTaskDetailPath } from '../../../utils/TasksUtils';
import AssigneeList from '../../common/AssigneeList/AssigneeList'; import AssigneeList from '../../common/AssigneeList/AssigneeList';
import { leftPanelAntCardStyle } from '../../containers/PageLayout'; import { leftPanelAntCardStyle } from '../../containers/PageLayout';
import ActivityFeedCard from '../ActivityFeedCard/ActivityFeedCard'; import ActivityFeedCard from '../ActivityFeedCard/ActivityFeedCard';
@ -38,6 +40,7 @@ const ActivityThreadList: FC<ActivityThreadListProp> = ({
onConfirmation, onConfirmation,
updateThreadHandler, updateThreadHandler,
}) => { }) => {
const history = useHistory();
const { updatedFeedList: updatedThreads, relativeDays } = const { updatedFeedList: updatedThreads, relativeDays } =
getFeedListWithRelativeDays(threads); getFeedListWithRelativeDays(threads);
@ -45,6 +48,12 @@ const ActivityThreadList: FC<ActivityThreadListProp> = ({
onThreadIdSelect(selectedThreadId === id ? '' : id); onThreadIdSelect(selectedThreadId === id ? '' : id);
}; };
const handleCardClick = (taskId: number, isTask: boolean) => {
if (isTask) {
history.push(getTaskDetailPath(String(taskId)));
}
};
return ( return (
<div className={className}> <div className={className}>
{relativeDays.map((d, i) => { {relativeDays.map((d, i) => {
@ -88,7 +97,10 @@ const ActivityThreadList: FC<ActivityThreadListProp> = ({
border: isTask border: isTask
? '1px solid #C6B5F6' ? '1px solid #C6B5F6'
: leftPanelAntCardStyle.border, : leftPanelAntCardStyle.border,
}}> }}
onClick={() =>
thread.task && handleCardClick(thread.task.id, isTask)
}>
{isTask && ( {isTask && (
<TaskBadge <TaskBadge
status={thread.task?.status as ThreadTaskStatus} status={thread.task?.status as ThreadTaskStatus}

View File

@ -50,7 +50,8 @@ const Emoji = ({ reaction, reactionList, onReactionSelect }) => {
(reactionItem) => reactionItem.user.name (reactionItem) => reactionItem.user.name
); );
const handleEmojiOnClick = () => { const handleEmojiOnClick = (e) => {
e.stopPropagation();
if (!isClicked) { if (!isClicked) {
const operation = isReacted const operation = isReacted
? ReactionOperation.REMOVE ? ReactionOperation.REMOVE

View File

@ -23,7 +23,8 @@ import useImage from '../../hooks/useImage';
const Reaction = ({ reaction, isReacted, onReactionSelect, onHide }) => { const Reaction = ({ reaction, isReacted, onReactionSelect, onHide }) => {
const { image } = useImage(`emojis/${reaction.reaction}.png`); const { image } = useImage(`emojis/${reaction.reaction}.png`);
const handleOnClick = () => { const handleOnClick = (e) => {
e.stopPropagation();
const operation = isReacted const operation = isReacted
? ReactionOperation.REMOVE ? ReactionOperation.REMOVE
: ReactionOperation.ADD; : ReactionOperation.ADD;

View File

@ -104,7 +104,8 @@ const Reactions = ({ reactions, onReactionSelect }) => {
<Button <Button
className="ant-btn-reaction ant-btn-add-reactions" className="ant-btn-reaction ant-btn-add-reactions"
data-testid="add-reactions" data-testid="add-reactions"
shape="round"> shape="round"
onClick={(e) => e.stopPropagation()}>
<SVGIcons <SVGIcons
alt="add-reaction" alt="add-reaction"
icon={Icons.ADD_REACTION} icon={Icons.ADD_REACTION}

View File

@ -161,7 +161,10 @@ const EntityPopOverCard: FC<Props> = ({ children, entityType, entityFQN }) => {
const PopoverTitle = () => { const PopoverTitle = () => {
return ( return (
<Link data-testid="entitylink" to={getEntityLink(entityType, entityFQN)}> <Link data-testid="entitylink" to={getEntityLink(entityType, entityFQN)}>
<button className="tw-text-info" disabled={AppState.isTourOpen}> <button
className="tw-text-info"
disabled={AppState.isTourOpen}
onClick={(e) => e.stopPropagation()}>
<span>{entityFQN}</span> <span>{entityFQN}</span>
</button> </button>
</Link> </Link>

View File

@ -119,7 +119,10 @@ const UserPopOverCard: FC<Props> = ({ children, userName, type = 'user' }) => {
<div className="tw-self-center"> <div className="tw-self-center">
<button <button
className="tw-text-info" className="tw-text-info"
onClick={() => onTitleClickHandler(getUserPath(name))}> onClick={(e) => {
e.stopPropagation();
onTitleClickHandler(getUserPath(name));
}}>
<span className="tw-font-medium tw-mr-2">{displayName}</span> <span className="tw-font-medium tw-mr-2">{displayName}</span>
</button> </button>
{displayName !== name ? ( {displayName !== name ? (