-
+
+
+
+
+ Loading event related to the hashtag {params.title}...
+
) : data.length === 0 ? (
@@ -85,11 +89,11 @@ export function GlobalHashtagWidget({ params }: { params: Widget }) {
-
- Your newsfeed is empty
+
+ Oops, it looks like there are no events related to {params.title}.
-
- Connect more people to explore more content
+
+ You can close this widget or try with other hashtag
@@ -97,7 +101,6 @@ export function GlobalHashtagWidget({ params }: { params: Widget }) {
) : (
{data.map((item) => renderItem(item))}
-
)}
diff --git a/src/shared/widgets/local/articles.tsx b/src/shared/widgets/local/articles.tsx
index 035112bc..0e4e798d 100644
--- a/src/shared/widgets/local/articles.tsx
+++ b/src/shared/widgets/local/articles.tsx
@@ -6,7 +6,7 @@ import { VList } from 'virtua';
import { useStorage } from '@libs/storage/provider';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
-import { FileNote, NoteSkeleton, NoteWrapper } from '@shared/notes';
+import { ArticleNote, NoteWrapper } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
@@ -16,7 +16,7 @@ export function LocalArticlesWidget({ params }: { params: Widget }) {
const { db } = useStorage();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({
- queryKey: [params.id + '-' + params.title],
+ queryKey: ['local-articles'],
queryFn: async ({ pageParam = 0 }) => {
return await db.getAllEventsByKinds([NDKKind.Article], 20, pageParam);
},
@@ -34,7 +34,7 @@ export function LocalArticlesWidget({ params }: { params: Widget }) {
const event: NDKEvent = JSON.parse(dbEvent.event as string);
return (
-
+
);
},
@@ -44,11 +44,12 @@ export function LocalArticlesWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
-
-
+
) : dbEvents.length === 0 ? (
@@ -56,12 +57,10 @@ export function LocalArticlesWidget({ params }: { params: Widget }) {
-
- Your newsfeed is empty
+
+ Oops, it looks like there are no articles.
-
- Connect more people to explore more content
-
+
You can close this widget
diff --git a/src/shared/widgets/local/feeds.tsx b/src/shared/widgets/local/feeds.tsx
index 5f0afa2e..5b418238 100644
--- a/src/shared/widgets/local/feeds.tsx
+++ b/src/shared/widgets/local/feeds.tsx
@@ -14,7 +14,6 @@ import {
TextNote,
UnknownNote,
} from '@shared/notes';
-import { NoteSkeleton } from '@shared/notes/skeleton';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
@@ -24,7 +23,7 @@ export function LocalFeedsWidget({ params }: { params: Widget }) {
const { db } = useStorage();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({
- queryKey: [params.id + '-' + params.title],
+ queryKey: ['group-feeds-' + params.id],
queryFn: async ({ pageParam = 0 }) => {
const authors = JSON.parse(params.content);
return await db.getAllEventsByAuthors(authors, 20, pageParam);
@@ -81,11 +80,12 @@ export function LocalFeedsWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
-
-
+
) : dbEvents.length === 0 ? (
@@ -93,12 +93,10 @@ export function LocalFeedsWidget({ params }: { params: Widget }) {
-
- Your newsfeed is empty
+
+ Oops, it looks like there are no posts.
-
- Connect more people to explore more content
-
+
You can close this widget
diff --git a/src/shared/widgets/local/files.tsx b/src/shared/widgets/local/files.tsx
index 3282e753..ad8c5b22 100644
--- a/src/shared/widgets/local/files.tsx
+++ b/src/shared/widgets/local/files.tsx
@@ -6,7 +6,7 @@ import { VList } from 'virtua';
import { useStorage } from '@libs/storage/provider';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
-import { FileNote, NoteSkeleton, NoteWrapper } from '@shared/notes';
+import { FileNote, NoteWrapper } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
@@ -16,7 +16,7 @@ export function LocalFilesWidget({ params }: { params: Widget }) {
const { db } = useStorage();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({
- queryKey: [params.id + '-' + params.title],
+ queryKey: ['local-file-sharing'],
queryFn: async ({ pageParam = 0 }) => {
return await db.getAllEventsByKinds([1063], 20, pageParam);
},
@@ -44,11 +44,14 @@ export function LocalFilesWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
-
-
+
+
+
+
+ Loading file sharing event...
+
) : dbEvents.length === 0 ? (
@@ -56,12 +59,10 @@ export function LocalFilesWidget({ params }: { params: Widget }) {
-
- Your newsfeed is empty
+
+ Oops, it looks like there are no file sharing events.
-
- Connect more people to explore more content
-
+
You can close this widget
diff --git a/src/shared/widgets/local/follows.tsx b/src/shared/widgets/local/follows.tsx
index 4f56762e..c1f2c60a 100644
--- a/src/shared/widgets/local/follows.tsx
+++ b/src/shared/widgets/local/follows.tsx
@@ -14,7 +14,6 @@ import {
TextNote,
UnknownNote,
} from '@shared/notes';
-import { NoteSkeleton } from '@shared/notes/skeleton';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
@@ -24,7 +23,7 @@ export function LocalFollowsWidget({ params }: { params: Widget }) {
const { db } = useStorage();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({
- queryKey: [params.id + '-' + params.title],
+ queryKey: ['follows-' + params.title],
queryFn: async ({ pageParam = 0 }) => {
return await db.getAllEventsByAuthors(db.account.follows, 20, pageParam);
},
@@ -80,11 +79,12 @@ export function LocalFollowsWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
-
-
+
) : dbEvents.length === 0 ? (
@@ -92,12 +92,10 @@ export function LocalFollowsWidget({ params }: { params: Widget }) {
-
- Your newsfeed is empty
+
+ Oops, it looks like there are no posts.
-
- Connect more people to explore more content
-
+
You can close this widget
diff --git a/src/shared/widgets/local/network.tsx b/src/shared/widgets/local/network.tsx
index b26fb12a..91773f73 100644
--- a/src/shared/widgets/local/network.tsx
+++ b/src/shared/widgets/local/network.tsx
@@ -103,7 +103,7 @@ export function LocalNetworkWidget() {
return (
-
+
{status === 'loading' ? (
diff --git a/src/shared/widgets/local/thread.tsx b/src/shared/widgets/local/thread.tsx
index a6c959d7..21e2e489 100644
--- a/src/shared/widgets/local/thread.tsx
+++ b/src/shared/widgets/local/thread.tsx
@@ -69,6 +69,7 @@ export function LocalThreadWidget({ params }: { params: Widget }) {
+
);
diff --git a/src/shared/widgets/local/user.tsx b/src/shared/widgets/local/user.tsx
index 682339be..79f1c813 100644
--- a/src/shared/widgets/local/user.tsx
+++ b/src/shared/widgets/local/user.tsx
@@ -1,7 +1,7 @@
import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useQuery } from '@tanstack/react-query';
import { useCallback } from 'react';
-import { VList } from 'virtua';
+import { WVList } from 'virtua';
import { useNDK } from '@libs/ndk/provider';
@@ -24,14 +24,16 @@ import { Widget } from '@utils/types';
export function LocalUserWidget({ params }: { params: Widget }) {
const { ndk } = useNDK();
const { status, data } = useQuery(
- [params.id + '-' + params.title],
+ ['user-posts', params.content],
async () => {
const events = await ndk.fetchEvents({
- kinds: [1, 6],
+ // @ts-expect-error, NDK not support file metadata yet
+ kinds: [NDKKind.Text, NDKKind.Repost, 1063, NDKKind.Article],
authors: [params.content],
since: nHoursAgo(24),
});
- return [...events] as unknown as NDKEvent[];
+ const sortedEvents = [...events].sort((x, y) => y.created_at - x.created_at);
+ return sortedEvents;
},
{
staleTime: Infinity,
@@ -84,7 +86,9 @@ export function LocalUserWidget({ params }: { params: Widget }) {
-
Latest posts
+
+ Latest posts
+
{status === 'loading' ? (
@@ -97,16 +101,16 @@ export function LocalUserWidget({ params }: { params: Widget }) {
- No new post from user in 24 hours ago
+ No new post from 24 hours ago
) : (
-
+
{data.map((item) => renderItem(item))}
-
+
)}
diff --git a/src/shared/widgets/nostrBand/trendingAccounts.tsx b/src/shared/widgets/nostrBand/trendingAccounts.tsx
index 6dfa8358..7d1eff00 100644
--- a/src/shared/widgets/nostrBand/trendingAccounts.tsx
+++ b/src/shared/widgets/nostrBand/trendingAccounts.tsx
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query';
+import { VList } from 'virtua';
-import { NoteSkeleton } from '@shared/notes/skeleton';
+import { LoaderIcon } from '@shared/icons';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
import { NostrBandUserProfile, type Profile } from '@shared/widgets/nostrBandUserProfile';
@@ -34,27 +35,34 @@ export function TrendingAccountsWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
- ) : status === 'error' ? (
-
-
-
- Sorry, an unexpected error has occurred.
+
+
+
+
+ Loading trending accounts...
+ ) : status === 'error' ? (
+
+
+
+
+
+ Sorry, an unexpected error has occurred.
+
+
+
+
) : (
-
+
{data.map((item: Profile) => (
))}
-
+
+
)}
diff --git a/src/shared/widgets/nostrBand/trendingNotes.tsx b/src/shared/widgets/nostrBand/trendingNotes.tsx
index 5056e9e9..80ff21e0 100644
--- a/src/shared/widgets/nostrBand/trendingNotes.tsx
+++ b/src/shared/widgets/nostrBand/trendingNotes.tsx
@@ -1,7 +1,9 @@
import { NDKEvent } from '@nostr-dev-kit/ndk';
import { useQuery } from '@tanstack/react-query';
+import { VList } from 'virtua';
-import { NoteSkeleton, NoteWrapper, TextNote } from '@shared/notes';
+import { LoaderIcon } from '@shared/icons';
+import { NoteWrapper, TextNote } from '@shared/notes';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
@@ -34,29 +36,36 @@ export function TrendingNotesWidget({ params }: { params: Widget }) {
return (
-
+
{status === 'loading' ? (
-
- ) : status === 'error' ? (
-
-
-
- Sorry, an unexpected error has occurred.
+
+
+
+
+ Loading trending posts...
+ ) : status === 'error' ? (
+
+
+
+
+
+ Sorry, an unexpected error has occurred.
+
+
+
+
) : (
-
+
{data.map((item) => (
))}
-
+
+
)}
diff --git a/src/shared/widgets/nostrBandUserProfile.tsx b/src/shared/widgets/nostrBandUserProfile.tsx
index 2c36a4f5..b583b8bf 100644
--- a/src/shared/widgets/nostrBandUserProfile.tsx
+++ b/src/shared/widgets/nostrBandUserProfile.tsx
@@ -72,77 +72,79 @@ export function NostrBandUserProfile({ data }: { data: Profile }) {
}
return (
-
-
-
-
-
-
- {profile.display_name || profile.name}
-
-
- {profile.nip05 || shortenKey(data.pubkey)}
-
+
+
+
+
+
+
+
+ {profile.display_name || profile.name}
+
+
+ {profile.nip05 || shortenKey(data.pubkey)}
+
+
+
+
+ {followed ? (
+
+ ) : (
+
+ )}
-
- {followed ? (
-
+
+
+ {profile.about || profile.bio}
+
+
+
+ {status === 'loading' ? (
+
Loading...
) : (
-
+
+
+
+ {userStats.stats[data.pubkey].followers_pubkey_count ?? 0}
+
+ Followers
+
+
+
+ {userStats.stats[data.pubkey].pub_following_pubkey_count ?? 0}
+
+ Following
+
+
+
+ {userStats.stats[data.pubkey].zaps_received
+ ? compactNumber.format(
+ userStats.stats[data.pubkey].zaps_received.msats / 1000
+ )
+ : 0}
+
+ Zaps received
+
+
)}
-
-
- {profile.about || profile.bio}
-
-
-
- {status === 'loading' ? (
-
Loading...
- ) : (
-
-
-
- {userStats.stats[data.pubkey].followers_pubkey_count ?? 0}
-
- Followers
-
-
-
- {userStats.stats[data.pubkey].pub_following_pubkey_count ?? 0}
-
- Following
-
-
-
- {userStats.stats[data.pubkey].zaps_received
- ? compactNumber.format(
- userStats.stats[data.pubkey].zaps_received.msats / 1000
- )
- : 0}
-
- Zaps received
-
-
- )}
-
);
}
diff --git a/src/shared/widgets/tmp/hashtag.tsx b/src/shared/widgets/tmp/hashtag.tsx
index 76393c4c..5ee3eb2a 100644
--- a/src/shared/widgets/tmp/hashtag.tsx
+++ b/src/shared/widgets/tmp/hashtag.tsx
@@ -48,7 +48,7 @@ export function XhashtagWidget({ params }: { params: Widget }) {
try {
setWidget(db, {
kind: WidgetKinds.global.hashtag,
- title: data.hashtag + ' in 24 hours ago',
+ title: data.hashtag,
content: data.hashtag.replace('#', ''),
});
// remove temp widget
diff --git a/src/stores/activities.ts b/src/stores/activities.ts
index a5a3b9cb..21a1b0f7 100644
--- a/src/stores/activities.ts
+++ b/src/stores/activities.ts
@@ -22,7 +22,7 @@ export const useActivities = create
((set) => ({
addActivity: (event: NDKEvent) => {
set((state) => ({
activities: state.activities ? [event, ...state.activities] : [event],
- totalNewActivities: (state.totalNewActivities += 1),
+ totalNewActivities: state.totalNewActivities++,
}));
},
clearTotalNewActivities: () => {