feat: show user avatar on comments and activity (#331)

Display user profile pictures instead of initials on card comments
and activity items. Fetches the user image field from the database
and passes imageUrl to the Avatar component.

Co-authored-by: Sachin Divekar <sachin.divekar@remiges.tech>
This commit is contained in:
Sachin Divekar
2026-01-25 03:34:46 +05:30
committed by GitHub
parent 6729c2e228
commit d084d323bc
3 changed files with 9 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import { authClient } from "@kan/auth/client";
import Avatar from "~/components/Avatar"; import Avatar from "~/components/Avatar";
import { useLocalisation } from "~/hooks/useLocalisation"; import { useLocalisation } from "~/hooks/useLocalisation";
import { api } from "~/utils/api"; import { api } from "~/utils/api";
import { getAvatarUrl } from "~/utils/helpers";
import Comment from "./Comment"; import Comment from "./Comment";
type ActivityType = type ActivityType =
@@ -471,6 +472,7 @@ const ActivityList = ({
cardPublicId={cardPublicId} cardPublicId={cardPublicId}
name={activity.user?.name ?? ""} name={activity.user?.name ?? ""}
email={activity.user?.email ?? ""} email={activity.user?.email ?? ""}
image={activity.user?.image ?? null}
isLoading={isLoading} isLoading={isLoading}
createdAt={activity.createdAt.toISOString()} createdAt={activity.createdAt.toISOString()}
comment={activity.comment?.comment} comment={activity.comment?.comment}
@@ -493,6 +495,7 @@ const ActivityList = ({
size="sm" size="sm"
name={activity.user?.name ?? ""} name={activity.user?.name ?? ""}
email={activity.user?.email ?? ""} email={activity.user?.email ?? ""}
imageUrl={getAvatarUrl(activity.user?.image ?? null) || undefined}
icon={getActivityIcon( icon={getActivityIcon(
activity.type, activity.type,
activity.fromList?.index, activity.fromList?.index,

View File

@@ -12,6 +12,7 @@ import { useModal } from "~/providers/modal";
import { usePopup } from "~/providers/popup"; import { usePopup } from "~/providers/popup";
import { api } from "~/utils/api"; import { api } from "~/utils/api";
import { invalidateCard } from "~/utils/cardInvalidation"; import { invalidateCard } from "~/utils/cardInvalidation";
import { getAvatarUrl } from "~/utils/helpers";
interface FormValues { interface FormValues {
comment: string; comment: string;
@@ -22,6 +23,7 @@ const Comment = ({
cardPublicId, cardPublicId,
name, name,
email, email,
image,
isLoading, isLoading,
createdAt, createdAt,
comment, comment,
@@ -34,6 +36,7 @@ const Comment = ({
cardPublicId: string; cardPublicId: string;
name: string; name: string;
email: string; email: string;
image: string | null;
isLoading: boolean; isLoading: boolean;
createdAt: string; createdAt: string;
comment: string | undefined; comment: string | undefined;
@@ -108,6 +111,7 @@ const Comment = ({
size="sm" size="sm"
name={name ?? ""} name={name ?? ""}
email={email ?? ""} email={email ?? ""}
imageUrl={getAvatarUrl(image) || undefined}
isLoading={isLoading} isLoading={isLoading}
/> />

View File

@@ -169,6 +169,7 @@ export const getPaginatedActivities = async (
id: true, id: true,
name: true, name: true,
email: true, email: true,
image: true,
}, },
}, },
}, },
@@ -178,6 +179,7 @@ export const getPaginatedActivities = async (
id: true, id: true,
name: true, name: true,
email: true, email: true,
image: true,
}, },
}, },
comment: { comment: {