remove legacy components
This commit is contained in:
+1
-1
@@ -68,7 +68,7 @@ export const atoms = {
|
|||||||
* Used for the outermost components on screens, to ensure that they can fill
|
* Used for the outermost components on screens, to ensure that they can fill
|
||||||
* the screen and extend beyond.
|
* the screen and extend beyond.
|
||||||
*/
|
*/
|
||||||
// @ts-ignore - web only minHeight string
|
// @ts-expect-error - web only minHeight string
|
||||||
util_screen_outer: [
|
util_screen_outer: [
|
||||||
web({
|
web({
|
||||||
minHeight: '100vh',
|
minHeight: '100vh',
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import React, {useEffect, useLayoutEffect} from 'react'
|
import React, {useEffect, useLayoutEffect} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Image,
|
|
||||||
ImageStyle,
|
|
||||||
Pressable,
|
Pressable,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TextInput,
|
TextInput,
|
||||||
View,
|
View,
|
||||||
|
ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {ScrollView as RNGHScrollView} from 'react-native-gesture-handler'
|
import {ScrollView as RNGHScrollView} from 'react-native-gesture-handler'
|
||||||
import RNPickerSelect from 'react-native-picker-select'
|
import RNPickerSelect from 'react-native-picker-select'
|
||||||
@@ -21,10 +20,6 @@ import Animated, {
|
|||||||
withTiming,
|
withTiming,
|
||||||
} from 'react-native-reanimated'
|
} from 'react-native-reanimated'
|
||||||
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyFeedDefs, moderateProfile} from '@atproto/api'
|
||||||
import {
|
|
||||||
FontAwesomeIcon,
|
|
||||||
FontAwesomeIconStyle,
|
|
||||||
} from '@fortawesome/react-native-fontawesome'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||||
@@ -34,8 +29,6 @@ import {APP_LANGUAGES, LANGUAGES} from '#/lib/../locale/languages'
|
|||||||
import {createHitslop, HITSLOP_20} from '#/lib/constants'
|
import {createHitslop, HITSLOP_20} from '#/lib/constants'
|
||||||
import {HITSLOP_10} from '#/lib/constants'
|
import {HITSLOP_10} from '#/lib/constants'
|
||||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
|
||||||
import {MagnifyingGlassIcon} from '#/lib/icons'
|
import {MagnifyingGlassIcon} from '#/lib/icons'
|
||||||
import {makeProfileLink} from '#/lib/routes/links'
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
import {NavigationProp} from '#/lib/routes/types'
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
@@ -63,16 +56,18 @@ import {Post} from '#/view/com/post/Post'
|
|||||||
import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard'
|
import {ProfileCardWithFollowBtn} from '#/view/com/profile/ProfileCard'
|
||||||
import {Link} from '#/view/com/util/Link'
|
import {Link} from '#/view/com/util/Link'
|
||||||
import {List} from '#/view/com/util/List'
|
import {List} from '#/view/com/util/List'
|
||||||
import {Text} from '#/view/com/util/text/Text'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {Explore} from '#/view/screens/Search/Explore'
|
import {Explore} from '#/view/screens/Search/Explore'
|
||||||
import {SearchLinkCard, SearchProfileCard} from '#/view/shell/desktop/Search'
|
import {SearchLinkCard, SearchProfileCard} from '#/view/shell/desktop/Search'
|
||||||
import {makeSearchQuery, parseSearchQuery} from '#/screens/Search/utils'
|
import {makeSearchQuery, parseSearchQuery} from '#/screens/Search/utils'
|
||||||
import {atoms as a, native, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
import {atoms as a, native, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import * as FeedCard from '#/components/FeedCard'
|
import * as FeedCard from '#/components/FeedCard'
|
||||||
import {SearchInput} from '#/components/forms/SearchInput'
|
import {SearchInput} from '#/components/forms/SearchInput'
|
||||||
import {ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown} from '#/components/icons/Chevron'
|
import {ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown} from '#/components/icons/Chevron'
|
||||||
|
import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times'
|
||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
function Loader() {
|
function Loader() {
|
||||||
return (
|
return (
|
||||||
@@ -85,13 +80,13 @@ function Loader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function EmptyState({message, error}: {message: string; error?: string}) {
|
function EmptyState({message, error}: {message: string; error?: string}) {
|
||||||
const pal = usePalette('default')
|
const t = useTheme()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Content>
|
<Layout.Content>
|
||||||
<View style={[a.p_xl]}>
|
<View style={[a.p_xl]}>
|
||||||
<View style={[pal.viewLight, {padding: 18, borderRadius: 8}]}>
|
<View style={[t.atoms.bg_contrast_25, a.rounded_sm, a.p_lg]}>
|
||||||
<Text style={[pal.text]}>{message}</Text>
|
<Text style={[a.text_md]}>{message}</Text>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<>
|
<>
|
||||||
@@ -101,13 +96,13 @@ function EmptyState({message, error}: {message: string; error?: string}) {
|
|||||||
marginVertical: 12,
|
marginVertical: 12,
|
||||||
height: 1,
|
height: 1,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
backgroundColor: pal.text.color,
|
backgroundColor: t.atoms.text.color,
|
||||||
opacity: 0.2,
|
opacity: 0.2,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Text style={[pal.textLight]}>
|
<Text style={[t.atoms.text_contrast_medium]}>
|
||||||
<Trans>Error:</Trans> {error}
|
<Trans>Error:</Trans> {error}
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
@@ -474,10 +469,10 @@ let SearchScreenInner = ({
|
|||||||
queryWithParams: string
|
queryWithParams: string
|
||||||
headerHeight: number
|
headerHeight: number
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
const pal = usePalette('default')
|
const t = useTheme()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const {isDesktop} = useWebMediaQueries()
|
const {gtTablet} = useBreakpoints()
|
||||||
const [activeTab, setActiveTab] = React.useState(0)
|
const [activeTab, setActiveTab] = React.useState(0)
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
@@ -548,39 +543,29 @@ let SearchScreenInner = ({
|
|||||||
<Explore />
|
<Explore />
|
||||||
) : (
|
) : (
|
||||||
<Layout.Center>
|
<Layout.Center>
|
||||||
<View style={web({height: '100vh'})}>
|
<View style={a.flex_1}>
|
||||||
{isDesktop && (
|
{gtTablet && (
|
||||||
<Text
|
<View
|
||||||
type="title"
|
|
||||||
style={[
|
style={[
|
||||||
pal.text,
|
a.border_b,
|
||||||
pal.border,
|
t.atoms.border_contrast_low,
|
||||||
{
|
a.px_lg,
|
||||||
display: 'flex',
|
a.pt_sm,
|
||||||
paddingVertical: 12,
|
a.pb_lg,
|
||||||
paddingHorizontal: 18,
|
|
||||||
fontWeight: '600',
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
},
|
|
||||||
]}>
|
]}>
|
||||||
<Trans>Search</Trans>
|
<Text style={[a.text_2xl, a.font_heavy]}>
|
||||||
</Text>
|
<Trans>Search</Trans>
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View
|
<View style={[a.align_center, a.justify_center, a.py_4xl, a.gap_lg]}>
|
||||||
style={{
|
|
||||||
flexDirection: 'column',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
paddingVertical: 30,
|
|
||||||
gap: 15,
|
|
||||||
}}>
|
|
||||||
<MagnifyingGlassIcon
|
<MagnifyingGlassIcon
|
||||||
strokeWidth={3}
|
strokeWidth={3}
|
||||||
size={isDesktop ? 60 : 60}
|
size={60}
|
||||||
style={pal.textLight}
|
style={t.atoms.text_contrast_medium as StyleProp<ViewStyle>}
|
||||||
/>
|
/>
|
||||||
<Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}>
|
<Text style={[t.atoms.text_contrast_medium, a.text_md]}>
|
||||||
<Trans>Find posts and users on Bluesky</Trans>
|
<Trans>Find posts and users on Bluesky</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -1075,17 +1060,17 @@ function SearchHistory({
|
|||||||
onRemoveItemClick: (item: string) => void
|
onRemoveItemClick: (item: string) => void
|
||||||
onRemoveProfileClick: (profile: AppBskyActorDefs.ProfileViewBasic) => void
|
onRemoveProfileClick: (profile: AppBskyActorDefs.ProfileViewBasic) => void
|
||||||
}) {
|
}) {
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {gtMobile} = useBreakpoints()
|
||||||
const pal = usePalette('default')
|
const t = useTheme()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Content
|
<Layout.Content
|
||||||
keyboardDismissMode="interactive"
|
keyboardDismissMode="interactive"
|
||||||
keyboardShouldPersistTaps="handled">
|
keyboardShouldPersistTaps="handled">
|
||||||
<View style={styles.searchHistoryContainer}>
|
<View style={[a.w_full, a.px_md]}>
|
||||||
{(searchHistory.length > 0 || selectedProfiles.length > 0) && (
|
{(searchHistory.length > 0 || selectedProfiles.length > 0) && (
|
||||||
<Text style={[pal.text, styles.searchHistoryTitle]}>
|
<Text style={[a.text_md, a.font_bold, a.p_md]}>
|
||||||
<Trans>Recent Searches</Trans>
|
<Trans>Recent Searches</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@@ -1093,7 +1078,7 @@ function SearchHistory({
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
styles.selectedProfilesContainer,
|
styles.selectedProfilesContainer,
|
||||||
isMobile && styles.selectedProfilesContainerMobile,
|
!gtMobile && styles.selectedProfilesContainerMobile,
|
||||||
]}>
|
]}>
|
||||||
<RNGHScrollView
|
<RNGHScrollView
|
||||||
keyboardShouldPersistTaps="handled"
|
keyboardShouldPersistTaps="handled"
|
||||||
@@ -1101,7 +1086,7 @@ function SearchHistory({
|
|||||||
style={[
|
style={[
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
a.flex_nowrap,
|
a.flex_nowrap,
|
||||||
{marginHorizontal: -tokens.space._2xl},
|
{marginHorizontal: tokens.space._2xl * -1},
|
||||||
]}
|
]}
|
||||||
contentContainerStyle={[a.px_2xl, a.border_0]}>
|
contentContainerStyle={[a.px_2xl, a.border_0]}>
|
||||||
{selectedProfiles.slice(0, 5).map((profile, index) => (
|
{selectedProfiles.slice(0, 5).map((profile, index) => (
|
||||||
@@ -1109,7 +1094,7 @@ function SearchHistory({
|
|||||||
key={index}
|
key={index}
|
||||||
style={[
|
style={[
|
||||||
styles.profileItem,
|
styles.profileItem,
|
||||||
isMobile && styles.profileItemMobile,
|
!gtMobile && styles.profileItemMobile,
|
||||||
]}>
|
]}>
|
||||||
<Link
|
<Link
|
||||||
href={makeProfileLink(profile)}
|
href={makeProfileLink(profile)}
|
||||||
@@ -1117,15 +1102,15 @@ function SearchHistory({
|
|||||||
asAnchor
|
asAnchor
|
||||||
anchorNoUnderline
|
anchorNoUnderline
|
||||||
onBeforePress={() => onProfileClick(profile)}
|
onBeforePress={() => onProfileClick(profile)}
|
||||||
style={styles.profilePressable}>
|
style={[a.align_center, a.w_full]}>
|
||||||
<Image
|
<UserAvatar
|
||||||
source={{uri: profile.avatar}}
|
avatar={profile.avatar}
|
||||||
style={styles.profileAvatar as StyleProp<ImageStyle>}
|
type={profile.associated?.labeler ? 'labeler' : 'user'}
|
||||||
accessibilityIgnoresInvertColors
|
size={60}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
emoji
|
emoji
|
||||||
style={[pal.text, styles.profileName]}
|
style={[a.text_xs, a.text_center, styles.profileName]}
|
||||||
numberOfLines={1}>
|
numberOfLines={1}>
|
||||||
{sanitizeDisplayName(
|
{sanitizeDisplayName(
|
||||||
profile.displayName || profile.handle,
|
profile.displayName || profile.handle,
|
||||||
@@ -1141,11 +1126,7 @@ function SearchHistory({
|
|||||||
onPress={() => onRemoveProfileClick(profile)}
|
onPress={() => onRemoveProfileClick(profile)}
|
||||||
hitSlop={createHitslop(6)}
|
hitSlop={createHitslop(6)}
|
||||||
style={styles.profileRemoveBtn}>
|
style={styles.profileRemoveBtn}>
|
||||||
<FontAwesomeIcon
|
<XIcon size="xs" style={t.atoms.text_contrast_low} />
|
||||||
icon="xmark"
|
|
||||||
size={14}
|
|
||||||
style={pal.textLight as FontAwesomeIconStyle}
|
|
||||||
/>
|
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
@@ -1153,34 +1134,25 @@ function SearchHistory({
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{searchHistory.length > 0 && (
|
{searchHistory.length > 0 && (
|
||||||
<View style={styles.searchHistoryContent}>
|
<View style={[a.pl_md, a.pr_xs, a.mt_md]}>
|
||||||
{searchHistory.slice(0, 5).map((historyItem, index) => (
|
{searchHistory.slice(0, 5).map((historyItem, index) => (
|
||||||
<View
|
<View key={index} style={[a.flex_row, a.align_center, a.mt_xs]}>
|
||||||
key={index}
|
|
||||||
style={[
|
|
||||||
a.flex_row,
|
|
||||||
a.mt_md,
|
|
||||||
a.justify_center,
|
|
||||||
a.justify_between,
|
|
||||||
]}>
|
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
onPress={() => onItemClick(historyItem)}
|
onPress={() => onItemClick(historyItem)}
|
||||||
hitSlop={HITSLOP_10}
|
hitSlop={HITSLOP_10}
|
||||||
style={[a.flex_1, a.py_sm]}>
|
style={[a.flex_1, a.py_md]}>
|
||||||
<Text style={pal.text}>{historyItem}</Text>
|
<Text style={[a.text_md]}>{historyItem}</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<Pressable
|
<Button
|
||||||
accessibilityRole="button"
|
label={_(msg`Remove ${historyItem}`)}
|
||||||
onPress={() => onRemoveItemClick(historyItem)}
|
onPress={() => onRemoveItemClick(historyItem)}
|
||||||
hitSlop={HITSLOP_10}
|
size="small"
|
||||||
style={[a.px_md, a.py_xs, a.justify_center]}>
|
variant="ghost"
|
||||||
<FontAwesomeIcon
|
color="secondary"
|
||||||
icon="xmark"
|
shape="round">
|
||||||
size={16}
|
<ButtonIcon icon={XIcon} />
|
||||||
style={pal.textLight as FontAwesomeIconStyle}
|
</Button>
|
||||||
/>
|
|
||||||
</Pressable>
|
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
@@ -1197,41 +1169,6 @@ function scrollToTopWeb() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
headerMenuBtn: {
|
|
||||||
width: 30,
|
|
||||||
height: 30,
|
|
||||||
borderRadius: 30,
|
|
||||||
marginRight: 6,
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
|
||||||
headerSearchContainer: {
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
borderRadius: 30,
|
|
||||||
paddingHorizontal: 12,
|
|
||||||
paddingVertical: 8,
|
|
||||||
},
|
|
||||||
headerSearchIcon: {
|
|
||||||
marginRight: 6,
|
|
||||||
alignSelf: 'center',
|
|
||||||
},
|
|
||||||
headerSearchInput: {
|
|
||||||
flex: 1,
|
|
||||||
fontSize: 17,
|
|
||||||
minWidth: 0,
|
|
||||||
},
|
|
||||||
headerCancelBtn: {
|
|
||||||
paddingLeft: 10,
|
|
||||||
alignSelf: 'center',
|
|
||||||
zIndex: -1,
|
|
||||||
elevation: -1, // For Android
|
|
||||||
},
|
|
||||||
searchHistoryContainer: {
|
|
||||||
width: '100%',
|
|
||||||
paddingHorizontal: 12,
|
|
||||||
},
|
|
||||||
selectedProfilesContainer: {
|
selectedProfilesContainer: {
|
||||||
marginTop: 10,
|
marginTop: 10,
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
@@ -1248,20 +1185,9 @@ const styles = StyleSheet.create({
|
|||||||
profileItemMobile: {
|
profileItemMobile: {
|
||||||
width: 70,
|
width: 70,
|
||||||
},
|
},
|
||||||
profilePressable: {
|
|
||||||
alignItems: 'center',
|
|
||||||
width: '100%',
|
|
||||||
},
|
|
||||||
profileAvatar: {
|
|
||||||
width: 60,
|
|
||||||
height: 60,
|
|
||||||
borderRadius: 45,
|
|
||||||
},
|
|
||||||
profileName: {
|
profileName: {
|
||||||
width: 78,
|
width: 78,
|
||||||
fontSize: 12,
|
marginTop: 6,
|
||||||
textAlign: 'center',
|
|
||||||
marginTop: 5,
|
|
||||||
},
|
},
|
||||||
profileRemoveBtn: {
|
profileRemoveBtn: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@@ -1274,13 +1200,4 @@ const styles = StyleSheet.create({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
searchHistoryContent: {
|
|
||||||
paddingHorizontal: 10,
|
|
||||||
borderRadius: 8,
|
|
||||||
},
|
|
||||||
searchHistoryTitle: {
|
|
||||||
fontWeight: '600',
|
|
||||||
paddingVertical: 12,
|
|
||||||
paddingHorizontal: 10,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user