blog post and other fixes/additions #124
@ -196,7 +196,8 @@ export const Comments = ({ addressable, setCommentCount }: Props) => {
|
|||||||
<div className='IBMSMSMBSSCommentsWrapper'>
|
<div className='IBMSMSMBSSCommentsWrapper'>
|
||||||
<h4 className='IBMSMSMBSSTitle'>Comments</h4>
|
<h4 className='IBMSMSMBSSTitle'>Comments</h4>
|
||||||
<div className='IBMSMSMBSSComments'>
|
<div className='IBMSMSMBSSComments'>
|
||||||
<CommentForm handleSubmit={handleSubmit} />
|
{/* Hide comment form if aTag is missing */}
|
||||||
|
{!!addressable.aTag && <CommentForm handleSubmit={handleSubmit} />}
|
||||||
<Filter
|
<Filter
|
||||||
filterOptions={filterOptions}
|
filterOptions={filterOptions}
|
||||||
setFilterOptions={setFilterOptions}
|
setFilterOptions={setFilterOptions}
|
||||||
|
@ -299,6 +299,7 @@ export const BlogPage = () => {
|
|||||||
)}
|
)}
|
||||||
<div className='IBMSMSplitMainBigSideSec'>
|
<div className='IBMSMSplitMainBigSideSec'>
|
||||||
<Comments
|
<Comments
|
||||||
|
key={blog.id}
|
||||||
addressable={blog as Addressable}
|
addressable={blog as Addressable}
|
||||||
setCommentCount={setCommentCount}
|
setCommentCount={setCommentCount}
|
||||||
/>
|
/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useMemo, useRef, useState } from 'react'
|
import { useMemo, useRef, useState } from 'react'
|
||||||
import { useLoaderData, useSearchParams } from 'react-router-dom'
|
import { useLoaderData, useNavigation, useSearchParams } from 'react-router-dom'
|
||||||
import { useLocalStorage } from 'hooks'
|
import { useLocalStorage } from 'hooks'
|
||||||
import { BlogCardDetails, NSFWFilter, SortBy } from 'types'
|
import { BlogCardDetails, NSFWFilter, SortBy } from 'types'
|
||||||
import { SearchInput } from '../../components/SearchInput'
|
import { SearchInput } from '../../components/SearchInput'
|
||||||
@ -10,8 +10,10 @@ import '../../styles/search.css'
|
|||||||
import '../../styles/styles.css'
|
import '../../styles/styles.css'
|
||||||
import { PaginationWithPageNumbers } from 'components/Pagination'
|
import { PaginationWithPageNumbers } from 'components/Pagination'
|
||||||
import { scrollIntoView } from 'utils'
|
import { scrollIntoView } from 'utils'
|
||||||
|
import { LoadingSpinner } from 'components/LoadingSpinner'
|
||||||
|
|
||||||
export const BlogsPage = () => {
|
export const BlogsPage = () => {
|
||||||
|
const navigation = useNavigation()
|
||||||
const blogs = useLoaderData() as Partial<BlogCardDetails>[] | undefined
|
const blogs = useLoaderData() as Partial<BlogCardDetails>[] | undefined
|
||||||
const [filterOptions, setFilterOptions] = useLocalStorage(
|
const [filterOptions, setFilterOptions] = useLocalStorage(
|
||||||
'filter-blog-curated',
|
'filter-blog-curated',
|
||||||
@ -105,6 +107,7 @@ export const BlogsPage = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='InnerBodyMain'>
|
<div className='InnerBodyMain'>
|
||||||
|
{navigation.state !== 'idle' && <LoadingSpinner desc={'Loading'} />}
|
||||||
<div className='ContainerMain'>
|
<div className='ContainerMain'>
|
||||||
<div
|
<div
|
||||||
className='IBMSecMainGroup IBMSecMainGroupAlt'
|
className='IBMSecMainGroup IBMSecMainGroupAlt'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { kinds, nip19 } from 'nostr-tools'
|
import { kinds, nip19 } from 'nostr-tools'
|
||||||
import { useMemo, useState } from 'react'
|
import { useMemo, useState } from 'react'
|
||||||
import { Link, useNavigate } from 'react-router-dom'
|
import { Link, useNavigate, useNavigation } from 'react-router-dom'
|
||||||
import { A11y, Autoplay, Navigation, Pagination } from 'swiper/modules'
|
import { A11y, Autoplay, Navigation, Pagination } from 'swiper/modules'
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react'
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
||||||
import { BlogCard } from '../components/BlogCard'
|
import { BlogCard } from '../components/BlogCard'
|
||||||
@ -35,6 +35,7 @@ import { NDKFilter } from '@nostr-dev-kit/ndk'
|
|||||||
import 'swiper/css'
|
import 'swiper/css'
|
||||||
import 'swiper/css/navigation'
|
import 'swiper/css/navigation'
|
||||||
import 'swiper/css/pagination'
|
import 'swiper/css/pagination'
|
||||||
|
import { LoadingSpinner } from 'components/LoadingSpinner'
|
||||||
|
|
||||||
export const HomePage = () => {
|
export const HomePage = () => {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@ -324,6 +325,7 @@ const DisplayLatestBlogs = () => {
|
|||||||
sort: SortBy.Latest,
|
sort: SortBy.Latest,
|
||||||
nsfw: NSFWFilter.Hide_NSFW
|
nsfw: NSFWFilter.Hide_NSFW
|
||||||
})
|
})
|
||||||
|
const navigation = useNavigation()
|
||||||
useDidMount(() => {
|
useDidMount(() => {
|
||||||
const fetchBlogs = async () => {
|
const fetchBlogs = async () => {
|
||||||
try {
|
try {
|
||||||
@ -425,6 +427,9 @@ const DisplayLatestBlogs = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='IBMSecMain IBMSMListWrapper'>
|
<div className='IBMSecMain IBMSMListWrapper'>
|
||||||
|
{navigation.state !== 'idle' && (
|
||||||
|
<LoadingSpinner desc={'Fetching blog...'} />
|
||||||
|
)}
|
||||||
<div className='IBMSMTitleMain'>
|
<div className='IBMSMTitleMain'>
|
||||||
<h2 className='IBMSMTitleMainHeading'>Blog Posts</h2>
|
<h2 className='IBMSMTitleMainHeading'>Blog Posts</h2>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,7 +16,13 @@ import {
|
|||||||
} from 'hooks'
|
} from 'hooks'
|
||||||
import { kinds, nip19, UnsignedEvent } from 'nostr-tools'
|
import { kinds, nip19, UnsignedEvent } from 'nostr-tools'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { useParams, Navigate, Link, useLoaderData } from 'react-router-dom'
|
import {
|
||||||
|
useParams,
|
||||||
|
Navigate,
|
||||||
|
Link,
|
||||||
|
useLoaderData,
|
||||||
|
useNavigation
|
||||||
|
} from 'react-router-dom'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import { appRoutes, getProfilePageRoute } from 'routes'
|
import { appRoutes, getProfilePageRoute } from 'routes'
|
||||||
import {
|
import {
|
||||||
@ -262,6 +268,7 @@ export const ProfilePage = () => {
|
|||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case 0:
|
case 0:
|
||||||
|
setLoadingSpinnerDesc('Fetching mods..')
|
||||||
fetchMods({ source: filterOptions.source, author: profilePubkey })
|
fetchMods({ source: filterOptions.source, author: profilePubkey })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setMods(res)
|
setMods(res)
|
||||||
@ -690,6 +697,7 @@ const ReportUserPopup = ({
|
|||||||
const ProfileTabBlogs = () => {
|
const ProfileTabBlogs = () => {
|
||||||
const { profile, muteLists, nsfwList } =
|
const { profile, muteLists, nsfwList } =
|
||||||
useLoaderData() as ProfilePageLoaderResult
|
useLoaderData() as ProfilePageLoaderResult
|
||||||
|
const navigation = useNavigation()
|
||||||
const { fetchEvents } = useNDKContext()
|
const { fetchEvents } = useNDKContext()
|
||||||
const [filterOptions] = useLocalStorage('filter-blog', DEFAULT_FILTER_OPTIONS)
|
const [filterOptions] = useLocalStorage('filter-blog', DEFAULT_FILTER_OPTIONS)
|
||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
@ -848,7 +856,9 @@ const ProfileTabBlogs = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isLoading && <LoadingSpinner desc={'Fetching blogs...'} />}
|
{(isLoading || navigation.state !== 'idle') && (
|
||||||
|
<LoadingSpinner desc={'Loading...'} />
|
||||||
|
)}
|
||||||
|
|
||||||
<ModFilter filterKey={'filter-blog'} author={profile?.pubkey as string} />
|
<ModFilter filterKey={'filter-blog'} author={profile?.pubkey as string} />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user