diff --git a/public/hero-bg.png b/public/images/hero-bg.png similarity index 100% rename from public/hero-bg.png rename to public/images/hero-bg.png diff --git a/public/nostr.png b/public/images/nostr.png similarity index 100% rename from public/nostr.png rename to public/images/nostr.png diff --git a/public/plebdevs-banner.jpg b/public/images/plebdevs-banner.jpg similarity index 100% rename from public/plebdevs-banner.jpg rename to public/images/plebdevs-banner.jpg diff --git a/public/plebdevs-guy.jpg b/public/images/plebdevs-guy.jpg similarity index 100% rename from public/plebdevs-guy.jpg rename to public/images/plebdevs-guy.jpg diff --git a/public/sn.svg b/public/images/sn.svg similarity index 100% rename from public/sn.svg rename to public/images/sn.svg diff --git a/public/next.svg b/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index d2f8422..0000000 --- a/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/BottomBar.js b/src/components/BottomBar.js index 4dbbebd..bbf4b49 100644 --- a/src/components/BottomBar.js +++ b/src/components/BottomBar.js @@ -11,13 +11,13 @@ const BottomBar = () => { return (
-
router.push('/')} className={`cursor-pointer px-4 py-3 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}> +
router.push('/')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}>
-
router.push('/content')} className={`cursor-pointer px-4 py-3 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}> +
router.push('/content')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}>
-
router.push('/feed?channel=global')} className={`cursor-pointer px-4 py-3 rounded-lg ${isActive('/feed') ? 'bg-gray-700' : ''}`}> +
router.push('/feed?channel=global')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/feed') ? 'bg-gray-700' : ''}`}>
diff --git a/src/components/feeds/GlobalFeed.js b/src/components/feeds/GlobalFeed.js index 8a140f7..f488f3e 100644 --- a/src/components/feeds/GlobalFeed.js +++ b/src/components/feeds/GlobalFeed.js @@ -11,7 +11,7 @@ import { useRouter } from 'next/router'; import { useCommunityNotes } from '@/hooks/nostr/useCommunityNotes'; import { useNDKContext } from '@/context/NDKContext'; import { findKind0Fields } from '@/utils/nostr'; -import NostrIcon from '../../../public/nostr.png'; +import NostrIcon from '../../../public/images/nostr.png'; import Image from 'next/image'; import { useImageProxy } from '@/hooks/useImageProxy'; import { nip19 } from 'nostr-tools'; @@ -54,7 +54,28 @@ const GlobalFeed = () => { }, [nostrData]); const fetchAuthor = async (pubkey) => { - // ... (keep the existing fetchAuthor function) + try { + await ndk.connect(); + + const filter = { + kinds: [0], + authors: [pubkey] + } + + const author = await ndk.fetchEvent(filter); + if (author) { + try { + const fields = await findKind0Fields(JSON.parse(author.content)); + return fields; + } catch (error) { + console.error('Error fetching author:', error); + } + } else { + return null; + } + } catch (error) { + console.error('Error fetching author:', error); + } } if (discordLoading || stackerNewsLoading || nostrLoading) { @@ -69,6 +90,17 @@ const GlobalFeed = () => { return
Failed to load feed. Please try again later.
; } + const getAvatarImage = (item) => { + if (item.type === 'discord') { + return item.avatar ? returnImageProxy(item.avatar) : null; + } else if (item.type === 'nostr') { + return authorData[item.pubkey]?.avatar ? returnImageProxy(authorData[item.pubkey]?.avatar) : null; + } else if (item.type === 'stackernews') { + return item.user.image ? returnImageProxy(item.user.image) : null; + } + return null; + }; + const combinedFeed = [ ...(discordData || []).map(item => ({ ...item, type: 'discord' })), ...(stackerNewsData || []).map(item => ({ ...item, type: 'stackernews' })), @@ -83,8 +115,7 @@ const GlobalFeed = () => {
{ const allItems = ['global', 'nostr', 'discord', 'stackernews']; diff --git a/src/pages/feed.js b/src/pages/feed.js index 8257c5d..94854c6 100644 --- a/src/pages/feed.js +++ b/src/pages/feed.js @@ -9,9 +9,9 @@ import GlobalFeed from '@/components/feeds/GlobalFeed'; import { useRouter } from 'next/router'; import { Message } from 'primereact/message'; import { Tag } from 'primereact/tag'; -import StackerNewsIcon from '../../public/sn.svg'; -import NostrIcon from '../../public/nostr.png'; - +import StackerNewsIcon from '../../public/images/sn.svg'; +import NostrIcon from '../../public/images/nostr.png'; +import { Button } from 'primereact/button'; const Feed = () => { const [selectedTopic, setSelectedTopic] = useState('global'); const [searchQuery, setSearchQuery] = useState(''); @@ -50,20 +50,21 @@ const Feed = () => { }; return ( -
+
-
-

Community

- +

Community

+