diff --git a/apps/forum/src/components/Comment.tsx b/apps/forum/src/components/Comment.tsx index d5065413c..afe2daa8a 100644 --- a/apps/forum/src/components/Comment.tsx +++ b/apps/forum/src/components/Comment.tsx @@ -7,6 +7,7 @@ import { ConfirmModal } from "@app/components/form/ConfirmModal"; import API from "@aws-amplify/api"; import { getIdToken } from "wasedatime-ui"; import ThreadType from "@app/types/thread"; +import { timeFormatter } from "../utils/timeFormatter"; type Props = { comment: CommentType; @@ -18,7 +19,7 @@ type Props = { const convertUrlsToLinks = (text: string) => { if (!text) return null; - const urlRegex = /https?:\/\/[^\s]+/g; + const urlRegex: RegExp = /https?:\/\/[^\s]+/g; const parts = text.split(urlRegex); const matches = text.match(urlRegex); @@ -127,12 +128,15 @@ const Comment = ({ comment, thread, setComments, setThread }: Props) => { } }; + const time = timeFormatter(comment); + console.log(comment); + return (

{convertUrlsToLinks(comment.body)}

-

+

Posted at {time}

{comment.mod === true && (
diff --git a/apps/forum/src/components/CommentForm.tsx b/apps/forum/src/components/CommentForm.tsx index 1871b6011..d470eff1c 100644 --- a/apps/forum/src/components/CommentForm.tsx +++ b/apps/forum/src/components/CommentForm.tsx @@ -66,6 +66,7 @@ const CommentForm: React.FC = ({ ); const newComment: CommentType = response.data; + onNewComment(newComment); setComment(""); @@ -105,12 +106,12 @@ const CommentForm: React.FC = ({ } } catch (error) { console.error("An error occurred:", error); - } finally { } }; return (
+ {/*
Posted at ${time}
*/} = ({ > - {isSignInModalOpen && ( - setSignInModalOpen(false)} - t={t} - /> - )} + setSignInModalOpen(false)} + t={t} + />
); }; diff --git a/apps/forum/src/components/Thread.tsx b/apps/forum/src/components/Thread.tsx index 5ac1ded61..f5f9d36e8 100644 --- a/apps/forum/src/components/Thread.tsx +++ b/apps/forum/src/components/Thread.tsx @@ -80,6 +80,7 @@ const Thread = () => { return (
{/* */} + { const navigate = useNavigate(); + const time = timeFormatter(thread); const renderContent = () => { return (
{

{getTitleBySlug(thread.board_id)}

+ @@ -247,13 +250,17 @@ const ThreadBlock = ({ isPreview, fromRoot, thread, onDelete }: Props) => { > {convertUrlsToLinks(isPreview, thread.body)} +

Posted at {time}

{/*
{" "} {`# ${thread.tag_id}`}
*/}
+ {/* horizontal line break */}
+ {/* The down panel that has like button, views in total, etc...*/} +