...
 
Commits (2)
......@@ -17,7 +17,8 @@
"error":"SORRY, WE COULDN'T LOAD THE ACTIVITY",
"tryAgain":"PLEASE TRY AGAIN LATER",
"remindBlocked":"This remind is not available because you blocked",
"scheduled":"This activity is scheduled to be shown on"
"scheduled":"This activity is scheduled to be shown on",
"pendingModeration":"This post is awaiting moderation"
},
"permissions": {
"externalStorage":"Minds needs access to your external storage so you can upload awesome pictures.",
......
......@@ -359,6 +359,13 @@ export default class BaseModel {
return this.time_created * 1000 > Date.now();
}
/**
* Check if awaiting for moderation
*/
isPending() {
return this.pending && this.pending !== '0'; // asking like this because front does the same
}
static isScheduled(timeCreatedValue) {
let response = false;
......
......@@ -133,20 +133,65 @@ export default class Activity extends Component {
{ overlay }
</View>
{ this.showActions() }
{ this.props.entity.isScheduled() &&
<View style={[{backgroundColor: '#ffecb3'}, CommonStyle.padding]}>
<Text style={[styles.scheduledText, CommonStyle.paddingLeft]}>
{`${i18n.t('activity.scheduled')} ${formatDate(this.props.entity.time_created)}.`}
</Text>
</View> }
{ this.props.isLast ? <View style={styles.activitySpacer}></View> : null}
{ !this.props.hideTabs &&
!this.props.entity.isScheduled() &&
<ActivityMetrics entity={this.props.entity}/> }
{ this.renderScheduledMessage() }
{ this.renderPendingMessage() }
{ this.renderActivitySpacer() }
{ this.renderActivityMetrics() }
</View>
);
}
/**
* Render activity spacer
*/
renderActivitySpacer = () => {
return this.props.isLast
? (<View style={styles.activitySpacer}></View>)
: null;
};
/**
* Render entity metrics
*/
renderActivityMetrics = () => {
return (
!this.props.hideTabs &&
!this.props.entity.isScheduled() &&
!this.props.entity.isPending()
) ? (<ActivityMetrics entity={this.props.entity}/>) : null
};
/**
* Show message if entity is scheduled
*/
renderScheduledMessage = () => {
return this.props.entity.isScheduled()
? (this.renderYellowBanner(`${i18n.t('activity.scheduled')} ${formatDate(this.props.entity.time_created)}.`))
: null;
};
/**
* Show message if entity is awaiting moderation
*/
renderPendingMessage = () => {
return this.props.entity.isPending()
? (this.renderYellowBanner(i18n.t('activity.pendingModeration')))
: null;
};
/**
* Render a banner with a message bellow the activity
*/
renderYellowBanner = message => {
return (
<View style={[styles.yellowBanner, CommonStyle.padding]}>
<Text style={[styles.yellowBannerText, CommonStyle.paddingLeft]}>
{message}
</Text>
</View>
);
};
/**
* Pause video if exist
*/
......@@ -348,8 +393,11 @@ const styles = StyleSheet.create({
blockedNoticeDesc: {
opacity: 0.7,
},
scheduledText: {
yellowBannerText: {
fontSize: 11,
color: '#000',
},
yellowBanner: {
backgroundColor: '#ffecb3',
}
});