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
+