<commit_before>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 tokenizeMessage from '~/logic/lib/tokenizeMessage';
import RichText from '~/views/components/RichText';
import {LocalUpdateRemoteContentPolicy} from "~/types";

const ClickBox = styled(Box)`
  cursor: pointer;
  padding-left: ${p => p.theme.space[2]}px;
`;

interface CommentItemProps {
  pending?: boolean;
  comment: GraphNode;
  contacts: Contacts;
  book: string;
  ship: string;
  api: GlobalApi;
  hideNicknames: boolean;
  hideAvatars: boolean;
  remoteContentPolicy: LocalUpdateRemoteContentPolicy;
}

export function CommentItem(props: CommentItemProps) {
  const { ship, contacts, book, api, remoteContentPolicy } = props;
  const commentData = props.comment?.post;
  const comment = commentData.contents[0] as TextContent;

  const content = tokenizeMessage(comment.text).flat().join(' ');

  const disabled = props.pending || window.ship !== commentData.author;

  const onDelete = async () => {
    await api.graph.removeNodes(ship, book, [commentData?.index]);
  };

  return (
    <Box mb={4} opacity={commentData?.pending ? "60%" : "100%"}>
      <Row bg="white" my={3}>
        <Author
          showImage
          contacts={contacts}
          ship={commentData?.author}
          date={commentData["date-created"]}
          hideAvatars={props.hideAvatars}
          hideNicknames={props.hideNicknames}
        >
          {!disabled && (
            <>
              <ClickBox color="red" onClick={onDelete}>
                Delete
              </ClickBox>
            </>
          )}
        </Author>
      </Row>
      <Box mb={2}>
        <RichText className="f9 white-d" remoteContentPolicy={remoteContentPolicy}>{content}</RichText>
      </Box>
    </Box>
  );
}<commit_msg>CommentItem: pass date correctly<commit_after>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 tokenizeMessage from '~/logic/lib/tokenizeMessage';
import RichText from '~/views/components/RichText';
import {LocalUpdateRemoteContentPolicy} from "~/types";

const ClickBox = styled(Box)`
  cursor: pointer;
  padding-left: ${p => p.theme.space[2]}px;
`;

interface CommentItemProps {
  pending?: boolean;
  comment: GraphNode;
  contacts: Contacts;
  book: string;
  ship: string;
  api: GlobalApi;
  hideNicknames: boolean;
  hideAvatars: boolean;
  remoteContentPolicy: LocalUpdateRemoteContentPolicy;
}

export function CommentItem(props: CommentItemProps) {
  const { ship, contacts, book, api, remoteContentPolicy } = props;
  const commentData = props.comment?.post;
  const comment = commentData.contents[0] as TextContent;

  const content = tokenizeMessage(comment.text).flat().join(' ');

  const disabled = props.pending || window.ship !== commentData.author;

  const onDelete = async () => {
    await api.graph.removeNodes(ship, book, [commentData?.index]);
  };

  return (
    <Box mb={4} opacity={commentData?.pending ? "60%" : "100%"}>
      <Row bg="white" my={3}>
        <Author
          showImage
          contacts={contacts}
          ship={commentData?.author}
          date={commentData?.["time-sent"]}
          hideAvatars={props.hideAvatars}
          hideNicknames={props.hideNicknames}
        >
          {!disabled && (
            <>
              <ClickBox color="red" onClick={onDelete}>
                Delete
              </ClickBox>
            </>
          )}
        </Author>
      </Row>
      <Box mb={2}>
        <RichText className="f9 white-d" remoteContentPolicy={remoteContentPolicy}>{content}</RichText>
      </Box>
    </Box>
  );
}
{'fraction_non_alphanumeric': 0.14269141531322505, 'fraction_numerical': 0.005104408352668214, 'mean_word_length': 3.2556762092793683, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2369015', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1256, 'n_words': 295}