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 === 'feed' && <FeedScreen onNavigate={setScreen} />}
|
||||||
{screen === 'profiles' && <ProfilesScreen onCreateProfile={() => setCreateOpen(true)} />}
|
{screen === 'profiles' && <ProfilesScreen onCreateProfile={() => setCreateOpen(true)} />}
|
||||||
{screen === 'compose' && <ComposeScreen />}
|
{screen === 'compose' && <ComposeScreen onNavigate={setScreen} />}
|
||||||
{screen === 'relays' && <RelaysScreen />}
|
{screen === 'relays' && <RelaysScreen />}
|
||||||
{screen === 'signer' && <SignerScreen />}
|
{screen === 'signer' && <SignerScreen />}
|
||||||
{screen === 'settings' && <SettingsScreen />}
|
{screen === 'settings' && <SettingsScreen />}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { Modal } from '../components/Modal';
|
||||||
import { shortenNpub } from '../lib/format';
|
import { shortenNpub } from '../lib/format';
|
||||||
import { extractImageUrls, extractLinkUrls } from '../lib/media';
|
import { extractImageUrls, extractLinkUrls } from '../lib/media';
|
||||||
import type { LinkPreview } from '../lib/types';
|
import type { LinkPreview } from '../lib/types';
|
||||||
|
import type { Screen } from '../lib/navigation';
|
||||||
import { useApp } from '../state/AppProvider';
|
import { useApp } from '../state/AppProvider';
|
||||||
|
|
||||||
const SOFT_LIMIT = 10_000;
|
const SOFT_LIMIT = 10_000;
|
||||||
|
|
@ -32,7 +33,11 @@ function buildContent(content: string, attachments: Attachment[]): string {
|
||||||
return parts.join('\n');
|
return parts.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ComposeScreen() {
|
interface ComposeScreenProps {
|
||||||
|
onNavigate?: (screen: Screen) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ComposeScreen({ onNavigate }: ComposeScreenProps) {
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
publishNote,
|
publishNote,
|
||||||
|
|
@ -364,6 +369,12 @@ export function ComposeScreen() {
|
||||||
{shortenNpub(lastReport.event_id, true)}
|
{shortenNpub(lastReport.event_id, true)}
|
||||||
</span>
|
</span>
|
||||||
<CopyButton text={lastReport.event_id} label="event ID" />
|
<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 && (
|
{lastReport.failed.length > 0 && (
|
||||||
<details className="alert-details">
|
<details className="alert-details">
|
||||||
<summary>Relays that didn't accept it</summary>
|
<summary>Relays that didn't accept it</summary>
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
|
||||||
<PublicationResult
|
<PublicationResult
|
||||||
lastPublish={lastPublish}
|
lastPublish={lastPublish}
|
||||||
onNavigateCompose={() => onNavigate('compose')}
|
onNavigateCompose={() => onNavigate('compose')}
|
||||||
|
onNavigateFeed={() => onNavigate('feed')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -195,9 +196,11 @@ export function HomeScreen({ onNavigate, onCreateProfile }: HomeScreenProps) {
|
||||||
function PublicationResult({
|
function PublicationResult({
|
||||||
lastPublish,
|
lastPublish,
|
||||||
onNavigateCompose,
|
onNavigateCompose,
|
||||||
|
onNavigateFeed,
|
||||||
}: {
|
}: {
|
||||||
lastPublish: ReturnType<typeof useApp>['lastPublish'];
|
lastPublish: ReturnType<typeof useApp>['lastPublish'];
|
||||||
onNavigateCompose: () => void;
|
onNavigateCompose: () => void;
|
||||||
|
onNavigateFeed: () => void;
|
||||||
}) {
|
}) {
|
||||||
if (!lastPublish) {
|
if (!lastPublish) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -236,6 +239,10 @@ function PublicationResult({
|
||||||
{shortenNpub(report.event_id, true)}
|
{shortenNpub(report.event_id, true)}
|
||||||
</span>
|
</span>
|
||||||
<CopyButton text={report.event_id} label="event ID" />
|
<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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -250,6 +257,10 @@ function PublicationResult({
|
||||||
</code>
|
</code>
|
||||||
</Alert>
|
</Alert>
|
||||||
<CopyButton text={report.event_id} label="event ID" />
|
<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">
|
<details className="alert-details">
|
||||||
<summary>Relay results</summary>
|
<summary>Relay results</summary>
|
||||||
<ul className="relay-result-list">
|
<ul className="relay-result-list">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue