{#each threads as thread (thread.root.id)} {#if state.comments} {@const comments = state.comments} {@const isDraftThread = comments.draftThreadIds?.includes(thread.root.id) ?? false} {@const anchor = anchorLabel(thread)}
state.onHoverThread(thread.root.id)} onmouseleave={() => state.onHoverThread(undefined)}> { await comments.createComment(body, embeds, thread.root.id); } : undefined} editComment={comments.editComment} canModifyComment={partial( roles.isDelegateOrAuthor, comments.config.publicKey, comments.repoDelegates.map(delegate => delegate.did), )} deleteComment={comments.deleteComment} changeCommentStatus={isDraftThread ? undefined : comments.changeCommentStatus} canResolve={!isDraftThread && Boolean(comments.changeCommentStatus) && (comments.canResolveComment?.(thread.root.id) ?? false)}> {#snippet hoverNote()} {#if anchor} on {anchor} {/if} {/snippet}
{/if} {/each} {#if composer && state.comments && state.commit} {@const comments = state.comments} {@const location = locationOf(state.commit, composer)}
state.composerBody, value => { state.composerBody = value; state.onComposerInput(value); } } disallowEmptyBody rid={comments.rid} onclose={() => state.onCloseComposer()} focus placeholder="Leave a comment" submitCaption={comments.newCommentCaption} submitDescription={comments.newCommentDescription} disableAttachments={comments.disableAttachments} submit={async (body, embeds) => { try { await comments.createComment(body, embeds, undefined, location); } catch (error) { console.error("Comment creation failed", error); } finally { state.onCloseComposer(); } }} secondarySubmit={comments.addCodeCommentDirect ? { caption: comments.addCodeCommentDirectCaption ?? "Just comment", description: comments.addCodeCommentDirectDescription, submit: async (body, embeds) => { try { await comments.addCodeCommentDirect?.(body, embeds, location); } catch (error) { console.error("Comment creation failed", error); } finally { state.onCloseComposer(); } }, } : undefined} />
{/if}