@ -6,4 +6,4 @@ export const Spinner = () => (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
export const Dots = () => <div className={styles.loading}></div>
|
export const Dots = () => <span className={styles.loading}></span>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { NDKEvent } from '@nostr-dev-kit/ndk'
|
import { NDKEvent } from '@nostr-dev-kit/ndk'
|
||||||
import { Dots } from 'components/Spinner'
|
import { Dots, Spinner } from 'components/Spinner'
|
||||||
import { ZapPopUp } from 'components/Zap'
|
import { ZapPopUp } from 'components/Zap'
|
||||||
import { formatDate } from 'date-fns'
|
import { formatDate } from 'date-fns'
|
||||||
import {
|
import {
|
||||||
@ -60,6 +60,15 @@ export const Comments = ({ addressable, setCommentCount }: Props) => {
|
|||||||
author: AuthorFilterEnum.All_Comments
|
author: AuthorFilterEnum.All_Comments
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
|
useEffect(() => {
|
||||||
|
// Initial loading to indicate comments fetching (stop after 15 seconds)
|
||||||
|
const t = window.setTimeout(() => setIsLoading(false), 15000)
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(t)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCommentCount(commentEvents.length)
|
setCommentCount(commentEvents.length)
|
||||||
}, [commentEvents, setCommentCount])
|
}, [commentEvents, setCommentCount])
|
||||||
@ -208,6 +217,7 @@ export const Comments = ({ addressable, setCommentCount }: Props) => {
|
|||||||
<Comment key={event.id} {...event} />
|
<Comment key={event.id} {...event} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
{isLoading && <Spinner />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user