|
@@ -11,6 +11,7 @@ import { MyRefreshProps } from '../../components/ThemesConfig';
|
|
|
import { PageList } from '../Router';
|
|
import { PageList } from '../Router';
|
|
|
import AlertUtil from './AlertUtil';
|
|
import AlertUtil from './AlertUtil';
|
|
|
import ItemView from './ItemAlert';
|
|
import ItemView from './ItemAlert';
|
|
|
|
|
+import TextView from '../../components/TextView';
|
|
|
|
|
|
|
|
export default class ListAlerts extends Component {
|
|
export default class ListAlerts extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -18,7 +19,8 @@ export default class ListAlerts extends Component {
|
|
|
this.state = {
|
|
this.state = {
|
|
|
dataList: [],
|
|
dataList: [],
|
|
|
refreshing: false,
|
|
refreshing: false,
|
|
|
- showReadAll: false
|
|
|
|
|
|
|
+ showReadAll: false,
|
|
|
|
|
+ unreadTotal: 0
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -80,6 +82,7 @@ export default class ListAlerts extends Component {
|
|
|
if (res.data) {
|
|
if (res.data) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
dataList: res.data,
|
|
dataList: res.data,
|
|
|
|
|
+ unreadTotal: AlertUtil.getUnreadAlert(),
|
|
|
showReadAll: res.data?.length > 0 && AlertUtil.getUnreadAlert() > 0
|
|
showReadAll: res.data?.length > 0 && AlertUtil.getUnreadAlert() > 0
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -142,7 +145,19 @@ export default class ListAlerts extends Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
topView = (props) => {
|
|
topView = (props) => {
|
|
|
- if (this.state.showReadAll) {
|
|
|
|
|
|
|
+ if (this.props.showUnread && this.state.unreadTotal > 0) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <View style={styles.topView2}>
|
|
|
|
|
+ <TextView style={styles.unreadText}>Unread: {this.state.unreadTotal}</TextView>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ style={styles.topButton}
|
|
|
|
|
+ viewStyle={styles.topButtonView}
|
|
|
|
|
+ textStyle={styles.topButtonText}
|
|
|
|
|
+ text={$t("notification.btnReadAll")}
|
|
|
|
|
+ onClick={() => this.onClickReadAll()}/>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )
|
|
|
|
|
+ } else if (this.state.showReadAll) {
|
|
|
return (
|
|
return (
|
|
|
<View style={styles.topView}>
|
|
<View style={styles.topView}>
|
|
|
<Button
|
|
<Button
|
|
@@ -200,7 +215,18 @@ const styles = StyleSheet.create({
|
|
|
flexDirection: 'row',
|
|
flexDirection: 'row',
|
|
|
justifyContent: 'flex-end'
|
|
justifyContent: 'flex-end'
|
|
|
},
|
|
},
|
|
|
|
|
+ topView2: {
|
|
|
|
|
+ padding: 8,
|
|
|
|
|
+ flexDirection: 'row',
|
|
|
|
|
+ justifyContent: 'space-between'
|
|
|
|
|
+ },
|
|
|
|
|
+ unreadText: {
|
|
|
|
|
+ color: textSecondary,
|
|
|
|
|
+ fontSize: 14,
|
|
|
|
|
+ paddingLeft: 6
|
|
|
|
|
+ },
|
|
|
topButton: {
|
|
topButton: {
|
|
|
|
|
+ marginRight: 4,
|
|
|
flexDirection: 'row',
|
|
flexDirection: 'row',
|
|
|
backgroundColor: 'white',
|
|
backgroundColor: 'white',
|
|
|
borderColor: textCancel,
|
|
borderColor: textCancel,
|