Cross-device sync implementation #505
7 changed files with 63 additions and 44 deletions
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
|
||||
import { normalizeURI } from 'lbry-redux';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
||||
import Colors from 'styles/colors';
|
||||
|
@ -36,7 +37,9 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||
const channelUri = normalizeURI(titleParts[1]);
|
||||
return (
|
||||
<View style={subscriptionsStyle.titleRow}>
|
||||
<Link style={subscriptionsStyle.channelTitle} text={channelName} href={channelUri} />
|
||||
<Link style={subscriptionsStyle.channelTitle} text={channelName} onPress={() => {
|
||||
navigateToUri(navigation, normalizeURI(channelUri));
|
||||
}} />
|
||||
<SubscribeButton style={subscriptionsStyle.subscribeButton} uri={channelUri} name={channelName} />
|
||||
</View>
|
||||
)
|
||||
|
|
|
@ -101,10 +101,24 @@ class UriBar extends React.PureComponent {
|
|||
}
|
||||
|
||||
let style = [uriBarStyle.overlay];
|
||||
if (this.state.focused) {
|
||||
/*if (this.state.focused) {
|
||||
style.push(uriBarStyle.inFocus);
|
||||
}
|
||||
|
||||
{(this.state.focused && !this.state.directSearch) && (
|
||||
<View style={uriBarStyle.suggestions}>
|
||||
<FlatList style={uriBarStyle.suggestionList}
|
||||
data={suggestions}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
keyExtractor={(item, value) => item.value}
|
||||
renderItem={({item}) => (
|
||||
<UriBarItem
|
||||
item={item}
|
||||
navigation={navigation}
|
||||
onPress={() => this.handleItemPress(item)}
|
||||
/>)} />
|
||||
</View>)}*/
|
||||
|
||||
return (
|
||||
<View style={style}>
|
||||
<View style={uriBarStyle.uriContainer}>
|
||||
|
@ -153,19 +167,6 @@ class UriBar extends React.PureComponent {
|
|||
}
|
||||
}}/>
|
||||
</View>
|
||||
{(this.state.focused && !this.state.directSearch) && (
|
||||
<View style={uriBarStyle.suggestions}>
|
||||
<FlatList style={uriBarStyle.suggestionList}
|
||||
data={suggestions}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
keyExtractor={(item, value) => item.value}
|
||||
renderItem={({item}) => (
|
||||
<UriBarItem
|
||||
item={item}
|
||||
navigation={navigation}
|
||||
onPress={() => this.handleItemPress(item)}
|
||||
/>)} />
|
||||
</View>)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -591,6 +591,10 @@ class FilePage extends React.PureComponent {
|
|||
show={DateTime.SHOW_DATE} />
|
||||
</View>
|
||||
<View style={filePageStyle.subscriptionRow}>
|
||||
<Button style={[filePageStyle.actionButton, filePageStyle.tipButton]}
|
||||
theme={"light"}
|
||||
icon={"gift"}
|
||||
onPress={() => this.setState({ showTipView: true })} />
|
||||
<SubscribeButton
|
||||
style={filePageStyle.actionButton}
|
||||
uri={fullChannelUri}
|
||||
|
@ -603,14 +607,9 @@ class FilePage extends React.PureComponent {
|
|||
</View>
|
||||
}
|
||||
|
||||
{(this.state.showDescription && description && description.length > 0) && <View style={filePageStyle.divider} />}
|
||||
{(this.state.showDescription && description) &&
|
||||
<Text style={filePageStyle.description} selectable={true}>{this.linkify(description)}</Text>}
|
||||
|
||||
<View onLayout={this.setRelatedContentPosition} />
|
||||
<RelatedContent navigation={navigation} uri={uri} />
|
||||
</ScrollView>
|
||||
{this.state.showTipView && <View style={filePageStyle.tipCard}>
|
||||
{this.state.showTipView && <View style={filePageStyle.divider} />}
|
||||
{this.state.showTipView &&
|
||||
<View style={filePageStyle.tipCard}>
|
||||
<View style={filePageStyle.row}>
|
||||
<View style={filePageStyle.amountRow}>
|
||||
<TextInput ref={ref => this.tipAmountInput = ref}
|
||||
|
@ -621,12 +620,20 @@ class FilePage extends React.PureComponent {
|
|||
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
||||
</View>
|
||||
<Link style={[filePageStyle.link, filePageStyle.cancelTipLink]} text={'Cancel'} onPress={() => this.setState({ showTipView: false })} />
|
||||
<Button text={'Send tip'}
|
||||
<Button text={'Send a tip'}
|
||||
style={[filePageStyle.button, filePageStyle.sendButton]}
|
||||
disabled={!canSendTip}
|
||||
onPress={this.handleSendTip} />
|
||||
</View>
|
||||
</View>}
|
||||
|
||||
{(this.state.showDescription && description && description.length > 0) && <View style={filePageStyle.divider} />}
|
||||
{(this.state.showDescription && description) &&
|
||||
<Text style={filePageStyle.description} selectable={true}>{this.linkify(description)}</Text>}
|
||||
|
||||
<View onLayout={this.setRelatedContentPosition} />
|
||||
<RelatedContent navigation={navigation} uri={uri} />
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{!this.state.fullscreenMode && <FloatingWalletBalance navigation={navigation} />}
|
||||
|
|
|
@ -55,7 +55,15 @@ class SearchPage extends React.PureComponent {
|
|||
onSearchSubmitted={this.handleSearchSubmitted} />
|
||||
{!isSearching && (!uris || uris.length === 0) &&
|
||||
<Text style={searchStyle.noResultsText}>No results to display.</Text>}
|
||||
<ScrollView style={searchStyle.scrollContainer} contentContainerStyle={searchStyle.scrollPadding}>
|
||||
{isSearching &&
|
||||
<View style={searchStyle.busyContainer}>
|
||||
<ActivityIndicator size="large" color={Colors.LbryGreen} style={searchStyle.loading} />
|
||||
</View>}
|
||||
{!isSearching &&
|
||||
<ScrollView
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}>
|
||||
|
||||
{this.state.currentUri &&
|
||||
<FileListItem
|
||||
key={this.state.currentUri}
|
||||
|
@ -72,8 +80,7 @@ class SearchPage extends React.PureComponent {
|
|||
navigation={navigation}
|
||||
onPress={() => navigateToUri(navigation, uri)}/>)
|
||||
) : null }
|
||||
</ScrollView>
|
||||
{isSearching && <ActivityIndicator size="large" color={Colors.LbryGreen} style={searchStyle.loading} /> }
|
||||
</ScrollView>}
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -246,11 +246,8 @@ const filePageStyle = StyleSheet.create({
|
|||
color: "rgba(64, 184, 154, .2)"
|
||||
},
|
||||
tipCard: {
|
||||
backgroundColor: Colors.White,
|
||||
position: 'absolute',
|
||||
top: containedMediaHeightWithControls - 16,
|
||||
width: '100%',
|
||||
paddingTop: 8,
|
||||
marginTop: -12,
|
||||
paddingBottom: 8,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16
|
||||
|
@ -298,6 +295,9 @@ const filePageStyle = StyleSheet.create({
|
|||
fontFamily: 'Inter-UI-Regular',
|
||||
fontSize: 16,
|
||||
lineHeight: 24
|
||||
},
|
||||
tipButton: {
|
||||
marginRight: 8
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -4,15 +4,16 @@ import Colors from 'styles/colors';
|
|||
const searchStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
scrollContainer: {
|
||||
flex: 1,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
marginTop: 60
|
||||
},
|
||||
busyContainer: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
scrollPadding: {
|
||||
paddingBottom: 16
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ const uriBarStyle = StyleSheet.create({
|
|||
},
|
||||
overlay: {
|
||||
position: 'absolute',
|
||||
backgroundColor: 'transparent',
|
||||
backgroundColor: '#cc0000',
|
||||
top: 0,
|
||||
width: '100%',
|
||||
zIndex: 200,
|
||||
|
|
Loading…
Reference in a new issue
Duplicated conditional, use fragments?