Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3046 UI Add support for request description #3074

Merged
merged 40 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
45040db
Fix #3046 UI Add support for request description
Sachin-chaurasiya Mar 2, 2022
f1928ba
Add rqeuest description support for table entity.
Sachin-chaurasiya Mar 2, 2022
49136ba
Add support for real time count update
Sachin-chaurasiya Mar 2, 2022
ed8efbe
Add ssupport for chat bubble in database entity
Sachin-chaurasiya Mar 2, 2022
4c8b546
Add chat bubble support for service entity
Sachin-chaurasiya Mar 2, 2022
cedacc3
Fix request description issue
Sachin-chaurasiya Mar 2, 2022
1071ac4
Add entityUrl map
Sachin-chaurasiya Mar 2, 2022
61ddc23
Style tweaks
Sachin-chaurasiya Mar 2, 2022
962d99d
Addressing Feed UI Feedback.
Sachin-chaurasiya Mar 2, 2022
97e92d6
Minor UI Tweaks
Sachin-chaurasiya Mar 3, 2022
48a1664
Change separator text.
Sachin-chaurasiya Mar 3, 2022
c62370f
Merge branch 'main' into feat-request-description
Sachin-chaurasiya Mar 3, 2022
df67241
Fix #3055 When there is no activity to show in Activity Feed tab, sho…
Sachin-chaurasiya Mar 3, 2022
c4714e4
Change request description styling
Sachin-chaurasiya Mar 3, 2022
2f1ec5f
Addressing review comments
Sachin-chaurasiya Mar 3, 2022
ad4bf34
Add reply count in panel
Sachin-chaurasiya Mar 3, 2022
3571203
Fxi chat bubble position.
Sachin-chaurasiya Mar 3, 2022
9458dcb
Merge branch 'main' into feat-request-description
Sachin-chaurasiya Mar 3, 2022
8b6b689
Fix failing test
Sachin-chaurasiya Mar 3, 2022
1509176
Add comment icon with (+) to start a new conversation.
Sachin-chaurasiya Mar 3, 2022
da1385a
Add comment icon with (+) to start a new conversation.
Sachin-chaurasiya Mar 3, 2022
bc6532d
Fix Typo
Sachin-chaurasiya Mar 3, 2022
bd15529
FIx Converssations count size.
Sachin-chaurasiya Mar 3, 2022
03e12f6
Add request description support for database and service entity.
Sachin-chaurasiya Mar 3, 2022
71bef8c
Add support for request description in other entities.
Sachin-chaurasiya Mar 3, 2022
e6c4e74
Fix request description logic
Sachin-chaurasiya Mar 3, 2022
77fb5e5
remove commented code
Sachin-chaurasiya Mar 3, 2022
b174f7d
Fix older reply count
Sachin-chaurasiya Mar 3, 2022
a9865f0
Fix #3103 Thread section not opening on different tab
Sachin-chaurasiya Mar 3, 2022
27132c2
Merge branch 'main' into feat-request-description
Sachin-chaurasiya Mar 3, 2022
52b6eb7
Minor fix
Sachin-chaurasiya Mar 3, 2022
2c39401
Addresing review comments
Sachin-chaurasiya Mar 4, 2022
0a39cf3
Addressinsg review comments
Sachin-chaurasiya Mar 4, 2022
85755f0
Merge branch 'main' into feat-request-description
Sachin-chaurasiya Mar 4, 2022
da20201
Minor style fix
Sachin-chaurasiya Mar 4, 2022
06a7ed1
Addressing review feedback.
Sachin-chaurasiya Mar 4, 2022
0713c8a
Fix request description styling
Sachin-chaurasiya Mar 4, 2022
b3fc7ec
Merge branch 'main' into feat-request-description
Sachin-chaurasiya Mar 4, 2022
b4acbd6
Addressing review comment
Sachin-chaurasiya Mar 4, 2022
58d4511
Update feed.constants.ts
Sachin-chaurasiya Mar 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/

import { AxiosResponse } from 'axios';
import { isUndefined } from 'lodash';
import { Post } from 'Models';
import { FeedFilter } from '../enums/mydata.enum';
import { CreateThread } from '../generated/api/feed/createThread';
import APIClient from './index';
import { FeedFilter } from '../enums/mydata.enum';
import { isUndefined } from 'lodash';

export const getAllFeeds: Function = (
entityLink?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import classNames from 'classnames';
import React, { FC, HTMLAttributes, useRef, useState } from 'react';
import { getBackendFormat, HTMLToMarkdown } from '../../../utils/FeedUtils';
import SVGIcons from '../../../utils/SvgUtils';
import SVGIcons, { Icons } from '../../../utils/SvgUtils';
import { Button } from '../../buttons/Button/Button';
import PopOver from '../../common/popover/PopOver';
import FeedEditor from '../../FeedEditor/FeedEditor';
Expand All @@ -23,6 +23,7 @@ interface ActivityFeedEditorProp extends HTMLAttributes<HTMLDivElement> {
onSave?: (value: string) => void;
buttonClass?: string;
placeHolder?: string;
defaultValue?: string;
}
type EditorContentRef = {
getEditorValue: () => string;
Expand All @@ -34,6 +35,7 @@ const ActivityFeedEditor: FC<ActivityFeedEditorProp> = ({
buttonClass = '',
onSave,
placeHolder,
defaultValue,
}) => {
const editorRef = useRef<EditorContentRef>();
const [editorValue, setEditorValue] = useState<string>('');
Expand All @@ -54,6 +56,7 @@ const ActivityFeedEditor: FC<ActivityFeedEditorProp> = ({
return (
<div className={classNames('tw-relative', className)}>
<FeedEditor
defaultValue={defaultValue}
placeHolder={placeHolder}
ref={editorRef}
onChangeHandler={onChangeHandler}
Expand All @@ -71,15 +74,22 @@ const ActivityFeedEditor: FC<ActivityFeedEditorProp> = ({
trigger="mouseenter">
<Button
className={classNames(
'tw-bg-gray-400 tw-py-0.5 tw-px-1 tw-rounded',
'tw-py-0.5 tw-px-1 tw-rounded tw-bg-none',
buttonClass
)}
disabled={editorValue.length === 0}
size="custom"
theme={editorValue.length > 0 ? 'primary' : 'default'}
variant="contained"
variant="text"
onClick={onSaveHandler}>
<SVGIcons alt="paper-plane" icon="icon-paper-plane" width="18px" />
<SVGIcons
alt="paper-plane"
icon={
editorValue.length > 0
? Icons.PAPER_PLANE_PRIMARY
: Icons.PAPER_PLANE
}
width="18px"
/>
</Button>
</PopOver>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ import ActivityFeedCard, {
} from '../ActivityFeedCard/ActivityFeedCard';
import ActivityFeedEditor from '../ActivityFeedEditor/ActivityFeedEditor';
import ActivityFeedPanel from '../ActivityFeedPanel/ActivityFeedPanel';
import NoFeedPlaceholder from '../NoFeedPlaceholder/NoFeedPlaceholder';

interface ActivityFeedListProp extends HTMLAttributes<HTMLDivElement> {
feedList: EntityThread[];
withSidePanel?: boolean;
isEntityFeed?: boolean;
entityName?: string;
postFeedHandler?: (value: string, id: string) => void;
}
interface FeedListSeparatorProp extends HTMLAttributes<HTMLDivElement> {
Expand Down Expand Up @@ -61,7 +63,7 @@ export const FeedListSeparator: FC<FeedListSeparatorProp> = ({
<div className="tw-flex tw-justify-center">
<hr className="tw-absolute tw-top-3 tw-border-b tw-border-main tw-w-full tw-z-0" />
{relativeDay ? (
<span className="tw-bg-white tw-px-4 tw-py-px tw-border tw-border-primary tw-rounded tw-z-10 tw-text-primary tw-font-medium">
<span className="tw-bg-white tw-px-4 tw-py-px tw-border tw-border-grey-muted tw-rounded tw-z-10 tw-text-grey-muted tw-font-medium">
{relativeDay}
</span>
) : null}
Expand Down Expand Up @@ -91,8 +93,8 @@ const FeedListBody: FC<FeedListBodyProp> = ({
from: feed.createdBy,
};
const postLength = feed.posts.length;
const replies = feed.postsCount;
const repliedUsers = feed.posts.map((f) => f.from);
const replies = feed.postsCount - 1;
const repliedUsers = feed.posts.map((f) => f.from).slice(1, 3);
const lastPost = feed.posts[postLength - 1];

return (
Expand All @@ -105,15 +107,11 @@ const FeedListBody: FC<FeedListBodyProp> = ({
/>
{postLength > 0 ? (
<Fragment>
<ActivityFeedCard
className="tw-mb-6 tw-ml-9"
feed={lastPost}
isEntityFeed={isEntityFeed}
/>
<div className="tw-mb-6">
<div className="tw-ml-9 tw-flex tw-mb-6">
<FeedFooter
isFooterVisible
className="tw--mt-4"
lastReplyTimeStamp={lastPost?.postTs}
repliedUsers={repliedUsers}
replies={replies}
Expand All @@ -124,23 +122,27 @@ const FeedListBody: FC<FeedListBodyProp> = ({
onViewMore();
}}
/>
<span className="tw-mx-1.5 tw-mt-1 tw-inline-block tw-text-gray-400">
|
</span>
<p
className="link-text tw-text-xs tw-mt-1.5 tw-underline"
onClick={() => onThreadIdSelect(feed.id)}>
Reply
</p>
</div>
{selctedThreadId === feed.id ? (
<ActivityFeedEditor
buttonClass="tw-mr-4"
className="tw-ml-5 tw-mr-2"
onSave={postFeed}
/>
) : null}
</div>
<ActivityFeedCard
className="tw-mb-6 tw-ml-9"
feed={lastPost}
isEntityFeed={isEntityFeed}
/>
<p
className="link-text tw-text-xs tw-underline tw-ml-9 tw-pl-9 tw--mt-4 tw-mb-6"
onClick={() => {
onThreadIdSelect(feed.id);
}}>
Reply
</p>
{selctedThreadId === feed.id ? (
<ActivityFeedEditor
buttonClass="tw-mr-4"
className="tw-ml-5 tw-mr-2"
onSave={postFeed}
/>
) : null}
</Fragment>
) : (
<p
Expand All @@ -165,6 +167,7 @@ const ActivityFeedList: FC<ActivityFeedListProp> = ({
withSidePanel = false,
isEntityFeed = false,
postFeedHandler,
entityName,
}) => {
const { updatedFeedList, relativeDays } =
getFeedListWithRelativeDays(feedList);
Expand Down Expand Up @@ -256,11 +259,17 @@ const ActivityFeedList: FC<ActivityFeedListProp> = ({
</Fragment>
) : (
<Fragment>
<FeedListSeparator
className="tw-relative tw-mt-1 tw-mb-3.5 tw-pb-5"
relativeDay=""
/>
<>No conversations found. Try changing the filter.</>
{entityName ? (
<NoFeedPlaceholder entityName={entityName} />
) : (
<Fragment>
<FeedListSeparator
className="tw-relative tw-mt-1 tw-mb-3.5 tw-pb-5"
relativeDay=""
/>
<>No conversations found. Try changing the filter.</>
</Fragment>
)}
</Fragment>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface FeedPanelHeaderProp
extends HTMLAttributes<HTMLHeadingElement>,
Pick<ActivityFeedPanelProp, 'onCancel'> {
entityField: string;
noun?: string;
}
interface FeedPanelOverlayProp
extends HTMLAttributes<HTMLButtonElement>,
Expand All @@ -51,12 +52,14 @@ export const FeedPanelHeader: FC<FeedPanelHeaderProp> = ({
onCancel,
entityField,
className,
noun,
}) => {
return (
<header className={className}>
<div className="tw-flex tw-justify-between tw-py-3">
<p>
Thread on <span className="tw-heading">{entityField}</span>
{noun ? noun : 'Conversation'} on{' '}
<span className="tw-heading">{entityField}</span>
</p>
<svg
className="tw-w-5 tw-h-5 tw-ml-1 tw-cursor-pointer"
Expand Down Expand Up @@ -114,7 +117,7 @@ const FeedPanelBody: FC<FeedPanelBodyProp> = ({
{repliesLength > 0 ? (
<Fragment>
<div className="tw-mb-3 tw-flex">
<span>{getReplyText(repliesLength)}</span>
<span>{getReplyText(repliesLength, 'reply', 'replies')}</span>
<span className="tw-flex-auto tw-self-center tw-ml-1.5">
<hr />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ const ActivityThreadList: FC<ActivityThreadListProp> = ({
from: thread.createdBy,
};
const postLength = thread.posts.length;
const replies = thread.postsCount;
const repliedUsers = thread.posts.map((f) => f.from);
const replies = thread.postsCount - 1;
const repliedUsers = thread.posts
.map((f) => f.from)
.slice(1, 3);
const lastPost = thread.posts[postLength - 1];

return (
Expand All @@ -103,31 +105,31 @@ const ActivityThreadList: FC<ActivityThreadListProp> = ({
/>
{postLength > 0 ? (
<Fragment>
<ActivityFeedCard
isEntityFeed
className="tw-mb-6 tw-ml-9"
feed={lastPost}
/>
<div className="tw-mb-6">
<div className="tw-ml-9 tw-flex tw-mb-6">
<FeedFooter
isFooterVisible
className="tw--mt-4"
lastReplyTimeStamp={lastPost?.postTs}
repliedUsers={repliedUsers}
replies={replies}
threadId={thread.id}
onThreadSelect={() => onThreadSelect(thread.id)}
/>
<span className="tw-mx-1.5 tw-mt-1 tw-inline-block tw-text-gray-400">
|
</span>
<p
className="link-text tw-text-xs tw-mt-1.5 tw-underline"
onClick={() => onThreadIdSelect(thread.id)}>
Reply
</p>
</div>
</div>
<ActivityFeedCard
isEntityFeed
className="tw-mb-6 tw-ml-9"
feed={lastPost}
/>
<p
className="link-text tw-text-xs tw-underline tw-ml-9 tw-pl-9 tw--mt-4 tw-mb-6"
onClick={() => {
onThreadIdSelect(thread.id);
}}>
Reply
</p>
</Fragment>
) : (
<p
Expand Down Expand Up @@ -185,7 +187,7 @@ const ActivityThread: FC<ActivityThreadProp> = ({
{repliesLength > 0 ? (
<Fragment>
<div className="tw-mb-3 tw-flex">
<span>{getReplyText(repliesLength)}</span>
<span>{getReplyText(repliesLength, 'reply', 'replies')}</span>
<span className="tw-flex-auto tw-self-center tw-ml-1.5">
<hr />
</span>
Expand Down Expand Up @@ -304,6 +306,7 @@ const ActivityThreadPanel: FC<ActivityThreadPanelProp> = ({
<FeedPanelHeader
className="tw-px-4 tw-shadow-sm"
entityField={entityField as string}
noun="Conversations"
onCancel={onCancel}
/>
{!isUndefined(selectedThread) ? (
Expand Down