diff --git a/pkg/interface/src/views/apps/links/LinkResource.tsx b/pkg/interface/src/views/apps/links/LinkResource.tsx
index 7d43b1ff4..98b93798f 100644
--- a/pkg/interface/src/views/apps/links/LinkResource.tsx
+++ b/pkg/interface/src/views/apps/links/LinkResource.tsx
@@ -136,6 +136,8 @@ export function LinkResource(props: LinkResourceProps) {
resource={resourcePath}
contacts={contactDetails}
api={api}
+ ship={ship}
+ name={name}
hideAvatars={hideAvatars}
hideNicknames={hideNicknames}
remoteContentPolicy={remoteContentPolicy}
diff --git a/pkg/interface/src/views/apps/links/components/comment-item.js b/pkg/interface/src/views/apps/links/components/comment-item.js
deleted file mode 100644
index 7813e806e..000000000
--- a/pkg/interface/src/views/apps/links/components/comment-item.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import React, { Component } from 'react';
-import { Sigil } from '~/logic/lib/sigil';
-import { cite } from '~/logic/lib/util';
-import moment from 'moment';
-import { Box, Text, Row } from '@tlon/indigo-react';
-import RichText from '~/views/components/RichText';
-
-export const CommentItem = (props) => {
- const content = props.post.contents[0].text;
- const timeSent =
- moment.unix(props.post['time-sent'] / 1000).format('hh:mm a');
-
- const showAvatar = props.avatar && !props.hideAvatars;
- const showNickname = props.nickname && !props.hideNicknames;
- const img = showAvatar
- ?
- : ;
-
- const disabled = props.pending || props.post.author !== window.ship;
-
- const onDelete = async () => {
- const [ship,name] = props.resource.split('/');
- await props.api.graph.removeNodes(`~${ship}`, name, [props.post.index]);
- };
-
- return (
-
-
- {img}
-
-
- {showNickname ? props.nickname : cite(props.post.author)}
-
- {timeSent}
- {!disabled && (
- <>
-
- Delete
-
- >
- )}
-
-
-
-
-
-
- {content}
-
-
-
-
- );
-}
-
diff --git a/pkg/interface/src/views/apps/links/components/comments.js b/pkg/interface/src/views/apps/links/components/comments.js
index 6583127ed..e1642a498 100644
--- a/pkg/interface/src/views/apps/links/components/comments.js
+++ b/pkg/interface/src/views/apps/links/components/comments.js
@@ -1,36 +1,30 @@
import React from 'react';
-import { CommentItem } from './comment-item';
-import { getContactDetails } from '~/logic/lib/util';
+import { CommentItem } from '~/views/components/CommentItem';
export const Comments = (props) => {
const {
hideNicknames,
hideAvatars,
- remoteContentPolicy
+ remoteContentPolicy,
+ ship,
+ name
} = props;
const contacts = props.contacts ? props.contacts : {};
return (
- { Array.from(props.comments).map(([date, comment]) => {
- const { nickname, color, member, avatar } =
- getContactDetails(contacts[comment.post.author]);
-
- const nameClass = nickname && !hideNicknames ? 'inter' : 'mono';
-
+ { Array.from(props.comments).reverse().map(([idx, comment]) => {
return (
{
try {
const post = createPost([{ text: comment }], comments?.post?.index);
- await api.graph.addPost(ship, book, post)
+ await api.graph.addPost(ship, book, post);
actions.resetForm();
actions.setStatus({ success: null });
} catch (e) {
@@ -51,7 +48,7 @@ export function Comments(props: CommentsProps) {
key={idx}
contacts={props.contacts}
api={api}
- book={book}
+ name={book}
ship={ship}
hideNicknames={props.hideNicknames}
hideAvatars={props.hideAvatars}
diff --git a/pkg/interface/src/views/apps/publish/components/Note.tsx b/pkg/interface/src/views/apps/publish/components/Note.tsx
index 511ff8c22..9af108447 100644
--- a/pkg/interface/src/views/apps/publish/components/Note.tsx
+++ b/pkg/interface/src/views/apps/publish/components/Note.tsx
@@ -34,13 +34,13 @@ export function Note(props: NoteProps & RouteComponentProps) {
const deletePost = async () => {
setDeleting(true);
const indices = [note.post.index]
- await api.graph.removeNodes(ship, book, indices);
+ await api.graph.removeNodes(ship, book, indices);
props.history.push(rootUrl);
};
const comments = getComments(note);
const [revNum, title, body, post] = getLatestRevision(note);
-
+
const noteId = bigInt(note.post.index.split('/')[1]);
let adminLinks: JSX.Element | null = null;
diff --git a/pkg/interface/src/views/apps/publish/components/CommentItem.tsx b/pkg/interface/src/views/components/CommentItem.tsx
similarity index 66%
rename from pkg/interface/src/views/apps/publish/components/CommentItem.tsx
rename to pkg/interface/src/views/components/CommentItem.tsx
index 289eb18d9..bed0901f2 100644
--- a/pkg/interface/src/views/apps/publish/components/CommentItem.tsx
+++ b/pkg/interface/src/views/components/CommentItem.tsx
@@ -1,15 +1,14 @@
-import React, { useState } from "react";
-import CommentInput from "./CommentInput";
-import { Comment, NoteId } from "~/types/publish-update";
-import { Contacts } from "~/types/contact-update";
-import GlobalApi from "~/logic/api/global";
-import { Box, Row } from "@tlon/indigo-react";
-import styled from "styled-components";
-import { Author } from "./Author";
-import {GraphNode, TextContent} from "~/types/graph-update";
+import React, { useState } from 'react';
+import { Comment, NoteId } from '~/types/publish-update';
+import { Contacts } from '~/types/contact-update';
+import GlobalApi from '~/logic/api/global';
+import { Box, Row } from '@tlon/indigo-react';
+import styled from 'styled-components';
+import { Author } from '~/views/apps/publish/components/Author';
+import { GraphNode, TextContent } from '~/types/graph-update';
import tokenizeMessage from '~/logic/lib/tokenizeMessage';
import RichText from '~/views/components/RichText';
-import {LocalUpdateRemoteContentPolicy} from "~/types";
+import { LocalUpdateRemoteContentPolicy } from '~/types';
const ClickBox = styled(Box)`
cursor: pointer;
@@ -20,7 +19,7 @@ interface CommentItemProps {
pending?: boolean;
comment: GraphNode;
contacts: Contacts;
- book: string;
+ name: string;
ship: string;
api: GlobalApi;
hideNicknames: boolean;
@@ -29,7 +28,7 @@ interface CommentItemProps {
}
export function CommentItem(props: CommentItemProps) {
- const { ship, contacts, book, api, remoteContentPolicy } = props;
+ const { ship, contacts, name, api, remoteContentPolicy } = props;
const commentData = props.comment?.post;
const comment = commentData.contents[0] as TextContent;
@@ -38,17 +37,17 @@ export function CommentItem(props: CommentItemProps) {
const disabled = props.pending || window.ship !== commentData.author;
const onDelete = async () => {
- await api.graph.removeNodes(ship, book, [commentData?.index]);
+ await api.graph.removeNodes(ship, name, [commentData?.index]);
};
return (
-
+