{#if $commentSelectionDraft}
{@const draft = $commentSelectionDraft}
{$user?.name ?? $i18n.t('Unknown User')}
{middleTruncate(draft.anchor.quote)}
{#key `${resourceQuery(draft.options)}:${draft.options.target_id}:${draft.anchor.surface_id}:${draft.anchor.start}:${draft.anchor.end}`}
{
const created = await commentsRequest('/', 'POST', {
resource_type: draft.options.resource_type,
resource_id: draft.options.resource_id,
target_type: draft.options.target_type,
target_id: draft.options.target_id,
anchor: draft.anchor,
content,
temp_id
});
if (!mounted || $commentSelectionDraft !== draft) return;
postedComment = created;
records = {
...records,
[resourceQuery(created)]: [
...(records[resourceQuery(created)] ?? []).filter(
(item) => item.id !== created.id
),
created
]
};
}}
/>
{/key}
{/if}
{#each hovered as { comment } (comment.id)}
{comment.user?.name ?? $i18n.t('Deleted user')}
{dayjs(comment.created_at / 1e6).fromNow()}
{#if comment.meta?.anchor}
{middleTruncate(comment.meta.anchor.quote)}
{/if}
{/each}