implement better feed card on the landing page
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
useRemoveFeedMutation,
|
||||
} from '#/state/queries/preferences'
|
||||
import {sanitizeHandle} from 'lib/strings/handles'
|
||||
import {useSession} from 'state/session'
|
||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||
import * as Toast from 'view/com/util/Toast'
|
||||
import {useTheme} from '#/alf'
|
||||
@@ -116,6 +117,12 @@ export function Likes({count}: {count: number}) {
|
||||
}
|
||||
|
||||
export function Action({uri, pin}: {uri: string; pin?: boolean}) {
|
||||
const {currentAccount} = useSession()
|
||||
if (!currentAccount) return null
|
||||
return <ActionInner uri={uri} pin={pin} />
|
||||
}
|
||||
|
||||
function ActionInner({uri, pin}: {uri: string; pin?: boolean}) {
|
||||
const {_} = useLingui()
|
||||
const {data: preferences} = usePreferencesQuery()
|
||||
const {isPending: isAddSavedFeedPending, mutateAsync: saveFeeds} =
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
AppBskyActorDefs,
|
||||
AppBskyGraphDefs,
|
||||
AppBskyGraphStarterpack,
|
||||
AtUri,
|
||||
} from '@atproto/api'
|
||||
import {msg, Trans} from '@lingui/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -17,25 +16,33 @@ import {
|
||||
import {useResolveDidQuery} from 'state/queries/resolve-uri'
|
||||
import {useStarterPackQuery} from 'state/queries/useStarterPackQuery'
|
||||
import {LoggedOutScreenState} from 'view/com/auth/LoggedOut'
|
||||
import {FeedSourceCard} from 'view/com/feeds/FeedSourceCard'
|
||||
import {UserAvatar} from 'view/com/util/UserAvatar'
|
||||
import {CenteredView} from 'view/com/util/Views'
|
||||
import {Logo} from 'view/icons/Logo'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
import {Divider} from '#/components/Divider'
|
||||
import * as FeedCard from '#/components/FeedCard'
|
||||
import {LinearGradientBackground} from '#/components/LinearGradientBackground'
|
||||
import {ListMaybePlaceholder} from '#/components/Lists'
|
||||
import {Text} from '#/components/Typography'
|
||||
|
||||
function parseStarterPackHttpUri(uri: string): {name?: string; rkey?: string} {
|
||||
const parsed = new URL(uri)
|
||||
const [_, _path, name, rkey] = parsed.pathname.split('/')
|
||||
return {
|
||||
name,
|
||||
rkey,
|
||||
}
|
||||
}
|
||||
|
||||
export function LandingScreen({
|
||||
setScreenState,
|
||||
}: {
|
||||
setScreenState: (state: LoggedOutScreenState) => void
|
||||
}) {
|
||||
const usedStarterPack = useUsedStarterPack()
|
||||
const atUri = new AtUri(usedStarterPack?.uri ?? '')
|
||||
const {hostname: name, rkey} = atUri
|
||||
const {name, rkey} = parseStarterPackHttpUri(usedStarterPack?.uri || '')
|
||||
|
||||
const {
|
||||
data: did,
|
||||
@@ -172,11 +179,15 @@ function LandingScreenInner({
|
||||
{pointerEvents: 'none'},
|
||||
]}>
|
||||
{starterPack.feeds?.map((feed, index) => (
|
||||
<FeedSourceCard
|
||||
key={feed.uri}
|
||||
feedUri={feed.uri}
|
||||
hideTopBorder={index === 0}
|
||||
/>
|
||||
<View
|
||||
style={[
|
||||
a.p_lg,
|
||||
index !== 0 && a.border_t,
|
||||
t.atoms.border_contrast_low,
|
||||
]}
|
||||
key={feed.uri}>
|
||||
<FeedCard.Default feed={feed} />
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user