diff --git a/src/components/Article/DiscussionModal.tsx b/src/components/Article/DiscussionModal.tsx index 4800510..bb7e289 100644 --- a/src/components/Article/DiscussionModal.tsx +++ b/src/components/Article/DiscussionModal.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect, FormEvent } from "react"; import { Box, TextField, Button, Typography, Avatar } from "@mui/material"; import { getDatabase, ref, set, onValue, get } from "firebase/database"; import moment from "moment"; +import { Link } from "react-router-dom"; const modalStyle = { borderTop: "1px solid rgba(0, 0, 0, 0.189)", @@ -12,6 +13,7 @@ const modalStyle = { interface User { name: string; pic: string; + uid: string; } interface CommentData { @@ -20,6 +22,7 @@ interface CommentData { avatar: string; content: string; timestamp: string; + authoruid: string; } interface DiscussionModalProps { @@ -52,6 +55,7 @@ const DiscussionModal: React.FC = ({ setUser({ name: userData.name || "Guest User", pic: userData.pic || placeholderAvatar, + uid: userData.uid || "", }); } } catch (error) { @@ -115,6 +119,7 @@ const DiscussionModal: React.FC = ({ id: newCommentId, author: user.name, avatar: user.pic, + authoruid: user.uid, content: newComment, timestamp: new Date().toISOString(), }; @@ -182,9 +187,15 @@ const Comment: React.FC = ({ data }) => { return ( - + + {" "} + + - {data.author} + + {" "} + {data.author} + {moment(data.timestamp).fromNow()}