|
|
|
@ -1,7 +1,9 @@ |
|
|
|
import NoteList from '@/components/NoteList' |
|
|
|
import NoteList from '@/components/NoteList' |
|
|
|
import SaveRelayDropdownMenu from '@/components/SaveRelayDropdownMenu' |
|
|
|
import SaveRelayDropdownMenu from '@/components/SaveRelayDropdownMenu' |
|
|
|
|
|
|
|
import { Button } from '@/components/ui/button' |
|
|
|
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout' |
|
|
|
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout' |
|
|
|
import { useFeed } from '@/providers/FeedProvider' |
|
|
|
import { useFeed } from '@/providers/FeedProvider' |
|
|
|
|
|
|
|
import { useNostr } from '@/providers/NostrProvider' |
|
|
|
import { useEffect, useRef } from 'react' |
|
|
|
import { useEffect, useRef } from 'react' |
|
|
|
import { useTranslation } from 'react-i18next' |
|
|
|
import { useTranslation } from 'react-i18next' |
|
|
|
import FeedButton from './FeedButton' |
|
|
|
import FeedButton from './FeedButton' |
|
|
|
@ -10,6 +12,7 @@ import SearchButton from './SearchButton' |
|
|
|
export default function NoteListPage() { |
|
|
|
export default function NoteListPage() { |
|
|
|
const { t } = useTranslation() |
|
|
|
const { t } = useTranslation() |
|
|
|
const layoutRef = useRef<{ scrollToTop: () => void }>(null) |
|
|
|
const layoutRef = useRef<{ scrollToTop: () => void }>(null) |
|
|
|
|
|
|
|
const { pubkey, checkLogin } = useNostr() |
|
|
|
const { feedType, relayUrls, isReady, filter } = useFeed() |
|
|
|
const { feedType, relayUrls, isReady, filter } = useFeed() |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
@ -18,6 +21,19 @@ export default function NoteListPage() { |
|
|
|
} |
|
|
|
} |
|
|
|
}, [JSON.stringify(relayUrls), feedType]) |
|
|
|
}, [JSON.stringify(relayUrls), feedType]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let content = <div className="text-center text-sm text-muted-foreground">{t('loading...')}</div> |
|
|
|
|
|
|
|
if (feedType === 'following' && !pubkey) { |
|
|
|
|
|
|
|
content = ( |
|
|
|
|
|
|
|
<div className="flex justify-center w-full"> |
|
|
|
|
|
|
|
<Button size="lg" onClick={() => checkLogin()}> |
|
|
|
|
|
|
|
{t('Please login to view following feed')} |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} else if (isReady) { |
|
|
|
|
|
|
|
content = <NoteList relayUrls={relayUrls} filter={filter} /> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<PrimaryPageLayout |
|
|
|
<PrimaryPageLayout |
|
|
|
pageName="home" |
|
|
|
pageName="home" |
|
|
|
@ -27,11 +43,7 @@ export default function NoteListPage() { |
|
|
|
} |
|
|
|
} |
|
|
|
displayScrollToTopButton |
|
|
|
displayScrollToTopButton |
|
|
|
> |
|
|
|
> |
|
|
|
{isReady ? ( |
|
|
|
{content} |
|
|
|
<NoteList relayUrls={relayUrls} filter={filter} /> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<div className="text-center text-sm text-muted-foreground">{t('loading...')}</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</PrimaryPageLayout> |
|
|
|
</PrimaryPageLayout> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|