feat: explore
This commit is contained in:
parent
f2bb65acf0
commit
ace4e94071
11 changed files with 240 additions and 233 deletions
|
|
@ -1,15 +1,15 @@
|
|||
import Explore from '@/components/Explore'
|
||||
import FollowingFavoriteRelayList from '@/components/FollowingFavoriteRelayList'
|
||||
import RelayList from '@/components/RelayList'
|
||||
import Tabs from '@/components/Tabs'
|
||||
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
|
||||
import { Compass } from 'lucide-react'
|
||||
import { forwardRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type TExploreTabs = 'following' | 'all'
|
||||
type TExploreTabs = 'following' | 'explore'
|
||||
|
||||
const ExplorePage = forwardRef((_, ref) => {
|
||||
const [tab, setTab] = useState<TExploreTabs>('following')
|
||||
const [tab, setTab] = useState<TExploreTabs>('explore')
|
||||
|
||||
return (
|
||||
<PrimaryPageLayout
|
||||
|
|
@ -21,12 +21,12 @@ const ExplorePage = forwardRef((_, ref) => {
|
|||
<Tabs
|
||||
value={tab}
|
||||
tabs={[
|
||||
{ value: 'following', label: "Following's Favorites" },
|
||||
{ value: 'all', label: 'All' }
|
||||
{ value: 'explore', label: 'Explore' },
|
||||
{ value: 'following', label: "Following's Favorites" }
|
||||
]}
|
||||
onTabChange={(tab) => setTab(tab as TExploreTabs)}
|
||||
/>
|
||||
{tab === 'following' ? <FollowingFavoriteRelayList /> : <RelayList />}
|
||||
{tab === 'following' ? <FollowingFavoriteRelayList /> : <Explore />}
|
||||
</PrimaryPageLayout>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { RECOMMENDED_RELAYS } from '@/constants'
|
|||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { toRelay } from '@/lib/link'
|
||||
import relayInfoService from '@/services/relay-info.service'
|
||||
import { TNip66RelayInfo } from '@/types'
|
||||
import { TRelayInfo } from '@/types'
|
||||
import { ArrowRight, Server } from 'lucide-react'
|
||||
import { forwardRef, useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
|
@ -14,13 +14,13 @@ const HomePage = forwardRef(({ index }: { index?: number }, ref) => {
|
|||
const { t } = useTranslation()
|
||||
const { navigate } = usePrimaryPage()
|
||||
const { push } = useSecondaryPage()
|
||||
const [recommendedRelayInfos, setRecommendedRelayInfos] = useState<TNip66RelayInfo[]>([])
|
||||
const [recommendedRelayInfos, setRecommendedRelayInfos] = useState<TRelayInfo[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
const init = async () => {
|
||||
try {
|
||||
const relays = await relayInfoService.getRelayInfos(RECOMMENDED_RELAYS)
|
||||
setRecommendedRelayInfos(relays.filter(Boolean) as TNip66RelayInfo[])
|
||||
setRecommendedRelayInfos(relays.filter(Boolean) as TRelayInfo[])
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch recommended relays:', error)
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ const HomePage = forwardRef(({ index }: { index?: number }, ref) => {
|
|||
{recommendedRelayInfos.map((relayInfo) => (
|
||||
<RelaySimpleInfo
|
||||
key={relayInfo.url}
|
||||
className="clickable h-auto p-3 rounded-lg border"
|
||||
className="clickable h-auto px-4 py-3 rounded-lg border"
|
||||
relayInfo={relayInfo}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue