diff --git a/src/components/AppShowcaseCard.tsx b/src/components/AppShowcaseCard.tsx index d16aef96..6f8f9b32 100644 --- a/src/components/AppShowcaseCard.tsx +++ b/src/components/AppShowcaseCard.tsx @@ -12,70 +12,71 @@ interface AppShowcaseCardProps { } export function AppShowcaseCard({ app }: AppShowcaseCardProps) { - const [imageError, setImageError] = useState(false); + const [bannerError, setBannerError] = useState(false); + const [iconError, setIconError] = useState(false); const { data: authorData } = useAuthor(app.pubkey); - const authorNpub = nip19.npubEncode(app.pubkey); return ( - - {/* App Icon / Header */} -
- - {app.appIconUrl && !imageError ? ( + + {/* Banner + overlapping icon */} + + {/* Banner */} +
+ {app.bannerUrl && !bannerError ? ( {`${app.appName} setImageError(true)} + onError={() => setBannerError(true)} /> ) : ( -
-
-
- -
-

No preview

-
-
+
)} - -
- - -
-
-
-

- {app.appName.length > 50 ? `${app.appName.slice(0, 50)}...` : app.appName} -

-
-
+ {/* Icon overlapping banner */} +
+
+ {app.appIconUrl && !iconError ? ( + {`${app.appName} setIconError(true)} + /> + ) : ( +
+ +
+ )} +
+
+ + + +

+ {app.appName} +

+ {app.description && ( -

{app.description}

+

{app.description}

)} - {/* Author Information */} + {/* Author */}
-
+
{authorData?.metadata?.picture ? ( {`${authorData.metadata.name { - const target = e.target as HTMLImageElement; - target.style.display = 'none'; - target.parentElement!.innerHTML = '
'; - }} /> ) : (
@@ -83,7 +84,7 @@ export function AppShowcaseCard({ app }: AppShowcaseCardProps) {
)}
- + by{' '}
- {/* Spacer to push action links to bottom */} -
+
{/* Action Links */}
{app.repositoryUrl && ( - - Edit with Shakespeare + + Edit with Shakespeare )} {app.websiteUrl && ( diff --git a/src/hooks/useAppSubmissions.ts b/src/hooks/useAppSubmissions.ts index 73b8c0ca..e8e37e34 100644 --- a/src/hooks/useAppSubmissions.ts +++ b/src/hooks/useAppSubmissions.ts @@ -10,6 +10,7 @@ export interface AppSubmission extends NostrEvent { repositoryUrl: string; description: string; appIconUrl: string; + bannerUrl: string; } /** @@ -110,8 +111,17 @@ export function useAppSubmissions() { { signal: AbortSignal.timeout(5000) }, ); - // 3. Client-side filter: only keep events that can render "Edit with Shakespeare" - const filteredEvents = appEvents.filter(hasGitRepository); + // 3. Client-side filter: only keep events with a git repo, icon, and banner + const filteredEvents = appEvents.filter(event => { + if (!hasGitRepository(event)) return false; + try { + const meta = JSON.parse(event.content) as Record; + return typeof meta.picture === 'string' && meta.picture && + typeof meta.banner === 'string' && meta.banner; + } catch { + return false; + } + }); // 4. Deduplicate: for each pubkey+d-tag, keep only the latest event const latestMap = new Map(); @@ -130,6 +140,7 @@ export function useAppSubmissions() { try { let appName = ''; let appIconUrl = ''; + let bannerUrl = ''; let websiteUrl = ''; let description = ''; @@ -140,6 +151,7 @@ export function useAppSubmissions() { if (typeof meta.name === 'string') appName = meta.name; if (typeof meta.about === 'string') description = meta.about; if (typeof meta.picture === 'string') appIconUrl = meta.picture; + if (typeof meta.banner === 'string') bannerUrl = meta.banner; if (typeof meta.website === 'string') websiteUrl = meta.website; } catch { // Non-JSON content — ignore @@ -162,6 +174,7 @@ export function useAppSubmissions() { repositoryUrl, description, appIconUrl, + bannerUrl, }); } catch (error) { console.warn('Failed to parse app submission:', error);