Skip to main content

PostActions

Location: src/components/post-parts/PostActions.jsx

Overview

PostActions renders the action button bar at the bottom of a post card. It provides contextual actions based on whether the current user is the author and the post's current state. Actions include replying, editing, deleting, sharing (copy link), sharing to a circle, building on a post, reporting, and saving with shelf options.

All buttons use data-tooltip attributes for accessible labels and consistent tooltip styling.

Relevant Invariants

  • Invariant #6: "No Public Comparative Metrics" -- The comment count is shown but no likes, views, or other engagement metrics.
  • Invariant #5: "Repair Over Punishment" -- Edit is available as a standard action, not hidden.

Props

PropTypeRequiredDefaultDescription
commentCountnumberYes--Number of responses on the post
isAuthorbooleanYes--Whether the current user authored this post
isSavedbooleanYes--Whether the post is currently saved
savingbooleanYes--Whether a save operation is in progress
hideSaveButtonbooleanNo--Hides the save button group (used on SavedPage)
showAddNotebooleanNo--Shows an "Add Note" button (used on SavedPage for posts without notes)
saveButtonRefrefNo--Ref attached to the save button for popover positioning
onCommentClickfunctionYes--Handler for clicking the reply button
onEditClickfunctionNo--Handler for clicking edit (author only)
onDeleteClickfunctionNo--Handler for clicking delete (author only)
onShareClickfunctionYes--Handler for copying the post link
onShareToCirclefunctionNo--Handler for sharing to a circle
canShareToCirclebooleanNofalseWhether circle sharing is available
onBuildOnfunctionNo--Handler for building on the post
canBuildOnbooleanNofalseWhether the build-on action is available
onQuickSavefunctionNo--Handler for quick-saving (default shelf)
onShowSaveOptionsfunctionNo--Handler for opening the save options popover
onStartAddNotefunctionNo--Handler for starting to add a note to a saved post
onReportClickfunctionNo--Handler for reporting the post (non-author only)
onSettingsClickfunctionNo--Handler for post settings menu (author only)

Key Behaviors

  • Author Actions: Edit, Delete, and Settings buttons appear only for the post author.
  • Save Button Group: A split button with quick-save and a dropdown chevron for shelf selection. Hidden on the saved posts page.
  • Report Button: Appears only for non-authors when onReportClick is provided.
  • Build On: A reply icon that lets users create a new post that references this one. Only shown when canBuildOn is true.
  • Share to Circle: A Users icon for sharing the post to a circle. Only shown when canShareToCircle is true.

Usage

import PostActions from '@/components/post-parts/PostActions';

<PostActions
commentCount={post.comments?.length || 0}
isAuthor={session.user.id === post.user_id}
isSaved={isSaved}
saving={saving}
onCommentClick={handleComment}
onEditClick={handleEdit}
onDeleteClick={handleDelete}
onShareClick={handleShare}
onQuickSave={handleQuickSave}
onShowSaveOptions={handleShowSaveOptions}
/>
  • Post -- Parent component that renders PostActions
  • SavePopover -- Shelf selection popover triggered by save options

Last updated: 2026-02-07