Add 'View in Feed' button after publishing a note
This commit is contained in:
parent
4de8b729c1
commit
b0d9143228
3 changed files with 24 additions and 2 deletions
|
|
@ -71,7 +71,7 @@ function Shell() {
|
|||
)}
|
||||
{screen === 'feed' && <FeedScreen onNavigate={setScreen} />}
|
||||
{screen === 'profiles' && <ProfilesScreen onCreateProfile={() => setCreateOpen(true)} />}
|
||||
{screen === 'compose' && <ComposeScreen />}
|
||||
{screen === 'compose' && <ComposeScreen onNavigate={setScreen} />}
|
||||
{screen === 'relays' && <RelaysScreen />}
|
||||
{screen === 'signer' && <SignerScreen />}
|
||||
{screen === 'settings' && <SettingsScreen />}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
|
@ -32,7 +33,11 @@ function buildContent(content: string, attachments: Attachment[]): string {
|
|||
return parts.join('\n');
|
||||
}
|
||||
|
||||
export function ComposeScreen() {
|
||||
interface ComposeScreenProps {
|
||||
onNavigate?: (screen: Screen) => void;
|
||||
}
|
||||
|
||||
export function ComposeScreen({ onNavigate }: ComposeScreenProps) {
|
||||
const {
|
||||
state,
|
||||
publishNote,
|
||||
|
|
@ -364,6 +369,12 @@ export function ComposeScreen() {
|
|||
{shortenNpub(lastReport.event_id, true)}
|
||||
</span>
|
||||
<CopyButton text={lastReport.event_id} label="event ID" />
|
||||
{onNavigate && (
|
||||
<Button variant="ghost" size="sm" onClick={() => onNavigate('feed')}>
|
||||
<Icon name="list" size={16} />
|
||||
View in Feed
|
||||
</Button>
|
||||
)}
|
||||
{lastReport.failed.length > 0 && (
|
||||
<details className="alert-details">
|
||||
<summary>Relays that didn't accept it</summary>
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
|
|||
<PublicationResult
|
||||
lastPublish={lastPublish}
|
||||
onNavigateCompose={() => onNavigate('compose')}
|
||||
onNavigateFeed={() => onNavigate('feed')}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -195,9 +196,11 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
|
|||
function PublicationResult({
|
||||
lastPublish,
|
||||
onNavigateCompose,
|
||||
onNavigateFeed,
|
||||
}: {
|
||||
lastPublish: ReturnType<typeof useApp>['lastPublish'];
|
||||
onNavigateCompose: () => void;
|
||||
onNavigateFeed: () => void;
|
||||
}) {
|
||||
if (!lastPublish) {
|
||||
return (
|
||||
|
|
@ -236,6 +239,10 @@ function PublicationResult({
|
|||
{shortenNpub(report.event_id, true)}
|
||||
</span>
|
||||
<CopyButton text={report.event_id} label="event ID" />
|
||||
<Button variant="ghost" size="sm" onClick={onNavigateFeed}>
|
||||
<Icon name="list" size={16} />
|
||||
View in Feed
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -250,6 +257,10 @@ function PublicationResult({
|
|||
</code>
|
||||
</Alert>
|
||||
<CopyButton text={report.event_id} label="event ID" />
|
||||
<Button variant="ghost" size="sm" onClick={onNavigateFeed}>
|
||||
<Icon name="list" size={16} />
|
||||
View in Feed
|
||||
</Button>
|
||||
<details className="alert-details">
|
||||
<summary>Relay results</summary>
|
||||
<ul className="relay-result-list">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue