Don't show "Pin/Add" button on feed card w/ no session (#4539)

* pt 1

* tweak
zio/stable
Hailey 2024-06-17 09:05:02 -07:00 committed by GitHub
parent 89be5a442c
commit ba2fadb661
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {
useRemoveFeedMutation, useRemoveFeedMutation,
} from '#/state/queries/preferences' } from '#/state/queries/preferences'
import {sanitizeHandle} from 'lib/strings/handles' import {sanitizeHandle} from 'lib/strings/handles'
import {useSession} from 'state/session'
import {UserAvatar} from '#/view/com/util/UserAvatar' import {UserAvatar} from '#/view/com/util/UserAvatar'
import * as Toast from 'view/com/util/Toast' import * as Toast from 'view/com/util/Toast'
import {useTheme} from '#/alf' import {useTheme} from '#/alf'
@ -116,6 +117,12 @@ export function Likes({count}: {count: number}) {
} }
export function Action({uri, pin}: {uri: string; pin?: boolean}) { export function Action({uri, pin}: {uri: string; pin?: boolean}) {
const {hasSession} = useSession()
if (!hasSession) return null
return <ActionInner uri={uri} pin={pin} />
}
function ActionInner({uri, pin}: {uri: string; pin?: boolean}) {
const {_} = useLingui() const {_} = useLingui()
const {data: preferences} = usePreferencesQuery() const {data: preferences} = usePreferencesQuery()
const {isPending: isAddSavedFeedPending, mutateAsync: saveFeeds} = const {isPending: isAddSavedFeedPending, mutateAsync: saveFeeds} =