Skip to content

Commit

Permalink
Add user profile click functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
abhipatel0211 committed Jan 30, 2024
1 parent c9324e6 commit 081401f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/meteor/client/components/avatar/BaseAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@ import type { AvatarProps } from '@rocket.chat/fuselage';
import { Avatar, Skeleton } from '@rocket.chat/fuselage';
import type { FC } from 'react';
import React, { useState } from 'react';
import { useRoomToolbox } from '../../views/room/contexts/RoomToolboxContext';
import { useTranslation } from '@rocket.chat/ui-contexts';

export type BaseAvatarProps = Omit<AvatarProps, 'is'>;

const BaseAvatar: FC<BaseAvatarProps> = ({ onError, ...props }) => {
const [isLoading, setIsLoading] = useState<unknown>(false);

const t = useTranslation();
if (isLoading) {
return <Skeleton aria-hidden variant='rect' onError={onError} {...props} />;
}

const toolbox = useRoomToolbox();
const { actions, openTab } = toolbox;
console.log(actions);
console.log(props);
const handleClick = () => {
openTab(actions[0]?.id);
}
return (
<Avatar
aria-hidden
title={t(actions[0]?.title)}
onClick={handleClick}
onError={(event) => {
setIsLoading(true);
onError?.(event);
Expand Down

0 comments on commit 081401f

Please sign in to comment.