PostHeader
Location: src/components/post-parts/PostHeader.jsx
Overview
PostHeader renders the metadata bar at the top of a post card. It displays the author's name (linked to their HomeRoom), the post timestamp, an "(edited)" indicator if applicable, a voice narration icon, and audience visibility information. For circle-restricted posts, the first circle name is shown as a link with a count of additional circles.
This is a presentational sub-component of the Post component, extracted to keep Post.jsx manageable.
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
author | object | Yes | -- | Author profile with id, username, and display_name |
createdAt | string | Yes | -- | ISO timestamp of post creation |
editedAt | string | No | -- | ISO timestamp of last edit (shows "(edited)" indicator) |
hasVoice | boolean | No | -- | Whether the post has voice narration |
audience | string | No | -- | Post audience: 'public', 'friends', or 'circles' |
circles | array | No | -- | Array of { id, name } objects for circle audience display |
onStopPropagation | function | No | -- | Click handler to prevent post card navigation when clicking links |
Key Behaviors
- Author Link: Links to
/room/:username(or/room/:idas fallback). UsesonStopPropagationto prevent the post card click handler from firing. - Timestamp: Formatted via the
formatPostTimeutility. - Edit Indicator: When
editedAtis provided, shows "(edited)" with a tooltip showing the edit timestamp. - Voice Indicator: A small Volume2 icon appears when the post has voice narration.
- Audience Display: Public posts show no indicator. Friends-only posts show a lock with "Friends only". Circle posts show the first circle name as a link, with "+N" for additional circles.
Usage
import PostHeader from '@/components/post-parts/PostHeader';
<PostHeader
author={post.profiles}
createdAt={post.created_at}
editedAt={post.edited_at}
hasVoice={!!post.voice_url}
audience={post.audience}
circles={circleList}
onStopPropagation={(e) => e.stopPropagation()}
/>
Related
- Post -- Parent component that renders PostHeader
- IntentBadge -- Rendered alongside PostHeader in the post card
Last updated: 2026-02-07