Skip to content

Commit

Permalink
Always show "online" for authenticated user profiles (#9574)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyurajeesh authored Dec 26, 2024
1 parent 20fe265 commit 4d2e0d0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/Users/UserListAndCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,30 +134,33 @@ export const UserStatusIndicator = ({
className?: string;
addPadding?: boolean;
}) => {
const cur_online = isUserOnline(user);
const authUser = useAuthUser();
const isAuthUser = user.id === authUser.id;
const isOnline = isUserOnline(user) || isAuthUser;
const { t } = useTranslation();

return (
<div
className={classNames(
"inline-flex items-center gap-2 rounded-full",
addPadding ? "px-3 py-1" : "py-px",
cur_online ? "bg-green-100" : "bg-gray-100",
isOnline ? "bg-green-100" : "bg-gray-100",
className,
)}
>
<span
className={classNames(
"inline-block h-2 w-2 shrink-0 rounded-full",
cur_online ? "bg-green-500" : "bg-gray-400",
isOnline ? "bg-green-500" : "bg-gray-400",
)}
></span>
<span
className={classNames(
"whitespace-nowrap text-xs",
cur_online ? "text-green-700" : "text-gray-500",
isOnline ? "text-green-700" : "text-gray-500",
)}
>
{cur_online
{isOnline
? t("online")
: user.last_login
? relativeTime(user.last_login)
Expand Down

0 comments on commit 4d2e0d0

Please sign in to comment.