diff --git a/src-tauri/migrations/20230226004139_create_tables.sql b/src-tauri/migrations/20230226004139_create_tables.sql index 2855380c..24603813 100644 --- a/src-tauri/migrations/20230226004139_create_tables.sql +++ b/src-tauri/migrations/20230226004139_create_tables.sql @@ -85,5 +85,6 @@ CREATE TABLE kind INTEGER NOT NULL DEFAULT 1, tags TEXT NOT NULL, content TEXT NOT NULL, - parent_id TEXT + parent_id TEXT, + parent_comment_id TEXT ); \ No newline at end of file diff --git a/src/components/note/metadata.tsx b/src/components/note/metadata.tsx index 5b6a8110..ef0cf36a 100644 --- a/src/components/note/metadata.tsx +++ b/src/components/note/metadata.tsx @@ -4,6 +4,8 @@ import { RelayContext } from '@components/relaysProvider'; import { relaysAtom } from '@stores/relays'; +import { createCacheCommentNote } from '@utils/storage'; + import { useAtomValue } from 'jotai'; import { useContext, useEffect, useState } from 'react'; @@ -37,7 +39,10 @@ export default function NoteMetadata({ (event: any) => { switch (event.kind) { case 1: + // update state setComments((comments) => (comments += 1)); + // save comment to database + createCacheCommentNote(event, eventID); break; case 7: if (event.content === '🤙' || event.content === '+') { diff --git a/src/components/note/repost.tsx b/src/components/note/repost.tsx index 1f5dfddd..61fe6bae 100644 --- a/src/components/note/repost.tsx +++ b/src/components/note/repost.tsx @@ -86,7 +86,7 @@ export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) { if (event) { return ( -