Compare commits

...
6 Commits
Author SHA1 Message Date
Akinwale Ariwodola 8b3a0d22be bumpversion 0.7.0 --> 0.7.1 2019-05-29 18:04:42 +01:00
Akinwale Ariwodola f4fe9294f0 fix backspace in search uri bar 2019-05-29 17:45:14 +01:00
Akinwale Ariwodola 67a2b76e41 create progress bar component (#560) 2019-05-29 16:40:59 +01:00
Akinwale Ariwodola 499e406c5d Merge pull request #563 from lbryio/search-uri-bar-fix
fix typing in uri bar on search page
2019-05-29 16:40:22 +01:00
Akinwale Ariwodola 90ccf18fbf fix typing in uri bar on search page 2019-05-29 16:39:34 +01:00
Akinwale Ariwodola 7f57447e57 change the appearance of the uri bar input (#561)
* change the appearance of the uri bar input
* improve no search results display
2019-05-29 11:53:27 +01:00
11 changed files with 120 additions and 34 deletions

No files matched your search

+9 -7
View File
@@ -3,7 +3,6 @@ import { normalizeURI, parseURI } from 'lbry-redux';
import {
ActivityIndicator,
Platform,
ProgressBarAndroid,
Text,
TouchableOpacity,
View
@@ -15,6 +14,7 @@ import FileItemMedia from 'component/fileItemMedia';
import Icon from 'react-native-vector-icons/FontAwesome5';
import Link from 'component/link';
import NsfwOverlay from 'component/nsfwOverlay';
import ProgressBar from 'component/progressBar';
import fileListStyle from 'styles/fileList';
class FileListItem extends React.PureComponent {
@@ -88,7 +88,7 @@ class FileListItem extends React.PureComponent {
title={(title || name)}
thumbnail={thumbnail} />
{(fileInfo && fileInfo.completed && fileInfo.download_path) &&
<Icon style={fileListStyle.downloadedIcon} solid={true} color={Colors.BrightGreen} name={"folder"} size={16} />}
<Icon style={fileListStyle.downloadedIcon} solid={true} color={Colors.NextLbryGreen} name={"folder"} size={16} />}
<View style={fileListStyle.detailsContainer}>
{featuredResult && <Text style={fileListStyle.featuredUri} numberOfLines={1}>{uri}</Text>}
@@ -112,13 +112,15 @@ class FileListItem extends React.PureComponent {
<DateTime style={fileListStyle.publishInfo} textStyle={fileListStyle.infoText} timeAgo uri={uri} />
</View>
{fileInfo &&
{(fileInfo && fileInfo.download_path) &&
<View style={fileListStyle.downloadInfo}>
{!fileInfo.completed &&
<View style={fileListStyle.progress}>
<View style={[fileListStyle.progressCompleted, { flex: this.getDownloadProgress(fileInfo) } ]} />
<View style={[fileListStyle.progressRemaining, { flex: (100 - this.getDownloadProgress(fileInfo)) } ]} />
</View>}
<ProgressBar
borderRadius={3}
color={Colors.NextLbryGreen}
height={3}
style={fileListStyle.progress}
progress={this.getDownloadProgress(fileInfo)} />}
</View>
}
</View>
+4
View File
@@ -0,0 +1,4 @@
import { connect } from 'react-redux';
import ProgressBar from './view';
export default connect()(ProgressBar);
+54
View File
@@ -0,0 +1,54 @@
// @flow
import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
const defaultHeight = 5;
const defaultBorderRadius = 5;
const minProgress = 0;
const maxProgress = 100;
class ProgressBar extends React.PureComponent {
static propTypes = {
borderRadius: PropTypes.number,
color: PropTypes.string.isRequired,
height: PropTypes.number,
progress: function(props, propName, componentName) {
const value = parseInt(props[propName], 10);
if (isNaN(value) || props[propName] < minProgress || props[propName] > maxProgress) {
return new Error('progress should be between 0 and 100');
}
},
style: PropTypes.any
};
render() {
const { borderRadius, color, height, progress, style } = this.props;
const currentProgress = Math.ceil(progress);
let styles = [];
if (style) {
if (style.length) {
styles = styles.concat(style);
} else {
styles.push(style);
}
}
styles.push({
borderRadius: borderRadius || defaultBorderRadius,
flexDirection: 'row',
height: height || defaultHeight,
overflow: 'hidden'
});
return (
<View style={styles}>
<View style={{ backgroundColor: color, borderRadius: borderRadius || defaultBorderRadius, flex: currentProgress }} />
<View style={{ backgroundColor: color, opacity: 0.2, flex: (100 - currentProgress) }} />
</View>
);
}
}
export default ProgressBar;
+2
View File
@@ -5,6 +5,7 @@ import {
selectSearchValue,
selectSearchSuggestions
} from 'lbry-redux';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import UriBar from './view';
const select = state => {
@@ -13,6 +14,7 @@ const select = state => {
return {
...searchState,
query: selectSearchValue(state),
currentRoute: selectCurrentRoute(state),
suggestions: selectSearchSuggestions(state)
};
};
+17 -3
View File
@@ -3,6 +3,7 @@ import React from 'react';
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
import { FlatList, Keyboard, TextInput, View } from 'react-native';
import { navigateToUri } from 'utils/helper';
import Constants from 'constants';
import UriBarItem from './internal/uri-bar-item';
import NavigationButton from 'component/navigationButton';
import discoverStyle from 'styles/discover';
@@ -26,6 +27,15 @@ class UriBar extends React.PureComponent {
}
}
componentWillReceiveProps(nextProps) {
const { currentRoute, query } = nextProps;
const { currentRoute: prevRoute } = this.props;
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
this.setState({ currentValue: query, inputText: query });
}
}
constructor(props) {
super(props);
this.state = {
@@ -122,9 +132,13 @@ class UriBar extends React.PureComponent {
}
}
onSearchPageBlurred() {
this.setState({ currenValueSet: false });
}
render() {
const { navigation, suggestions, query, searchView, value } = this.props;
if (value && this.state.currentValue === null) {
const { navigation, suggestions, query, value } = this.props;
if (this.state.currentValue === null) {
this.setState({ currentValue: value });
}
@@ -150,7 +164,7 @@ class UriBar extends React.PureComponent {
underlineColorAndroid={'transparent'}
numberOfLines={1}
clearButtonMode={'while-editing'}
value={searchView ? query : this.state.currentValue}
value={this.state.currentValue}
returnKeyType={'go'}
inlineImageLeft={'baseline_search_black_24'}
inlineImagePadding={16}
+6 -4
View File
@@ -97,15 +97,13 @@ class SearchPage extends React.PureComponent {
<View style={searchStyle.container}>
<UriBar value={query}
navigation={navigation}
onSearchSubmitted={this.handleSearchSubmitted}
searchView={true} />
onSearchSubmitted={this.handleSearchSubmitted} />
{isSearching &&
<View style={searchStyle.busyContainer}>
<ActivityIndicator size="large" color={Colors.LbryGreen} style={searchStyle.loading} />
</View>}
{!isSearching && (!uris || uris.length === 0) &&
<Text style={searchStyle.noResultsText}>No results to display.</Text>}
{!isSearching &&
<ScrollView
style={searchStyle.scrollContainer}
@@ -127,6 +125,10 @@ class SearchPage extends React.PureComponent {
navigation={navigation}
onPress={() => navigateToUri(navigation, uri)}/>)
) : null }
{(!uris || uris.length === 0) &&
<View style={searchStyle.noResults}>
<Text style={searchStyle.noResultsText}>There are no results to display for <Text style={searchStyle.boldText}>{query}</Text>. Please try a different search term.</Text>
</View>}
</ScrollView>}
<FloatingWalletBalance navigation={navigation} />
</View>
+6 -7
View File
@@ -5,7 +5,6 @@ import {
Linking,
NativeModules,
Platform,
ProgressBarAndroid,
Text,
View
} from 'react-native';
@@ -14,6 +13,7 @@ import { decode as atob } from 'base-64';
import { navigateToUri } from 'utils/helper';
import moment from 'moment';
import AsyncStorage from '@react-native-community/async-storage';
import ProgressBar from 'component/progressBar';
import PropTypes from 'prop-types';
import Colors from 'styles/colors';
import Constants from 'constants';
@@ -271,12 +271,11 @@ class SplashScreen extends React.PureComponent {
return (
<View style={splashStyle.container}>
<Text style={splashStyle.title}>LBRY</Text>
{'android' === Platform.OS && this.state.isDownloadingHeaders &&
<ProgressBarAndroid color={Colors.White}
indeterminate={false}
styleAttr={"Horizontal"}
style={splashStyle.progress}
progress={this.state.headersDownloadProgress/100.0} />}
{this.state.isDownloadingHeaders &&
<ProgressBar
color={Colors.White}
style={splashStyle.progress}
progress={this.state.headersDownloadProgress} />}
{!this.state.isDownloadingHeaders && <ActivityIndicator color={Colors.White} style={splashStyle.loading} size={"small"} />}
<Text style={splashStyle.message}>{message}</Text>
<Text style={splashStyle.details}>{details}</Text>
-3
View File
@@ -71,9 +71,6 @@ const fileListStyle = StyleSheet.create({
},
progress: {
marginTop: (screenWidthPixels <= 720) ? 2 : 4,
height: 3,
flex: 1,
flexDirection: 'row'
},
progressCompleted: {
backgroundColor: Colors.LbryGreen
+16 -4
View File
@@ -8,7 +8,7 @@ const searchStyle = StyleSheet.create({
},
scrollContainer: {
flex: 1,
marginTop: 60
marginTop: 60,
},
busyContainer: {
flex: 1,
@@ -42,11 +42,23 @@ const searchStyle = StyleSheet.create({
fontFamily: 'Inter-UI-Regular',
fontSize: 16
},
noResults: {
flex: 1,
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center'
},
noResultsText: {
textAlign: 'center',
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
position: 'absolute'
fontSize: 16,
marginTop: 16,
marginLeft: 16,
marginRight: 16
},
boldText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 16
},
loading: {
position: 'absolute'
+5 -5
View File
@@ -19,13 +19,13 @@ const uriBarStyle = StyleSheet.create({
elevation: 4
},
uriText: {
backgroundColor: Colors.White,
borderWidth: 1,
borderColor: Colors.LightGrey,
padding: 8,
borderRadius: 4,
backgroundColor: Colors.VeryLightGrey,
borderRadius: 24,
paddingLeft: 12,
paddingRight: 12,
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
lineHeight: 18,
flex: 17
},
overlay: {
+1 -1
View File
@@ -1,4 +1,4 @@
__version__ = "0.7.0"
__version__ = "0.7.1"
class ServiceApp(App):
def build(self):