Comments
{#if canEdit}
{submitting ? 'Posting...' : 'Comment'}
{/if}
{#each localComments as comment}
{comment.user.name[0].toUpperCase()}
{comment.user.name}
{formatDistanceToNow(new Date(comment.createdAt), { addSuffix: true })}
{#if editingId === comment.id}
updateComment(comment.id)} class="rounded bg-[var(--color-primary)] px-2 py-1 text-xs text-white" > Save
(editingId = null)} class="text-xs text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300" > Cancel
{:else}
{#if ready} {@html renderMarkdown(comment.content)} {:else}
{comment.content}
{/if}
{#if comment.userId === currentUserId}
startEdit(comment)} class="text-xs text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300" > Edit
{/if} {#if comment.userId === currentUserId || canEdit}
deleteComment(comment.id)} class="text-xs text-gray-400 dark:text-gray-500 hover:text-red-500" > Delete
{/if}
{/if}
{/each}
{#if localComments.length === 0}
No comments yet
{/if}