MCPcopy
hub / github.com/UdaraJay/Pile / Reply

Function Reply

src/renderer/pages/Pile/Posts/Post/Reply/index.jsx:16–88  ·  view source on GitHub ↗
({
  postPath,
  isLast = false,
  isFirst = false,
  replying = false,
  highlightColor,
  parentPostPath = null,
  reloadParentPost = () => {},
  searchTerm = { searchTerm },
})

Source from the content-addressed store, hash-verified

14import { AIIcon } from 'renderer/icons';
15
16export default function Reply({
17 postPath,
18 isLast = false,
19 isFirst = false,
20 replying = false,
21 highlightColor,
22 parentPostPath = null,
23 reloadParentPost = () => {},
24 searchTerm = { searchTerm },
25}) {
26 const { currentPile } = usePilesContext();
27 const { post, cycleColor } = usePost(postPath);
28 const [editable, setEditable] = useState(false);
29
30 const toggleEditable = () => setEditable(!editable);
31
32 if (!post) return;
33
34 const created = DateTime.fromISO(post.data.createdAt);
35 const replies = post?.data?.replies || [];
36 const isReply = post?.data?.isReply || false;
37 const isAI = post?.data?.isAI || false;
38
39 return (
40 <div>
41 <div className={styles.post}>
42 <div className={styles.left}>
43 <div
44 className={`${styles.connector} ${isFirst && styles.first}`}
45 ></div>
46
47 <div
48 className={`${styles.ball} ${isAI && styles.ai}`}
49 onDoubleClick={cycleColor}
50 style={{
51 backgroundColor: highlightColor ?? 'var(--border)',
52 }}
53 >
54 {isAI && <AIIcon className={styles.iconAI} />}
55 </div>
56 <div
57 className={`${styles.line} ${isAI && styles.ai} ${
58 (!isLast || replying) && styles.show
59 } `}
60 style={{
61 borderColor: highlightColor ?? 'var(--border)',
62 }}
63 ></div>
64 </div>
65 <div className={styles.right}>
66 <div className={styles.header}>
67 <div className={styles.title}>{post.name}</div>
68 <div className={styles.meta}>
69 <div className={styles.time} onClick={toggleEditable}>
70 {created.toRelative()}
71 </div>
72 </div>
73 </div>

Callers

nothing calls this directly

Calls 2

usePilesContextFunction · 0.90
usePostFunction · 0.85

Tested by

no test coverage detected