Fix FAB on Webxdc page by passing onFabClick through KindFeedPage

KindFeedPage's own useLayoutOptions was overwriting the onFabClick
set by WebxdcFeedPage. Now onFabClick is a KindFeedPage prop that
gets forwarded to useLayoutOptions, so only one call wins.
This commit is contained in:
Alex Gleason
2026-02-27 11:24:56 -06:00
parent 658c7d1dc1
commit 14ffa8f7e4
2 changed files with 5 additions and 5 deletions
+4 -2
View File
@@ -24,9 +24,11 @@ interface KindFeedPageProps {
tagFilters?: Record<string, string[]>;
/** Extra content rendered after the feed header (e.g. a custom compose dialog). */
extra?: React.ReactNode;
/** If set, overrides the default FAB click behavior. */
onFabClick?: () => void;
}
export function KindFeedPage({ kind, title, icon, emptyMessage, kindDef, backTo = '/', alwaysShowBack, fabHref, tagFilters, extra }: KindFeedPageProps) {
export function KindFeedPage({ kind, title, icon, emptyMessage, kindDef, backTo = '/', alwaysShowBack, fabHref, tagFilters, extra, onFabClick }: KindFeedPageProps) {
const primaryKind = Array.isArray(kind) ? kind[0] : kind;
const resolvedDef = useMemo(
@@ -39,7 +41,7 @@ export function KindFeedPage({ kind, title, icon, emptyMessage, kindDef, backTo
description: `${title} on Nostr`,
});
useLayoutOptions({ showFAB: true, fabKind: primaryKind, fabHref });
useLayoutOptions({ showFAB: true, fabKind: primaryKind, fabHref, onFabClick });
const kinds = Array.isArray(kind) ? kind : [kind];
+1 -3
View File
@@ -1,6 +1,5 @@
import { useState, useCallback } from 'react';
import { Blocks } from 'lucide-react';
import { useLayoutOptions } from '@/contexts/LayoutContext';
import { KindFeedPage } from '@/pages/KindFeedPage';
import { WebxdcUploadDialog } from '@/components/WebxdcUploadDialog';
@@ -13,14 +12,13 @@ export function WebxdcFeedPage() {
setUploadOpen(true);
}, []);
useLayoutOptions({ showFAB: true, fabKind: 1063, onFabClick: handleFabClick });
return (
<KindFeedPage
kind={1063}
title="Webxdc"
icon={<Blocks className="size-5" />}
tagFilters={TAG_FILTERS}
onFabClick={handleFabClick}
emptyMessage="No webxdc apps found yet. Check your relay connections or try again later."
extra={<WebxdcUploadDialog open={uploadOpen} onOpenChange={setUploadOpen} />}
/>