|
@@ -1,14 +1,11 @@
|
|
|
import React from "react";
|
|
|
import User from "../User";
|
|
|
import { Handles } from "../../types";
|
|
|
+import { domain } from "../../config";
|
|
|
import moment from "moment";
|
|
|
import Markdown from "react-markdown";
|
|
|
import gfm from "remark-gfm";
|
|
|
|
|
|
-const formatTime = (time: number) => {
|
|
|
- return moment(time).format("DD/MM/YYYY HH:mm");
|
|
|
-};
|
|
|
-
|
|
|
const PostBox = (props: {
|
|
|
startTime: number;
|
|
|
handles: Handles;
|
|
@@ -16,15 +13,18 @@ const PostBox = (props: {
|
|
|
authorId: string;
|
|
|
createdAt: { block: number; time: number };
|
|
|
text: string;
|
|
|
+ threadId: number;
|
|
|
}) => {
|
|
|
- const { createdAt, startTime, id, authorId, handles, text } = props;
|
|
|
- const created = formatTime(startTime + createdAt.block * 6000);
|
|
|
+ const { createdAt, startTime, id, authorId, handles, text, threadId } = props;
|
|
|
+ const created = moment(startTime + createdAt.block * 6000).fromNow();
|
|
|
|
|
|
return (
|
|
|
<div className="box" key={id}>
|
|
|
- <div className="float-right">{created}</div>
|
|
|
+ <div className="float-right">
|
|
|
+ <a href={`${domain}/#/forum/threads/${threadId}`}>reply</a>
|
|
|
+ </div>
|
|
|
+ <div className="float-left">{created}</div>
|
|
|
<User key={authorId} id={authorId} handle={handles[authorId]} />
|
|
|
-
|
|
|
<Markdown
|
|
|
plugins={[gfm]}
|
|
|
className="mt-1 overflow-auto text-left"
|