mirror of
https://github.com/lumehq/lume.git
synced 2025-09-18 18:00:31 +02:00
add empty state for feed page
This commit is contained in:
@@ -30,6 +30,8 @@ export function Root() {
|
|||||||
async function fetchNotes() {
|
async function fetchNotes() {
|
||||||
try {
|
try {
|
||||||
const follows = JSON.parse(account.follows);
|
const follows = JSON.parse(account.follows);
|
||||||
|
|
||||||
|
if (follows.length > 0) {
|
||||||
let since: number;
|
let since: number;
|
||||||
|
|
||||||
if (totalNotes === 0 || lastLogin === 0) {
|
if (totalNotes === 0 || lastLogin === 0) {
|
||||||
@@ -55,6 +57,7 @@ export function Root() {
|
|||||||
event.created_at
|
event.created_at
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -69,6 +72,7 @@ export function Root() {
|
|||||||
authors: [account.pubkey],
|
authors: [account.pubkey],
|
||||||
since: lastLogin,
|
since: lastLogin,
|
||||||
};
|
};
|
||||||
|
|
||||||
const receiveFilter: NDKFilter = {
|
const receiveFilter: NDKFilter = {
|
||||||
kinds: [4],
|
kinds: [4],
|
||||||
'#p': [account.pubkey],
|
'#p': [account.pubkey],
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { getNotesByAuthors, removeBlock } from '@libs/storage';
|
import { getNotesByAuthors, removeBlock } from '@libs/storage';
|
||||||
|
|
||||||
@@ -79,6 +80,16 @@ export function FeedBlock({ params }: { params: any }) {
|
|||||||
<NoteSkeleton />
|
<NoteSkeleton />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : itemsVirtualizer.length === 0 ? (
|
||||||
|
<div className="px-3 py-1.5">
|
||||||
|
<div className="rounded-xl border-t border-zinc-800/50 bg-zinc-900 px-3 py-6">
|
||||||
|
<div className="flex flex-col items-center gap-4">
|
||||||
|
<p className="text-center text-sm text-zinc-300">
|
||||||
|
Not found any posts from last 48 hours
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className="relative w-full"
|
className="relative w-full"
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { useInfiniteQuery } from '@tanstack/react-query';
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
||||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { useNewsfeed } from '@app/space/hooks/useNewsfeed';
|
import { useNewsfeed } from '@app/space/hooks/useNewsfeed';
|
||||||
|
|
||||||
@@ -104,6 +105,24 @@ export function FollowingBlock() {
|
|||||||
<NoteSkeleton />
|
<NoteSkeleton />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : itemsVirtualizer.length === 0 ? (
|
||||||
|
<div className="px-3 py-1.5">
|
||||||
|
<div className="rounded-xl border-t border-zinc-800/50 bg-zinc-900 px-3 py-6">
|
||||||
|
<div className="flex flex-col items-center gap-4">
|
||||||
|
<p className="text-center text-sm text-zinc-300">
|
||||||
|
You not have any posts to see yet
|
||||||
|
<br />
|
||||||
|
Follow more people to have more fun.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
to="/app/trending"
|
||||||
|
className="inline-flex w-max rounded bg-fuchsia-500 px-2.5 py-1.5 text-sm hover:bg-fuchsia-600"
|
||||||
|
>
|
||||||
|
Trending
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className="relative w-full"
|
className="relative w-full"
|
||||||
|
Reference in New Issue
Block a user