fix(ui): user profile page activity feed (#12226)

This commit is contained in:
Chirag Madlani 2023-06-29 17:21:55 +05:30 committed by GitHub
parent 70b76a34c1
commit f74004d9c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 54 deletions

View File

@ -57,7 +57,7 @@ const ActivityFeedListV1 = ({
}
return (
<div className="feed-list-container h-full p-y-md" id="feedData">
<div className="feed-list-container p-y-md m-b-sm" id="feedData">
{entityThread.length === 0 && (
<div
className="h-full p-x-md"

View File

@ -51,13 +51,16 @@ import { ActivityFeedProviderContextType } from './ActivityFeedProviderContext.i
interface Props {
children: ReactNode;
// To override current userId in case of User profile page
// Will update logic to ser userID from props later
user?: string;
}
export const ActivityFeedContext = createContext(
{} as ActivityFeedProviderContextType
);
const ActivityFeedProvider = ({ children }: Props) => {
const ActivityFeedProvider = ({ children, user }: Props) => {
const { t } = useTranslation();
const [entityThread, setEntityThread] = useState<Thread[]>([]);
const [entityPaging, setEntityPaging] = useState<Paging>({} as Paging);
@ -105,7 +108,11 @@ const ActivityFeedProvider = ({ children }: Props) => {
setLoading(true);
const feedFilterType = filterType ?? FeedFilter.ALL;
const userId =
feedFilterType === FeedFilter.ALL ? undefined : currentUser?.id;
entityType === EntityType.USER_NAME
? user
: feedFilterType === FeedFilter.ALL
? undefined
: currentUser?.id;
const { data, paging } = await getAllFeeds(
entityType !== EntityType.USER_NAME
@ -360,6 +367,7 @@ const ActivityFeedProvider = ({ children }: Props) => {
updateEditorFocus,
setActiveThread,
entityPaging,
userId: user ?? currentUser?.id ?? '',
};
}, [
entityThread,
@ -379,6 +387,8 @@ const ActivityFeedProvider = ({ children }: Props) => {
updateEditorFocus,
setActiveThread,
entityPaging,
user,
currentUser,
]);
return (

View File

@ -31,6 +31,7 @@ export interface ActivityFeedProviderContextType {
focusReplyEditor: boolean;
entityPaging: Paging;
setActiveThread: (thread?: Thread) => void;
userId: string;
deleteFeed: (
threadId: string,
postId: string,

View File

@ -11,7 +11,6 @@
* limitations under the License.
*/
import { Menu, Typography } from 'antd';
import AppState from 'AppState';
import classNames from 'classnames';
import Loader from 'components/Loader/Loader';
import { TaskTab } from 'components/Task/TaskTab/TaskTab.component';
@ -72,11 +71,6 @@ export const ActivityFeedTab = ({
const [allCount, setAllCount] = useState(0);
const [tasksCount, setTasksCount] = useState(0);
const currentUser = useMemo(
() => AppState.getCurrentUserDetails(),
[AppState.userDetails, AppState.nonSecureUserDetails]
);
const {
postFeed,
selectedThread,
@ -84,6 +78,7 @@ export const ActivityFeedTab = ({
entityThread,
getFeedData,
loading,
userId,
entityPaging,
} = useActivityFeedProvider();
@ -143,7 +138,6 @@ export const ActivityFeedTab = ({
}
);
} else {
if (activeTab !== ActivityFeedTabs.TASKS) {
// count for task on userProfile page
getAllFeeds(
undefined,
@ -151,7 +145,7 @@ export const ActivityFeedTab = ({
ThreadType.Task,
FeedFilter.OWNER,
undefined,
currentUser?.id
userId
).then((res) => {
if (res) {
setTasksCount(res.paging.total);
@ -159,9 +153,7 @@ export const ActivityFeedTab = ({
throw t('server.entity-feed-fetch-error');
}
});
}
if (activeTab !== ActivityFeedTabs.ALL) {
// count for all on userProfile page
getAllFeeds(
undefined,
@ -169,7 +161,7 @@ export const ActivityFeedTab = ({
ThreadType.Conversation,
FeedFilter.OWNER,
undefined,
currentUser?.id
userId
).then((res) => {
if (res) {
setAllCount(res.paging.total);
@ -178,22 +170,12 @@ export const ActivityFeedTab = ({
}
});
}
}
};
useEffect(() => {
fetchFeedsCount();
}, []);
useEffect(() => {
if (isUserEntity && activeTab === ActivityFeedTabs.ALL && !allCount) {
setAllCount(entityPaging.total);
}
if (isUserEntity && activeTab === ActivityFeedTabs.TASKS && !tasksCount) {
setTasksCount(entityPaging.total);
}
});
const { feedFilter, threadType } = useMemo(() => {
return {
threadType:
@ -371,6 +353,7 @@ export const ActivityFeedTab = ({
data-testid="observer-element"
id="observer-element"
ref={elementRef as RefObject<HTMLDivElement>}
style={{ height: '2px' }}
/>
</div>
<div className=" right-container">

View File

@ -736,7 +736,7 @@ const Users = ({
}
case UserPageTabs.ACTIVITY:
return (
<ActivityFeedProvider>
<ActivityFeedProvider user={userData.id}>
<ActivityFeedTab
entityType={EntityType.USER_NAME}
fqn={username}

View File

@ -20,7 +20,7 @@ import { LOGIN_SLIDE } from '../../constants/Login.constants';
const LoginCarousel = () => {
return (
<div className="carousal-container" data-testid="carousel-container">
<Carousel autoplay dots autoplaySpeed={1500} easing="ease-in-out">
<Carousel autoplay dots autoplaySpeed={3000} easing="ease-in-out">
{LOGIN_SLIDE.map((data) => (
<div
className="text-center"