Compare commits
5
Commits
rc-next
...
publish-ux
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6733f12e4f | ||
|
|
950b7066a6 | ||
|
|
a26fb3e06b | ||
|
|
8bd3bd21e8 | ||
|
|
0115025b86 |
No files matched your search
+1
-1
@@ -12,7 +12,7 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#3133ea60b0302c162f7b6f67cc858997f1d2ab52",
|
||||
"lbry-redux": "lbryio/lbry-redux#123efacf4d45289ebda9dc291976d475de227a55",
|
||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
|
||||
@@ -30,11 +30,14 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
if (!channels.length && !fetchingChannels) {
|
||||
fetchChannelListMine();
|
||||
}
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { channelName } = this.props;
|
||||
if (this.state.currentSelectedValue !== channelName) {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { channels: prevChannels = [], channelName } = this.props;
|
||||
const { channels = [] } = nextProps;
|
||||
|
||||
if (channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type Props = {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
reward_range?: string,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
reward_description: string,
|
||||
@@ -55,6 +56,20 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
});
|
||||
};
|
||||
|
||||
getDisplayAmount = () => {
|
||||
const { reward } = this.props;
|
||||
if (reward) {
|
||||
if (reward.reward_range && reward.reward_range.includes('-')) {
|
||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||
} else if (reward.reward_amount > 0) {
|
||||
return reward.reward_amount;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown amount which normally shouldn't happen
|
||||
return '?';
|
||||
};
|
||||
|
||||
render() {
|
||||
const { canClaim, isPending, onClaimPress, reward } = this.props;
|
||||
const claimed = !!reward.transaction_id;
|
||||
@@ -101,7 +116,7 @@ class RewardCard extends React.PureComponent<Props> {
|
||||
)}
|
||||
</View>
|
||||
<View style={rewardStyle.rightCol}>
|
||||
<Text style={rewardStyle.rewardAmount}>{reward.reward_amount}</Text>
|
||||
<Text style={rewardStyle.rewardAmount}>{this.getDisplayAmount()}</Text>
|
||||
<Text style={rewardStyle.rewardCurrency}>LBC</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { selectChannelFormState } from 'redux/selectors/form';
|
||||
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ChannelCreator from './view';
|
||||
|
||||
@@ -26,6 +26,7 @@ const select = state => ({
|
||||
drawerStack: selectDrawerStack(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
balance: selectBalance(state),
|
||||
hasFormState: selectHasChannelFormState(state),
|
||||
updatingChannel: selectUpdatingChannel(state),
|
||||
updateChannelError: selectUpdateChannelError(state),
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
canSave: false,
|
||||
claimId: null,
|
||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||
currentPhase: Constants.PHASE_LIST,
|
||||
currentPhase: null,
|
||||
displayName: null,
|
||||
channelNameUserEdited: false,
|
||||
newChannelTitle: '',
|
||||
@@ -148,6 +148,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
navigation,
|
||||
pushDrawerStack,
|
||||
setPlayerVisible,
|
||||
hasFormState,
|
||||
} = this.props;
|
||||
|
||||
NativeModules.Firebase.setCurrentScreen('Channels').then(result => {
|
||||
@@ -163,17 +164,21 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||
|
||||
let isEditMode = false;
|
||||
if (navigation.state.params) {
|
||||
const { editChannelUrl, displayForm } = navigation.state.params;
|
||||
if (editChannelUrl) {
|
||||
isEditMode = true;
|
||||
this.setState({ editChannelUrl, currentPhase: Constants.PHASE_CREATE });
|
||||
} else if (displayForm) {
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE }, () =>
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEditMode && hasFormState) {
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
||||
} else {
|
||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -390,7 +395,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
if (email.trim().length > 0 && (email.indexOf('@') === -1 || email.indexOf('.') === -1)) {
|
||||
if (email && email.trim().length > 0 && (email.indexOf('@') === -1 || email.indexOf('.') === -1)) {
|
||||
notify({ message: 'Please provide a valid email address.' });
|
||||
return;
|
||||
}
|
||||
@@ -521,7 +526,6 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
handleNewChannelPress = () => {
|
||||
const { pushDrawerStack } = this.props;
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
||||
};
|
||||
|
||||
|
||||
@@ -11,13 +11,14 @@ import {
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { doUpdatePublishFormState, doClearPublishFormState } from 'redux/actions/form';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectPublishFormState } from 'redux/selectors/form';
|
||||
import { selectPublishFormState, selectHasPublishFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
balance: selectBalance(state),
|
||||
drawerStack: selectDrawerStack(state),
|
||||
hasFormState: selectHasPublishFormState(state),
|
||||
publishFormState: selectPublishFormState(state),
|
||||
publishFormValues: selectPublishFormValues(state),
|
||||
});
|
||||
|
||||
+23
-22
@@ -84,6 +84,7 @@ class PublishPage extends React.PureComponent {
|
||||
titleFocused: false,
|
||||
descriptionFocused: false,
|
||||
loadingVideos: false,
|
||||
vanityUrl: null,
|
||||
|
||||
// gallery videos
|
||||
videos: null,
|
||||
@@ -102,7 +103,7 @@ class PublishPage extends React.PureComponent {
|
||||
currentMedia: null,
|
||||
currentThumbnailUri: null,
|
||||
updatingThumbnailUri: false,
|
||||
currentPhase: Constants.PHASE_SELECTOR,
|
||||
currentPhase: null,
|
||||
|
||||
// publish
|
||||
advancedMode: false,
|
||||
@@ -169,14 +170,13 @@ class PublishPage extends React.PureComponent {
|
||||
|
||||
loadPendingFormState = () => {
|
||||
const { publishFormState } = this.props;
|
||||
const advancedMode = publishFormState.license;
|
||||
const advancedMode = publishFormState.license !== null;
|
||||
this.setState({ ...publishFormState, advancedMode });
|
||||
};
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { balance, pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||
const { balance, hasFormState, pushDrawerStack, setPlayerVisible, navigation } = this.props;
|
||||
NativeModules.Firebase.setCurrentScreen('Publish').then(result => {
|
||||
console.log(navigation.state.params);
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH, navigation.state.params ? navigation.state.params : null);
|
||||
setPlayerVisible();
|
||||
|
||||
@@ -193,24 +193,35 @@ class PublishPage extends React.PureComponent {
|
||||
);
|
||||
|
||||
// Check if this is an edit action
|
||||
let isEditMode = false,
|
||||
vanityUrlSet = false;
|
||||
if (navigation.state.params) {
|
||||
const { displayForm, editMode, claimToEdit, vanityUrl } = navigation.state.params;
|
||||
if (editMode) {
|
||||
this.prepareEdit(claimToEdit);
|
||||
isEditMode = true;
|
||||
} else if (vanityUrl) {
|
||||
const { claimName } = parseURI(vanityUrl);
|
||||
vanityUrlSet = true;
|
||||
this.setState({
|
||||
name: claimName,
|
||||
hasEditedContentAddress: true,
|
||||
vanityUrlSet: true,
|
||||
vanityUrlSet,
|
||||
vanityUrl: claimName,
|
||||
});
|
||||
} else if (displayForm) {
|
||||
this.loadPendingFormState();
|
||||
this.setState({ currentPhase: Constants.PHASE_DETAILS }, () =>
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEditMode && hasFormState) {
|
||||
this.loadPendingFormState();
|
||||
if (vanityUrlSet) {
|
||||
// replace name with the specified vanity URL if there was one in the pending state
|
||||
this.setState({ name: this.state.vanityUrl });
|
||||
}
|
||||
this.setState({ currentPhase: Constants.PHASE_DETAILS });
|
||||
} else {
|
||||
this.setState({ currentPhase: Constants.PHASE_SELECTOR });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -429,10 +440,6 @@ class PublishPage extends React.PureComponent {
|
||||
() => {
|
||||
this.handleNameChange(this.state.name);
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
||||
if (!this.state.editMode) {
|
||||
// overwrite media with previous?
|
||||
this.loadPendingFormState();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -449,6 +456,7 @@ class PublishPage extends React.PureComponent {
|
||||
publishStarted: false,
|
||||
documentPickerOpen: false,
|
||||
editMode: false,
|
||||
vanityUrl: null,
|
||||
|
||||
currentMedia: null,
|
||||
currentThumbnailUri: null,
|
||||
@@ -1096,17 +1104,10 @@ class PublishPage extends React.PureComponent {
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View style={publishStyle.warning}>
|
||||
<Text style={publishStyle.warningText}>
|
||||
Please ensure that you have filled everything correctly as you cannot edit published content in this
|
||||
release. This feature will be available in a future release.
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={publishStyle.actionButtons}>
|
||||
{(this.state.publishStarted || publishFormValues.publishing) && (
|
||||
<View style={publishStyle.progress}>
|
||||
<ActivityIndicator size={'small'} color={Colors.LbryGreen} />
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||
</View>
|
||||
)}
|
||||
|
||||
|
||||
@@ -157,6 +157,15 @@ class PublishesPage extends React.PureComponent {
|
||||
initialNumToRender={8}
|
||||
maxToRenderPerBatch={24}
|
||||
removeClippedSubviews
|
||||
ListFooterComponent={
|
||||
<View style={publishStyle.publishesFooter}>
|
||||
<Button
|
||||
style={publishStyle.publishesFooterButton}
|
||||
text={__('Publish something new')}
|
||||
onPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||
/>
|
||||
</View>
|
||||
}
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem
|
||||
key={item}
|
||||
|
||||
@@ -11,3 +11,13 @@ export const selectChannelFormState = createSelector(
|
||||
selectState,
|
||||
state => state.channelFormValues || {}
|
||||
);
|
||||
|
||||
export const selectHasPublishFormState = createSelector(
|
||||
selectPublishFormState,
|
||||
values => Object.keys(values).length > 0
|
||||
);
|
||||
|
||||
export const selectHasChannelFormState = createSelector(
|
||||
selectChannelFormState,
|
||||
values => Object.keys(values).length > 0
|
||||
);
|
||||
@@ -129,11 +129,9 @@ const channelCreatorStyle = StyleSheet.create({
|
||||
},
|
||||
scrollContainer: {
|
||||
marginTop: 60,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
},
|
||||
scrollPadding: {
|
||||
paddingTop: 16,
|
||||
padding: 16,
|
||||
},
|
||||
channelListItem: {
|
||||
flexDirection: 'row',
|
||||
|
||||
@@ -433,6 +433,16 @@ const publishStyle = StyleSheet.create({
|
||||
fontSize: 14,
|
||||
color: Colors.DescriptionGrey,
|
||||
},
|
||||
publishesFooter: {
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
},
|
||||
publishesFooterButton: {
|
||||
alignSelf: 'flex-start',
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
marginTop: 16,
|
||||
},
|
||||
});
|
||||
|
||||
export default publishStyle;
|
||||
Reference in new issue
Block a user