Onboarding tweaks (#272)

* Small fix to side menu rendering

* Change onboarding to use an explicit 'is onboarding' mode to more clearly control the flow

* Add a progress bar to the welcome banner

* Dont show the 'unfollow button' on posts in weird times (close #271)

* Improve the empty state of the feed

* Only suggest recent posts
This commit is contained in:
Paul Frazee 2023-03-06 15:34:22 -06:00 committed by GitHub
parent 74c30c60b8
commit 36791e68b3
13 changed files with 259 additions and 123 deletions

View file

@ -24,20 +24,18 @@ export const PostMeta = observer(function (opts: PostMetaOpts) {
let handle = opts.authorHandle
const store = useStores()
const isMe = opts.did === store.me.did
const isFollowing =
typeof opts.did === 'string' && store.me.follows.isFollowing(opts.did)
// NOTE we capture `isFollowing` via a memo so that follows
// don't change this UI immediately, but rather upon future
// renders
const isFollowing = React.useMemo(
() =>
typeof opts.did === 'string' && store.me.follows.isFollowing(opts.did),
[opts.did, store.me.follows],
)
const [didFollow, setDidFollow] = React.useState(false)
const onToggleFollow = React.useCallback(() => {
setDidFollow(true)
}, [setDidFollow])
if (
opts.showFollowBtn &&
!isMe &&
!isFollowing &&
(!isFollowing || didFollow) &&
opts.did &&
opts.declarationCid
) {
@ -71,7 +69,11 @@ export const PostMeta = observer(function (opts: PostMetaOpts) {
</View>
<View>
<FollowButton did={opts.did} declarationCid={opts.declarationCid} />
<FollowButton
did={opts.did}
declarationCid={opts.declarationCid}
onToggleFollow={onToggleFollow}
/>
</View>
</View>
)