diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/feeds/ProfileFeedgens.tsx | 12 | ||||
-rw-r--r-- | src/view/com/lists/ProfileLists.tsx | 9 | ||||
-rw-r--r-- | src/view/com/modals/Modal.web.tsx | 10 | ||||
-rw-r--r-- | src/view/com/profile/ProfileHeader.tsx | 50 | ||||
-rw-r--r-- | src/view/com/util/forms/PostDropdownBtn.tsx | 3 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 6 | ||||
-rw-r--r-- | src/view/screens/ProfileList.tsx | 3 | ||||
-rw-r--r-- | src/view/shell/Composer.web.tsx | 16 | ||||
-rw-r--r-- | src/view/shell/index.tsx | 2 |
9 files changed, 64 insertions, 47 deletions
diff --git a/src/view/com/feeds/ProfileFeedgens.tsx b/src/view/com/feeds/ProfileFeedgens.tsx index 77da2fd0b..618f4e5cd 100644 --- a/src/view/com/feeds/ProfileFeedgens.tsx +++ b/src/view/com/feeds/ProfileFeedgens.tsx @@ -1,6 +1,5 @@ import React, {MutableRefObject} from 'react' import { - ActivityIndicator, Dimensions, RefreshControl, StyleProp, @@ -24,6 +23,7 @@ import {useAnimatedScrollHandler} from 'react-native-reanimated' import {useTheme} from '#/lib/ThemeContext' import {usePreferencesQuery} from '#/state/queries/preferences' import {hydrateFeedGenerator} from '#/state/queries/feed' +import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' const LOADING = {_reactKey: '__loading__'} const EMPTY = {_reactKey: '__empty__'} @@ -147,7 +147,7 @@ export const ProfileFeedgens = React.forwardRef< testID="listsEmpty" style={[{padding: 18, borderTopWidth: 1}, pal.border]}> <Text style={pal.textLight}> - <Trans>You have no lists.</Trans> + <Trans>You have no feeds.</Trans> </Text> </View> ) @@ -163,11 +163,7 @@ export const ProfileFeedgens = React.forwardRef< /> ) } else if (item === LOADING) { - return ( - <View style={{padding: 20}}> - <ActivityIndicator /> - </View> - ) + return <FeedLoadingPlaceholder /> } if (preferences) { return ( @@ -175,6 +171,7 @@ export const ProfileFeedgens = React.forwardRef< feed={item} preferences={preferences} style={styles.item} + showLikes /> ) } @@ -221,6 +218,5 @@ export const ProfileFeedgens = React.forwardRef< const styles = StyleSheet.create({ item: { paddingHorizontal: 18, - paddingVertical: 4, }, }) diff --git a/src/view/com/lists/ProfileLists.tsx b/src/view/com/lists/ProfileLists.tsx index 63c23fcaf..95cf8fde6 100644 --- a/src/view/com/lists/ProfileLists.tsx +++ b/src/view/com/lists/ProfileLists.tsx @@ -1,6 +1,5 @@ import React, {MutableRefObject} from 'react' import { - ActivityIndicator, Dimensions, RefreshControl, StyleProp, @@ -23,6 +22,7 @@ import {Trans} from '@lingui/macro' import {cleanError} from '#/lib/strings/errors' import {useAnimatedScrollHandler} from 'react-native-reanimated' import {useTheme} from '#/lib/ThemeContext' +import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' const LOADING = {_reactKey: '__loading__'} const EMPTY = {_reactKey: '__empty__'} @@ -170,11 +170,7 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>( /> ) } else if (item === LOADING) { - return ( - <View style={{padding: 20}}> - <ActivityIndicator /> - </View> - ) + return <FeedLoadingPlaceholder /> } return ( <ListCard @@ -226,6 +222,5 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>( const styles = StyleSheet.create({ item: { paddingHorizontal: 18, - paddingVertical: 4, }, }) diff --git a/src/view/com/modals/Modal.web.tsx b/src/view/com/modals/Modal.web.tsx index 74aa7b1a9..c39ba1f51 100644 --- a/src/view/com/modals/Modal.web.tsx +++ b/src/view/com/modals/Modal.web.tsx @@ -1,10 +1,11 @@ import React from 'react' import {TouchableWithoutFeedback, StyleSheet, View} from 'react-native' +import Animated, {FadeIn, FadeOut} from 'react-native-reanimated' import {usePalette} from 'lib/hooks/usePalette' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' -import type {Modal as ModalIface} from '#/state/modals' import {useModals, useModalControls} from '#/state/modals' +import type {Modal as ModalIface} from '#/state/modals' import * as ConfirmModal from './Confirm' import * as EditProfileModal from './EditProfile' import * as ProfilePreviewModal from './ProfilePreview' @@ -129,7 +130,10 @@ function Modal({modal}: {modal: ModalIface}) { return ( // eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors <TouchableWithoutFeedback onPress={onPressMask}> - <View style={styles.mask}> + <Animated.View + style={styles.mask} + entering={FadeIn.duration(150)} + exiting={FadeOut}> {/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors */} <TouchableWithoutFeedback onPress={onInnerPress}> <View @@ -142,7 +146,7 @@ function Modal({modal}: {modal: ModalIface}) { {element} </View> </TouchableWithoutFeedback> - </View> + </Animated.View> </TouchableWithoutFeedback> ) } diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 30446fba1..c1de10aa5 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -7,6 +7,7 @@ import { } from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {useNavigation} from '@react-navigation/native' +import {useQueryClient} from '@tanstack/react-query' import { AppBskyActorDefs, ProfileModeration, @@ -15,7 +16,7 @@ import { import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {NavigationProp} from 'lib/routes/types' -import {isNative} from 'platform/detection' +import {isNative, isWeb} from 'platform/detection' import {BlurView} from '../util/BlurView' import * as Toast from '../util/Toast' import {LoadingPlaceholder} from '../util/LoadingPlaceholder' @@ -32,6 +33,7 @@ import {ProfileHeaderSuggestedFollows} from './ProfileHeaderSuggestedFollows' import {useModalControls} from '#/state/modals' import {useLightboxControls, ProfileImageLightbox} from '#/state/lightbox' import { + RQKEY as profileQueryKey, useProfileMuteMutationQueue, useProfileBlockMutationQueue, useProfileFollowMutationQueue, @@ -134,6 +136,13 @@ let ProfileHeaderLoaded = ({ const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(profile) const [queueMute, queueUnmute] = useProfileMuteMutationQueue(profile) const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile) + const queryClient = useQueryClient() + + const invalidateProfileQuery = React.useCallback(() => { + queryClient.invalidateQueries({ + queryKey: profileQueryKey(profile.did), + }) + }, [queryClient, profile.did]) const onPressBack = React.useCallback(() => { if (navigation.canGoBack()) { @@ -209,8 +218,10 @@ let ProfileHeaderLoaded = ({ name: 'user-add-remove-lists', subject: profile.did, displayName: profile.displayName || profile.handle, + onAdd: invalidateProfileQuery, + onRemove: invalidateProfileQuery, }) - }, [track, profile, openModal]) + }, [track, profile, openModal, invalidateProfileQuery]) const onPressMuteAccount = React.useCallback(async () => { track('ProfileHeader:MuteAccountButtonClicked') @@ -298,7 +309,7 @@ let ProfileHeaderLoaded = ({ let items: DropdownItem[] = [ { testID: 'profileHeaderDropdownShareBtn', - label: _(msg`Share`), + label: isWeb ? _(msg`Copy link to profile`) : _(msg`Share`), onPress: onPressShare, icon: { ios: { @@ -325,22 +336,24 @@ let ProfileHeaderLoaded = ({ }) if (!isMe) { if (!profile.viewer?.blocking) { - items.push({ - testID: 'profileHeaderDropdownMuteBtn', - label: profile.viewer?.muted - ? _(msg`Unmute Account`) - : _(msg`Mute Account`), - onPress: profile.viewer?.muted - ? onPressUnmuteAccount - : onPressMuteAccount, - icon: { - ios: { - name: 'speaker.slash', + if (!profile.viewer?.mutedByList) { + items.push({ + testID: 'profileHeaderDropdownMuteBtn', + label: profile.viewer?.muted + ? _(msg`Unmute Account`) + : _(msg`Mute Account`), + onPress: profile.viewer?.muted + ? onPressUnmuteAccount + : onPressMuteAccount, + icon: { + ios: { + name: 'speaker.slash', + }, + android: 'ic_lock_silent_mode', + web: 'comment-slash', }, - android: 'ic_lock_silent_mode', - web: 'comment-slash', - }, - }) + }) + } } if (!profile.viewer?.blockingByList) { items.push({ @@ -379,6 +392,7 @@ let ProfileHeaderLoaded = ({ isMe, hasSession, profile.viewer?.muted, + profile.viewer?.mutedByList, profile.viewer?.blocking, profile.viewer?.blockingByList, onPressShare, diff --git a/src/view/com/util/forms/PostDropdownBtn.tsx b/src/view/com/util/forms/PostDropdownBtn.tsx index 636817f72..1ba5ae8ae 100644 --- a/src/view/com/util/forms/PostDropdownBtn.tsx +++ b/src/view/com/util/forms/PostDropdownBtn.tsx @@ -23,6 +23,7 @@ import {Shadow} from '#/state/cache/types' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useSession} from '#/state/session' +import {isWeb} from '#/platform/detection' export function PostDropdownBtn({ testID, @@ -122,7 +123,7 @@ export function PostDropdownBtn({ }, }, { - label: _(msg`Share`), + label: isWeb ? _(msg`Copy link to post`) : _(msg`Share`), onPress() { const url = toShareUrl(href) shareUrl(url) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 3e9a59929..8b4107ac4 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -50,13 +50,13 @@ export function ProfileScreen({route}: Props) { data: resolvedDid, error: resolveError, refetch: refetchDid, - isFetching: isFetchingDid, + isInitialLoading: isInitialLoadingDid, } = useResolveDidQuery(name) const { data: profile, error: profileError, refetch: refetchProfile, - isFetching: isFetchingProfile, + isInitialLoading: isInitialLoadingProfile, } = useProfileQuery({ did: resolvedDid, }) @@ -69,7 +69,7 @@ export function ProfileScreen({route}: Props) { } }, [resolveError, refetchDid, refetchProfile]) - if (isFetchingDid || isFetchingProfile || !moderationOpts) { + if (isInitialLoadingDid || isInitialLoadingProfile || !moderationOpts) { return ( <CenteredView> <ProfileHeader diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 9be499561..ee0cdce29 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -54,6 +54,7 @@ import { import {cleanError} from '#/lib/strings/errors' import {useSession} from '#/state/session' import {useComposerControls} from '#/state/shell/composer' +import {isWeb} from '#/platform/detection' const SECTION_TITLES_CURATE = ['Posts', 'About'] const SECTION_TITLES_MOD = ['About'] @@ -372,7 +373,7 @@ function Header({rkey, list}: {rkey: string; list: AppBskyGraphDefs.ListView}) { let items: DropdownItem[] = [ { testID: 'listHeaderDropdownShareBtn', - label: _(msg`Share`), + label: isWeb ? _(msg`Copy link to list`) : _(msg`Share`), onPress: onPressShare, icon: { ios: { diff --git a/src/view/shell/Composer.web.tsx b/src/view/shell/Composer.web.tsx index e08c792a4..d8f4648fe 100644 --- a/src/view/shell/Composer.web.tsx +++ b/src/view/shell/Composer.web.tsx @@ -1,5 +1,6 @@ import React from 'react' import {StyleSheet, View} from 'react-native' +import Animated, {FadeIn, FadeInDown, FadeOut} from 'react-native-reanimated' import {ComposePost} from '../com/composer/Composer' import {useComposerState} from 'state/shell/composer' import {usePalette} from 'lib/hooks/usePalette' @@ -20,8 +21,15 @@ export function Composer({}: {winHeight: number}) { } return ( - <View style={styles.mask} aria-modal accessibilityViewIsModal> - <View + <Animated.View + style={styles.mask} + aria-modal + accessibilityViewIsModal + entering={FadeIn.duration(150)} + exiting={FadeOut}> + <Animated.View + entering={FadeInDown.duration(200)} + exiting={FadeOut} style={[ styles.container, isMobile && styles.containerMobile, @@ -34,8 +42,8 @@ export function Composer({}: {winHeight: number}) { onPost={state.onPost} mention={state.mention} /> - </View> - </View> + </Animated.View> + </Animated.View> ) } diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index 71d65a755..5562af9ac 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -23,7 +23,6 @@ import { SafeAreaProvider, initialWindowMetrics, } from 'react-native-safe-area-context' -import {useOTAUpdate} from 'lib/hooks/useOTAUpdate' import { useIsDrawerOpen, useSetDrawerOpen, @@ -37,7 +36,6 @@ function ShellInner() { const isDrawerOpen = useIsDrawerOpen() const isDrawerSwipeDisabled = useIsDrawerSwipeDisabled() const setIsDrawerOpen = useSetDrawerOpen() - useOTAUpdate() // this hook polls for OTA updates every few seconds const winDim = useWindowDimensions() const safeAreaInsets = useSafeAreaInsets() const containerPadding = React.useMemo( |