update thumbnail display in search results and add channel links
This commit is contained in:
parent
7313e2d1c4
commit
346c7a027d
3 changed files with 29 additions and 22 deletions
|
@ -3,6 +3,7 @@ import { normalizeURI, parseURI } from 'lbry-redux';
|
||||||
import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import Colors from '../../styles/colors';
|
import Colors from '../../styles/colors';
|
||||||
import FileItemMedia from '../fileItemMedia';
|
import FileItemMedia from '../fileItemMedia';
|
||||||
|
import Link from '../../component/link';
|
||||||
import NsfwOverlay from '../../component/nsfwOverlay';
|
import NsfwOverlay from '../../component/nsfwOverlay';
|
||||||
import searchStyle from '../../styles/search';
|
import searchStyle from '../../styles/search';
|
||||||
|
|
||||||
|
@ -33,13 +34,11 @@ class SearchResultItem extends React.PureComponent {
|
||||||
return (
|
return (
|
||||||
<View style={style}>
|
<View style={style}>
|
||||||
<TouchableOpacity style={style} onPress={onPress}>
|
<TouchableOpacity style={style} onPress={onPress}>
|
||||||
<View style={searchStyle.thumbnailContainer}>
|
<FileItemMedia style={searchStyle.thumbnail}
|
||||||
<FileItemMedia style={searchStyle.thumbnail}
|
blurRadius={obscureNsfw ? 15 : 0}
|
||||||
blurRadius={obscureNsfw ? 15 : 0}
|
resizeMode="cover"
|
||||||
resizeMode="cover"
|
title={title}
|
||||||
title={title}
|
thumbnail={metadata ? metadata.thumbnail : null} />
|
||||||
thumbnail={metadata ? metadata.thumbnail : null} />
|
|
||||||
</View>
|
|
||||||
<View style={searchStyle.detailsContainer}>
|
<View style={searchStyle.detailsContainer}>
|
||||||
{isResolvingUri && (
|
{isResolvingUri && (
|
||||||
<View>
|
<View>
|
||||||
|
@ -49,7 +48,11 @@ class SearchResultItem extends React.PureComponent {
|
||||||
</View>
|
</View>
|
||||||
</View>)}
|
</View>)}
|
||||||
{!isResolvingUri && <Text style={searchStyle.title}>{title || name}</Text>}
|
{!isResolvingUri && <Text style={searchStyle.title}>{title || name}</Text>}
|
||||||
{!isResolvingUri && channel && <Text style={searchStyle.publisher}>{channel}</Text>}
|
{!isResolvingUri && channel &&
|
||||||
|
<Link style={searchStyle.publisher} text={channel} onPress={() => {
|
||||||
|
const channelUri = normalizeURI(channel);
|
||||||
|
navigation.navigate({ routeName: 'File', key: channelUri, params: { uri: channelUri }});
|
||||||
|
}} />}
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{obscureNsfw && <NsfwOverlay onPress={() => navigation.navigate({ routeName: 'Settings', key: 'settingsPage' })} />}
|
{obscureNsfw && <NsfwOverlay onPress={() => navigation.navigate({ routeName: 'Settings', key: 'settingsPage' })} />}
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
import { StyleSheet, Dimensions } from 'react-native';
|
import { StyleSheet, Dimensions } from 'react-native';
|
||||||
|
|
||||||
const screenDimension = Dimensions.get('window');
|
|
||||||
const width = screenDimension.width - 48; // screen width minus combined left and right margins
|
|
||||||
|
|
||||||
const fileItemMediaStyle = StyleSheet.create({
|
const fileItemMediaStyle = StyleSheet.create({
|
||||||
autothumb: {
|
autothumb: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 200,
|
height: 200,
|
||||||
justifyContent: 'center'
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center'
|
||||||
},
|
},
|
||||||
autothumbText: {
|
autothumbText: {
|
||||||
fontFamily: 'Metropolis-SemiBold',
|
fontFamily: 'Metropolis-SemiBold',
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { StyleSheet } from 'react-native';
|
import { Dimensions, StyleSheet } from 'react-native';
|
||||||
|
import Colors from './colors';
|
||||||
|
|
||||||
|
const screenDimension = Dimensions.get('window');
|
||||||
|
const screenWidth = screenDimension.width;
|
||||||
|
const screenHeight = screenDimension.height;
|
||||||
|
const thumbnailHeight = 100;
|
||||||
|
const thumbnailWidth = (screenHeight / screenWidth) * thumbnailHeight;
|
||||||
|
|
||||||
const searchStyle = StyleSheet.create({
|
const searchStyle = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -24,14 +31,13 @@ const searchStyle = StyleSheet.create({
|
||||||
marginTop: 16
|
marginTop: 16
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
width: '100%',
|
width: thumbnailWidth,
|
||||||
height: 72
|
height: thumbnailHeight,
|
||||||
},
|
marginRight: 16,
|
||||||
thumbnailContainer: {
|
justifyContent: 'center'
|
||||||
width: '40%'
|
|
||||||
},
|
},
|
||||||
detailsContainer: {
|
detailsContainer: {
|
||||||
width: '55%'
|
flex: 1
|
||||||
},
|
},
|
||||||
searchInput: {
|
searchInput: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
@ -41,7 +47,7 @@ const searchStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
fontFamily: 'Metropolis-SemiBold',
|
fontFamily: 'Metropolis-SemiBold',
|
||||||
fontSize: 14
|
fontSize: 16
|
||||||
},
|
},
|
||||||
uri: {
|
uri: {
|
||||||
fontFamily: 'Metropolis-SemiBold',
|
fontFamily: 'Metropolis-SemiBold',
|
||||||
|
@ -50,9 +56,9 @@ const searchStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
publisher: {
|
publisher: {
|
||||||
fontFamily: 'Metropolis-SemiBold',
|
fontFamily: 'Metropolis-SemiBold',
|
||||||
fontSize: 12,
|
fontSize: 14,
|
||||||
marginTop: 3,
|
marginTop: 3,
|
||||||
color: '#c0c0c0'
|
color: Colors.LbryGreen
|
||||||
},
|
},
|
||||||
noResultsText: {
|
noResultsText: {
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
|
|
Loading…
Reference in a new issue