Bump to v0.2.0 — Phase 2: Engagement & Reach

Four features shipped in this release:

- Feed reply context: replies show "↩ replying to @name" above the
  note content; clicking fetches and opens the parent thread

- NIP-65 outbox model: fetchUserRelayList + publishRelayList +
  fetchUserNotesNIP65 in client.ts; profile notes fetched via the
  author's write relays; "Publish relay list to Nostr" button in
  Settings (kind 10002)

- Notifications: new store (notifications.ts) + NotificationsView;
  🔔 sidebar nav item with unread badge; DM nav item also shows
  unread conversation count; badges clear on open/select

- Keyboard shortcuts: useKeyboardShortcuts hook + HelpModal;
  n=compose, /=search, j/k=feed nav with ring highlight,
  Esc=back, ?=help overlay

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jure
2026-03-11 20:39:30 +01:00
parent 181233796b
commit 3a196cb9a0
22 changed files with 479 additions and 63 deletions

View File

@@ -0,0 +1,42 @@
const SHORTCUTS = [
{ key: "n", desc: "New note / focus compose" },
{ key: "/", desc: "Search" },
{ key: "j", desc: "Next note in feed" },
{ key: "k", desc: "Previous note in feed" },
{ key: "Esc", desc: "Go back" },
{ key: "?", desc: "This help" },
];
export function HelpModal({ onClose }: { onClose: () => void }) {
return (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black/50"
onClick={onClose}
>
<div
className="bg-bg border border-border shadow-xl p-6 w-72"
onClick={(e) => e.stopPropagation()}
>
<div className="flex items-center justify-between mb-4">
<h2 className="text-text text-sm font-medium tracking-wide">Keyboard Shortcuts</h2>
<button
onClick={onClose}
className="text-text-dim hover:text-text transition-colors text-[14px]"
>
×
</button>
</div>
<div className="space-y-2">
{SHORTCUTS.map(({ key, desc }) => (
<div key={key} className="flex items-center gap-3">
<kbd className="bg-bg-raised border border-border text-text text-[11px] font-mono px-2 py-0.5 min-w-[2.5rem] text-center shrink-0">
{key}
</kbd>
<span className="text-text-dim text-[12px]">{desc}</span>
</div>
))}
</div>
</div>
</div>
);
}

View File

@@ -1,7 +1,7 @@
import { useState } from "react";
import { useUserStore } from "../../stores/user";
import { useMuteStore } from "../../stores/mute";
import { getNDK, getStoredRelayUrls, addRelay, removeRelay } from "../../lib/nostr";
import { getNDK, getStoredRelayUrls, addRelay, removeRelay, publishRelayList } from "../../lib/nostr";
import { useProfile } from "../../hooks/useProfile";
import { NWCWizard } from "./NWCWizard";
@@ -61,9 +61,12 @@ function RelayRow({ url, onRemove }: { url: string; onRemove: () => void }) {
}
function RelaySection() {
const { loggedIn } = useUserStore();
const [relays, setRelays] = useState<string[]>(() => getStoredRelayUrls());
const [input, setInput] = useState("");
const [error, setError] = useState<string | null>(null);
const [publishing, setPublishing] = useState(false);
const [publishedAt, setPublishedAt] = useState<number | null>(null);
const handleAdd = () => {
const url = input.trim();
@@ -92,6 +95,18 @@ function RelaySection() {
if (e.key === "Escape") setInput("");
};
const handlePublishRelayList = async () => {
setPublishing(true);
try {
await publishRelayList(getStoredRelayUrls());
setPublishedAt(Date.now());
} catch {
// ignore — publishing failure is non-critical
} finally {
setPublishing(false);
}
};
return (
<section>
<h2 className="text-text text-[11px] font-medium uppercase tracking-widest mb-2 text-text-dim">Relays</h2>
@@ -119,6 +134,20 @@ function RelaySection() {
</button>
</div>
{error && <p className="text-danger text-[11px] mt-1">{error}</p>}
{loggedIn && !!getNDK().signer && (
<div className="mt-3">
<button
onClick={handlePublishRelayList}
disabled={publishing}
className="text-[11px] px-3 py-1.5 border border-border text-text-muted hover:text-accent hover:border-accent/40 transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
>
{publishing ? "publishing…" : publishedAt ? "published ✓" : "publish relay list to Nostr"}
</button>
<p className="text-text-dim text-[10px] mt-1">
Saves your relay list as a kind 10002 event (NIP-65) so other clients can find your notes.
</p>
</div>
)}
</section>
);
}