Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

fix(app): show user profile image in comments #21

Merged
merged 1 commit into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/src/entities/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export class User extends TimeStamps {
@prop({ default: '' })
public image?: string;

@prop({ default: '' })
public cover?: string;

@prop({ ref: () => User })
public followers?: Ref<User>[];

Expand Down
10 changes: 5 additions & 5 deletions app/src/Feed/components/comments/PostComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { HTMLProps, memo, useEffect, useMemo, useState } from 'react';
import JAvatar from 'src/Lib/JAvatar';
import JButton from 'src/Lib/JButton';
import JIcon from 'src/Lib/JIcon';
import { classNames, timeAgo } from 'src/utils/helpers';
import { classNames, getFileUrl, getUserInitials, timeAgo } from 'src/utils/helpers';
import { Comment, Reply } from 'src/utils/types';
import { useComment } from 'src/Feed/context/commentApi';
import { likeComment, likeReply, unLikeComment, unLikeReply } from 'src/Shared/services/post';
Expand Down Expand Up @@ -96,8 +96,8 @@ const PostComment: React.FC<Props> = ({ className, comment, ...rest }) => {
<div className="flex space-x-2 items-start">
<div className="flex-none">
<JAvatar
src={comment?.user?.image}
content={!comment?.user?.image ? comment?.user?.username.slice(0, 2) : undefined}
src={!!comment.user?.image ? getFileUrl(comment.user.image) : ''}
content={getUserInitials(comment.user as any)}
contentClass="bg-lime-200 shadow-sm"
rounded
size="35px"
Expand Down Expand Up @@ -227,8 +227,8 @@ export const PostReply: React.FC<{
<div className={classNames(['flex space-x-2 items-start'])}>
<div className="flex-none">
<JAvatar
src={reply?.user?.image}
content={!reply?.user?.image ? reply?.user?.username.slice(0, 2) : undefined}
src={!!reply.user?.image ? getFileUrl(reply.user.image) : ''}
content={getUserInitials(reply.user as any)}
contentClass="bg-lime-200 shadow-sm"
rounded
size="35px"
Expand Down