Merge branch 'mozzius-web-search' into main
commit
c9704f447d
|
@ -303,7 +303,13 @@ function SearchScreenUserResults({query}: {query: string}) {
|
||||||
|
|
||||||
const SECTIONS_LOGGEDOUT = ['Users']
|
const SECTIONS_LOGGEDOUT = ['Users']
|
||||||
const SECTIONS_LOGGEDIN = ['Posts', 'Users']
|
const SECTIONS_LOGGEDIN = ['Posts', 'Users']
|
||||||
export function SearchScreenInner({query}: {query?: string}) {
|
export function SearchScreenInner({
|
||||||
|
query,
|
||||||
|
primarySearch,
|
||||||
|
}: {
|
||||||
|
query?: string
|
||||||
|
primarySearch?: boolean
|
||||||
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
|
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
|
||||||
|
@ -413,7 +419,7 @@ export function SearchScreenInner({query}: {query?: string}) {
|
||||||
style={pal.textLight}
|
style={pal.textLight}
|
||||||
/>
|
/>
|
||||||
<Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}>
|
<Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}>
|
||||||
{isDesktop ? (
|
{isDesktop && !primarySearch ? (
|
||||||
<Trans>Find users with the search tool on the right</Trans>
|
<Trans>Find users with the search tool on the right</Trans>
|
||||||
) : (
|
) : (
|
||||||
<Trans>Find users on Bluesky</Trans>
|
<Trans>Find users on Bluesky</Trans>
|
||||||
|
@ -425,19 +431,7 @@ export function SearchScreenInner({query}: {query?: string}) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SearchScreenDesktop(
|
export function SearchScreen(
|
||||||
props: NativeStackScreenProps<SearchTabNavigatorParams, 'Search'>,
|
|
||||||
) {
|
|
||||||
const {isDesktop} = useWebMediaQueries()
|
|
||||||
|
|
||||||
return isDesktop ? (
|
|
||||||
<SearchScreenInner query={props.route.params?.q} />
|
|
||||||
) : (
|
|
||||||
<SearchScreenMobile {...props} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SearchScreenMobile(
|
|
||||||
props: NativeStackScreenProps<SearchTabNavigatorParams, 'Search'>,
|
props: NativeStackScreenProps<SearchTabNavigatorParams, 'Search'>,
|
||||||
) {
|
) {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
@ -449,7 +443,7 @@ export function SearchScreenMobile(
|
||||||
const moderationOpts = useModerationOpts()
|
const moderationOpts = useModerationOpts()
|
||||||
const search = useActorAutocompleteFn()
|
const search = useActorAutocompleteFn()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {isTablet} = useWebMediaQueries()
|
const {isTabletOrDesktop, isTabletOrMobile} = useWebMediaQueries()
|
||||||
|
|
||||||
const searchDebounceTimeout = React.useRef<NodeJS.Timeout | undefined>(
|
const searchDebounceTimeout = React.useRef<NodeJS.Timeout | undefined>(
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -524,17 +518,29 @@ export function SearchScreenMobile(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
<CenteredView style={[styles.header, pal.border]} sideBorders={isTablet}>
|
<CenteredView
|
||||||
<Pressable
|
style={[
|
||||||
testID="viewHeaderBackOrMenuBtn"
|
styles.header,
|
||||||
onPress={onPressMenu}
|
pal.border,
|
||||||
hitSlop={HITSLOP_10}
|
isTabletOrDesktop && {paddingTop: 10},
|
||||||
style={styles.headerMenuBtn}
|
]}
|
||||||
accessibilityRole="button"
|
sideBorders={isTabletOrDesktop}>
|
||||||
accessibilityLabel={_(msg`Menu`)}
|
{isTabletOrMobile && (
|
||||||
accessibilityHint="Access navigation links and settings">
|
<Pressable
|
||||||
<FontAwesomeIcon icon="bars" size={18} color={pal.colors.textLight} />
|
testID="viewHeaderBackOrMenuBtn"
|
||||||
</Pressable>
|
onPress={onPressMenu}
|
||||||
|
hitSlop={HITSLOP_10}
|
||||||
|
style={styles.headerMenuBtn}
|
||||||
|
accessibilityRole="button"
|
||||||
|
accessibilityLabel={_(msg`Menu`)}
|
||||||
|
accessibilityHint="Access navigation links and settings">
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon="bars"
|
||||||
|
size={18}
|
||||||
|
color={pal.colors.textLight}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
)}
|
||||||
|
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
@ -598,7 +604,7 @@ export function SearchScreenMobile(
|
||||||
{isFetching ? (
|
{isFetching ? (
|
||||||
<Loader />
|
<Loader />
|
||||||
) : (
|
) : (
|
||||||
<ScrollView style={{height: '100%'}}>
|
<ScrollView style={{height: '100%'}} dataSet={{stableGutters: '1'}}>
|
||||||
{searchResults.length ? (
|
{searchResults.length ? (
|
||||||
searchResults.map((item, i) => (
|
searchResults.map((item, i) => (
|
||||||
<SearchResultCard
|
<SearchResultCard
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
import {SearchScreenMobile} from '#/view/screens/Search/Search'
|
export {SearchScreen} from '#/view/screens/Search/Search'
|
||||||
|
|
||||||
export const SearchScreen = SearchScreenMobile
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
import {SearchScreenDesktop} from '#/view/screens/Search/Search'
|
|
||||||
|
|
||||||
export const SearchScreen = SearchScreenDesktop
|
|
|
@ -124,6 +124,7 @@ function NativeStackNavigator({
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationContent>
|
<NavigationContent>
|
||||||
<NativeStackView
|
<NativeStackView
|
||||||
|
@ -136,7 +137,7 @@ function NativeStackNavigator({
|
||||||
{isWeb && !isMobile && (
|
{isWeb && !isMobile && (
|
||||||
<>
|
<>
|
||||||
<DesktopLeftNav />
|
<DesktopLeftNav />
|
||||||
<DesktopRightNav />
|
<DesktopRightNav routeName={activeRoute.name} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</NavigationContent>
|
</NavigationContent>
|
||||||
|
|
|
@ -21,7 +21,7 @@ export function DesktopFeeds() {
|
||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, pal.view, pal.border]}>
|
<View style={[styles.container, pal.view]}>
|
||||||
<FeedItem href="/" title="Following" current={route.name === 'Home'} />
|
<FeedItem href="/" title="Following" current={route.name === 'Home'} />
|
||||||
{feeds
|
{feeds
|
||||||
.filter(f => f.displayName !== 'Following')
|
.filter(f => f.displayName !== 'Following')
|
||||||
|
@ -91,7 +91,5 @@ const styles = StyleSheet.create({
|
||||||
width: 300,
|
width: 300,
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
paddingVertical: 18,
|
paddingVertical: 18,
|
||||||
borderTopWidth: 1,
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {Plural, Trans, msg, plural} from '@lingui/macro'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useInviteCodesQuery} from '#/state/queries/invites'
|
import {useInviteCodesQuery} from '#/state/queries/invites'
|
||||||
|
|
||||||
export function DesktopRightNav() {
|
export function DesktopRightNav({routeName}: {routeName: string}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const palError = usePalette('error')
|
const palError = usePalette('error')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
@ -30,12 +30,20 @@ export function DesktopRightNav() {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.rightNav, pal.view]}>
|
<View style={[styles.rightNav, pal.view]}>
|
||||||
<View style={{paddingVertical: 20}}>
|
<View style={{paddingVertical: 20}}>
|
||||||
<DesktopSearch />
|
{routeName === 'Search' ? (
|
||||||
|
<View style={{marginBottom: 18}}>
|
||||||
{hasSession && (
|
|
||||||
<View style={{paddingTop: 18, marginBottom: 18}}>
|
|
||||||
<DesktopFeeds />
|
<DesktopFeeds />
|
||||||
</View>
|
</View>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<DesktopSearch />
|
||||||
|
|
||||||
|
{hasSession && (
|
||||||
|
<View style={[pal.border, styles.desktopFeedsContainer]}>
|
||||||
|
<DesktopFeeds />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -196,4 +204,10 @@ const styles = StyleSheet.create({
|
||||||
marginRight: 6,
|
marginRight: 6,
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
},
|
},
|
||||||
|
desktopFeedsContainer: {
|
||||||
|
borderTopWidth: 1,
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
marginTop: 18,
|
||||||
|
marginBottom: 18,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue