Skip to main content
← All notes
Building

Every comment lives on the thing it is about

softwareaccessibility

The portal has one comment component that works on three different things — sessions, milestones, and goals. The CommentThread takes an entityType and an entityId. It does not care whether it is rendering under a mixing session or a software milestone or an accessibility audit goal. It renders the same thread, the same form, the same submit button. Comments from me show with the accent colour. Comments from the client show in the default text colour. Each comment has an avatar with the author's initials, a timestamp formatted for the UK, and the body text. The form uses React's useActionState hook with a server action — no fetch call, no JSON serialisation, no loading spinner beyond a three-dot indicator on the submit button. The form posts directly to the server. The input and the button both hit the 44px minimum touch target. The hidden fields carry the entity type and entity ID so the server knows where to attach the comment without any client-side state management. One component, three entity types, two visual styles, zero duplicated code. The same thread that tracks feedback on a mastered track also tracks discussion on a software sprint milestone.

Comments coming soon

Sign in with TikTok to leave a comment. Coming soon.