feat: conversations (#277)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import FollowingFavoriteRelayList from '@/components/FollowingFavoriteRelayList'
|
||||
import RelayList from '@/components/RelayList'
|
||||
import TabSwitcher from '@/components/TabSwitch'
|
||||
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useDeepBrowsing } from '@/providers/DeepBrowsingProvider'
|
||||
import { Compass } from 'lucide-react'
|
||||
import { forwardRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -19,7 +18,14 @@ const ExplorePage = forwardRef((_, ref) => {
|
||||
titlebar={<ExplorePageTitlebar />}
|
||||
displayScrollToTopButton
|
||||
>
|
||||
<Tabs value={tab} setValue={setTab} />
|
||||
<TabSwitcher
|
||||
value={tab}
|
||||
tabs={[
|
||||
{ value: 'following', label: "Following's Favorites" },
|
||||
{ value: 'all', label: 'All' }
|
||||
]}
|
||||
onTabChange={(tab) => setTab(tab as TExploreTabs)}
|
||||
/>
|
||||
{tab === 'following' ? <FollowingFavoriteRelayList /> : <RelayList />}
|
||||
</PrimaryPageLayout>
|
||||
)
|
||||
@@ -37,43 +43,3 @@ function ExplorePageTitlebar() {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function Tabs({
|
||||
value,
|
||||
setValue
|
||||
}: {
|
||||
value: TExploreTabs
|
||||
setValue: (value: TExploreTabs) => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { deepBrowsing, lastScrollTop } = useDeepBrowsing()
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'sticky top-12 bg-background z-30 duration-700 transition-transform select-none',
|
||||
deepBrowsing && lastScrollTop > 800 ? '-translate-y-[calc(100%+12rem)]' : ''
|
||||
)}
|
||||
>
|
||||
<div className="flex">
|
||||
<div
|
||||
className={`w-1/2 text-center py-2 font-semibold clickable cursor-pointer rounded-lg ${value === 'following' ? '' : 'text-muted-foreground'}`}
|
||||
onClick={() => setValue('following')}
|
||||
>
|
||||
{t("Following's Favorites")}
|
||||
</div>
|
||||
<div
|
||||
className={`w-1/2 text-center py-2 font-semibold clickable cursor-pointer rounded-lg ${value === 'all' ? '' : 'text-muted-foreground'}`}
|
||||
onClick={() => setValue('all')}
|
||||
>
|
||||
{t('All')}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`w-1/2 px-4 sm:px-6 transition-transform duration-500 ${value === 'all' ? 'translate-x-full' : ''}`}
|
||||
>
|
||||
<div className="w-full h-1 bg-primary rounded-full" />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ const NoteListPage = forwardRef((_, ref) => {
|
||||
relayUrls={relayUrls}
|
||||
filter={filter}
|
||||
needCheckAlgoRelay={feedInfo.feedType !== 'following'}
|
||||
isMainFeed
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<NoteList filter={{ authors: [pubkey] }} className="mt-2" filterMutedNotes={false} />
|
||||
<NoteList author={pubkey} className="mt-2" filterMutedNotes={false} />
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user