Bump to v0.5.0 — note sharing, reply counts

This commit is contained in:
Jure
2026-03-15 21:49:52 +01:00
parent 5b4f6381da
commit 8ce1d43d2d
10 changed files with 85 additions and 9 deletions

View File

@@ -66,7 +66,11 @@ jobs:
> **Windows note:** The installer is not yet code-signed. Windows SmartScreen will show an "Unknown publisher" warning — click "More info → Run anyway" to install.
### New in v0.4.1 — Media & Feed Fixes
### New in v0.5.0 — Sharing & Thread Indicators
- **Note sharing** — share button on every note copies a `nostr:nevent1…` URI to clipboard; works when logged out too
- **Reply count** — notes now show reply count next to the reply button; updates optimistically when you reply
### Previous: v0.4.1 — Media & Feed Fixes
- **Video player** — direct video URLs (.mp4, .webm, .mov, etc.) now render as inline players with native controls
- **Audio player** — direct audio URLs (.mp3, .wav, .flac, etc.) render as inline audio players with filename display
- **YouTube/Vimeo rich cards** — YouTube links show thumbnail previews, Vimeo/Spotify/Tidal show branded cards; all open in external browser

View File

@@ -1,6 +1,6 @@
# Maintainer: hoornet <hoornet@users.noreply.github.com>
pkgname=wrystr
pkgver=0.4.1
pkgver=0.5.0
pkgrel=1
pkgdesc="Cross-platform Nostr desktop client with Lightning integration"
arch=('x86_64')

View File

@@ -1,7 +1,7 @@
{
"name": "wrystr",
"private": true,
"version": "0.4.1",
"version": "0.5.0",
"type": "module",
"scripts": {
"dev": "vite",

2
src-tauri/Cargo.lock generated
View File

@@ -5824,7 +5824,7 @@ dependencies = [
[[package]]
name = "wrystr"
version = "0.4.1"
version = "0.5.0"
dependencies = [
"keyring",
"rusqlite",

View File

@@ -1,6 +1,6 @@
[package]
name = "wrystr"
version = "0.4.1"
version = "0.5.0"
description = "Cross-platform Nostr desktop client with Lightning integration"
authors = ["hoornet"]
edition = "2021"

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Wrystr",
"version": "0.4.1",
"version": "0.5.0",
"identifier": "com.hoornet.wrystr",
"build": {
"beforeDevCommand": "npm run dev",

View File

@@ -2,12 +2,14 @@ import { useState, useRef, useEffect } from "react";
import { NDKEvent } from "@nostr-dev-kit/ndk";
import { useProfile } from "../../hooks/useProfile";
import { useReactionCount } from "../../hooks/useReactionCount";
import { useReplyCount } from "../../hooks/useReplyCount";
import { useZapCount } from "../../hooks/useZapCount";
import { useUserStore } from "../../stores/user";
import { useMuteStore } from "../../stores/mute";
import { useBookmarkStore } from "../../stores/bookmark";
import { useUIStore } from "../../stores/ui";
import { timeAgo, shortenPubkey } from "../../lib/utils";
import { nip19 } from "@nostr-dev-kit/ndk";
import { publishReaction, publishReply, publishRepost, getNDK, fetchNoteById } from "../../lib/nostr";
import { NoteContent } from "./NoteContent";
import { ZapModal } from "../zap/ZapModal";
@@ -61,6 +63,8 @@ export function NoteCard({ event, focused }: NoteCardProps) {
const [liked, setLiked] = useState(() => getLiked().has(event.id));
const [liking, setLiking] = useState(false);
const [reactionCount, adjustReactionCount] = useReactionCount(event.id);
const [replyCount, adjustReplyCount] = useReplyCount(event.id);
const [copied, setCopied] = useState(false);
const zapData = useZapCount(event.id);
const [showReply, setShowReply] = useState(false);
const [replyText, setReplyText] = useState("");
@@ -102,6 +106,7 @@ export function NoteCard({ event, focused }: NoteCardProps) {
await publishReply(replyText.trim(), { id: event.id, pubkey: event.pubkey });
setReplyText("");
setReplySent(true);
adjustReplyCount(1);
setTimeout(() => { setShowReply(false); setReplySent(false); }, 1500);
} catch (err) {
setReplyError(`Failed: ${err}`);
@@ -115,6 +120,13 @@ export function NoteCard({ event, focused }: NoteCardProps) {
if (e.key === "Escape") setShowReply(false);
};
const handleShare = async () => {
const nevent = nip19.neventEncode({ id: event.id!, author: event.pubkey });
await navigator.clipboard.writeText("nostr:" + nevent);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
const handleRepost = async () => {
if (reposting || reposted) return;
setReposting(true);
@@ -235,7 +247,7 @@ export function NoteCard({ event, focused }: NoteCardProps) {
showReply ? "text-accent" : "text-text-dim hover:text-text"
}`}
>
reply
reply{replyCount !== null && replyCount > 0 ? ` ${replyCount}` : ""}
</button>
<button
onClick={handleLike}
@@ -279,18 +291,37 @@ export function NoteCard({ event, focused }: NoteCardProps) {
>
{isBookmarked ? "▪ saved" : "▫ save"}
</button>
<button
onClick={handleShare}
className={`text-[11px] transition-colors ${
copied ? "text-accent" : "text-text-dim hover:text-text"
}`}
>
{copied ? "copied ✓" : "share"}
</button>
</div>
)}
{/* Stats visible when logged out */}
{!loggedIn && (reactionCount !== null && reactionCount > 0 || zapData !== null && zapData.totalSats > 0) && (
{!loggedIn && (
<div className="flex items-center gap-3 mt-1.5">
{replyCount !== null && replyCount > 0 && (
<span className="text-text-dim text-[11px]"> {replyCount}</span>
)}
{reactionCount !== null && reactionCount > 0 && (
<span className="text-text-dim text-[11px]"> {reactionCount}</span>
)}
{zapData !== null && zapData.totalSats > 0 && (
<span className="text-zap text-[11px]"> {zapData.totalSats.toLocaleString()} sats</span>
)}
<button
onClick={handleShare}
className={`text-[11px] transition-colors ${
copied ? "text-accent" : "text-text-dim hover:text-text"
}`}
>
{copied ? "copied ✓" : "share"}
</button>
</div>
)}

View File

@@ -0,0 +1,29 @@
import { useEffect, useState } from "react";
import { fetchReplyCount } from "../lib/nostr";
const cache = new Map<string, number>();
export function useReplyCount(eventId: string): [number | null, (delta: number) => void] {
const [count, setCount] = useState<number | null>(() => cache.get(eventId) ?? null);
useEffect(() => {
if (cache.has(eventId)) {
setCount(cache.get(eventId)!);
return;
}
fetchReplyCount(eventId).then((n) => {
cache.set(eventId, n);
setCount(n);
});
}, [eventId]);
const adjust = (delta: number) => {
setCount((prev) => {
const next = (prev ?? 0) + delta;
cache.set(eventId, next);
return next;
});
};
return [count, adjust];
}

View File

@@ -313,6 +313,18 @@ export async function fetchZapCount(eventId: string): Promise<{ count: number; t
return { count: events.size, totalSats };
}
export async function fetchReplyCount(eventId: string): Promise<number> {
const instance = getNDK();
const filter: NDKFilter = {
kinds: [NDKKind.Text],
"#e": [eventId],
};
const events = await instance.fetchEvents(filter, {
cacheUsage: NDKSubscriptionCacheUsage.ONLY_RELAY,
});
return events.size;
}
export async function fetchReactionCount(eventId: string): Promise<number> {
const instance = getNDK();
const filter: NDKFilter = {

View File

@@ -1,2 +1,2 @@
export { getNDK, connectToRelays, fetchGlobalFeed, fetchFollowFeed, fetchReplies, publishNote, publishArticle, publishProfile, publishReaction, publishRepost, publishQuote, publishReply, publishContactList, fetchReactionCount, fetchZapCount, fetchNoteById, fetchUserNotes, fetchProfile, fetchArticle, fetchAuthorArticles, fetchZapsReceived, fetchZapsSent, fetchDMConversations, fetchDMThread, sendDM, decryptDM, fetchBookmarkList, publishBookmarkList, fetchMuteList, publishMuteList, getStoredRelayUrls, addRelay, removeRelay, searchNotes, searchUsers, fetchUserRelayList, publishRelayList, fetchUserNotesNIP65, fetchFollowSuggestions, fetchMentions } from "./client";
export { getNDK, connectToRelays, fetchGlobalFeed, fetchFollowFeed, fetchReplies, publishNote, publishArticle, publishProfile, publishReaction, publishRepost, publishQuote, publishReply, publishContactList, fetchReactionCount, fetchReplyCount, fetchZapCount, fetchNoteById, fetchUserNotes, fetchProfile, fetchArticle, fetchAuthorArticles, fetchZapsReceived, fetchZapsSent, fetchDMConversations, fetchDMThread, sendDM, decryptDM, fetchBookmarkList, publishBookmarkList, fetchMuteList, publishMuteList, getStoredRelayUrls, addRelay, removeRelay, searchNotes, searchUsers, fetchUserRelayList, publishRelayList, fetchUserNotesNIP65, fetchFollowSuggestions, fetchMentions } from "./client";
export type { UserRelayList } from "./client";