From cd5d2d7fd1aad079b2e306316341ffcf77c0e95f Mon Sep 17 00:00:00 2001 From: Avi Date: Tue, 1 Sep 2026 13:06:33 -0500 Subject: [PATCH] Show published note content inline on Home screen --- frontend/src/App.tsx | 2 +- frontend/src/lib/types.ts | 3 +++ frontend/src/screens/ComposeScreen.tsx | 13 +--------- frontend/src/screens/HomeScreen.tsx | 33 ++++++++++---------------- frontend/src/styles.css | 12 ++++++++++ src/ipc.rs | 5 +++- src/vault.rs | 2 ++ 7 files changed, 36 insertions(+), 34 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 48c9e4f..be6814f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -71,7 +71,7 @@ function Shell() { )} {screen === 'feed' && } {screen === 'profiles' && setCreateOpen(true)} />} - {screen === 'compose' && } + {screen === 'compose' && } {screen === 'relays' && } {screen === 'signer' && } {screen === 'settings' && } diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts index 0713cc7..fa8d521 100644 --- a/frontend/src/lib/types.ts +++ b/frontend/src/lib/types.ts @@ -66,6 +66,8 @@ export interface PublishReport { event_id: string; succeeded: string[]; failed: RelayFailure[]; + /** The note content that was published. */ + content?: string; } /** Per-relay outcome of publishing a profile's name as kind 0 metadata. */ @@ -145,6 +147,7 @@ export interface AppState { event_id: string; succeeded: string[]; failed: RelayFailure[]; + content: string; } | null; } diff --git a/frontend/src/screens/ComposeScreen.tsx b/frontend/src/screens/ComposeScreen.tsx index 092ba17..26fc6e2 100644 --- a/frontend/src/screens/ComposeScreen.tsx +++ b/frontend/src/screens/ComposeScreen.tsx @@ -9,7 +9,6 @@ import { Modal } from '../components/Modal'; import { shortenNpub } from '../lib/format'; import { extractImageUrls, extractLinkUrls } from '../lib/media'; import type { LinkPreview } from '../lib/types'; -import type { Screen } from '../lib/navigation'; import { useApp } from '../state/AppProvider'; const SOFT_LIMIT = 10_000; @@ -33,11 +32,7 @@ function buildContent(content: string, attachments: Attachment[]): string { return parts.join('\n'); } -interface ComposeScreenProps { - onNavigate?: (screen: Screen) => void; -} - -export function ComposeScreen({ onNavigate }: ComposeScreenProps) { +export function ComposeScreen() { const { state, publishNote, @@ -369,12 +364,6 @@ export function ComposeScreen({ onNavigate }: ComposeScreenProps) { {shortenNpub(lastReport.event_id, true)} - {onNavigate && ( - - )} {lastReport.failed.length > 0 && (
Relays that didn't accept it diff --git a/frontend/src/screens/HomeScreen.tsx b/frontend/src/screens/HomeScreen.tsx index 9113816..a62aff9 100644 --- a/frontend/src/screens/HomeScreen.tsx +++ b/frontend/src/screens/HomeScreen.tsx @@ -184,7 +184,6 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) { onNavigate('compose')} - onNavigateFeed={() => onNavigate('feed')} /> @@ -196,11 +195,9 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) { function PublicationResult({ lastPublish, onNavigateCompose, - onNavigateFeed, }: { lastPublish: ReturnType['lastPublish']; onNavigateCompose: () => void; - onNavigateFeed: () => void; }) { if (!lastPublish) { return ( @@ -231,19 +228,18 @@ function PublicationResult({ if (report.failed.length === 0) { return ( -
- - Published - - - {shortenNpub(report.event_id, true)} - - - -
+ <> +
+ + Published + + + {shortenNpub(report.event_id, true)} + + +
+ {report.content &&

{report.content}

} + ); } @@ -257,10 +253,7 @@ function PublicationResult({ - + {report.content &&

{report.content}

}
Relay results
    diff --git a/frontend/src/styles.css b/frontend/src/styles.css index 884918d..09d5c52 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -1587,6 +1587,18 @@ select { flex-basis: 100%; } +.publish-preview { + margin: 8px 0 0; + padding: 10px 12px; + background: var(--surface-2); + border-radius: var(--radius-sm); + font-size: 14px; + line-height: 1.5; + white-space: pre-wrap; + word-break: break-word; + max-width: 65ch; +} + .relay-result-list { margin: 8px 0 0; padding-left: 18px; diff --git a/src/ipc.rs b/src/ipc.rs index d9f6bd1..28b4171 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -468,8 +468,11 @@ async fn run_with_app(app: &mut App, request: Request) -> Result, pub failed: Vec, + #[serde(default)] + pub content: String, } /// Load the last publish report, returning `None` when absent or unreadable.