feat(live-chat): show NIP-75 zap goal at top of live stream chat
Add a goalEventId() accessor on LiveActivitiesEvent that reads the zap.stream `["goal", "<hex>"]` tag. When a stream channel's 30311 event references a goal, fetch the kind 9041 event and its zap receipts (#e=<goalId>) so the existing goal-progress aggregation works. Render a compact LiveStreamGoalHeader above the chat feed showing the goal title, the existing GoalProgressBar, and a one-tap ZapReaction that targets the goal event so viewers can contribute directly to the fundraiser without leaving the stream. https://claude.ai/code/session_01WJA5PvDABegBYUu6h42YZi
This commit is contained in:
+7
@@ -117,6 +117,12 @@ class LiveActivitiesEvent(
|
||||
|
||||
fun pinned() = tags.mapNotNull(PinnedEventTag::parse)
|
||||
|
||||
/**
|
||||
* zap.stream convention: a NIP-75 zap goal (kind 9041) is attached to a live stream
|
||||
* via a flat tag `["goal", "<hex event id>"]` on the 30311 event.
|
||||
*/
|
||||
fun goalEventId(): HexKey? = tags.firstOrNull { it.size > 1 && it[0] == GOAL_TAG && it[1].isNotEmpty() }?.get(1)
|
||||
|
||||
fun checkStatus(eventStatus: StatusTag.STATUS?): StatusTag.STATUS? =
|
||||
if (eventStatus == StatusTag.STATUS.LIVE && createdAt < TimeUtils.eightHoursAgo()) {
|
||||
StatusTag.STATUS.ENDED
|
||||
@@ -139,6 +145,7 @@ class LiveActivitiesEvent(
|
||||
companion object {
|
||||
const val KIND = 30311
|
||||
const val ALT = "Live activity event"
|
||||
const val GOAL_TAG = "goal"
|
||||
|
||||
suspend fun create(
|
||||
signer: NostrSigner,
|
||||
|
||||
Reference in New Issue
Block a user