mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-30 06:12:37 +03:00
Added filter feature for notifications
This commit is contained in:
parent
c8cd291d63
commit
24ccabc512
@ -30,28 +30,14 @@ class NotificationView extends Component {
|
|||||||
// date: 'today',
|
// date: 'today',
|
||||||
isNew: true,
|
isNew: true,
|
||||||
},
|
},
|
||||||
// {
|
],
|
||||||
// name: 'esteemapp',
|
filters: [
|
||||||
// title: '25% likes your post:',
|
{ key: 'activities', value: 'ALL ACTIVITIES' },
|
||||||
// description: 'My own Top 5 eSteem Surfer Features',
|
{ key: 'votes', value: 'VOTES' },
|
||||||
// image: 'https://steemitimages.com/u/feruz/avatar/small',
|
{ key: 'replies', value: 'REPLIES' },
|
||||||
// date: 'yesterday',
|
{ key: 'mentions', value: 'MENTIONS' },
|
||||||
// },
|
{ key: 'follows', value: 'FOLLOWS' },
|
||||||
// {
|
{ key: 'reblogs', value: 'REBLOGS' },
|
||||||
// name: 'esteemapp',
|
|
||||||
// title: '25% likes your post:',
|
|
||||||
// avatar: 'https://steemitimages.com/u/feruz/avatar/small',
|
|
||||||
// description: 'My own Top 5 eSteem Surfer Featuresasassasasaasas',
|
|
||||||
// date: 'yesterday',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: 'esteemapp',
|
|
||||||
// title: '25% likes your post:',
|
|
||||||
// avatar: 'https://steemitimages.com/u/feruz/avatar/small',
|
|
||||||
// description: 'My own Top 5 eSteem Surfer Features',
|
|
||||||
// image: 'https://steemitimages.com/u/feruz/avatar/small',
|
|
||||||
// date: 'yesterday',
|
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -61,18 +47,22 @@ class NotificationView extends Component {
|
|||||||
// Component Functions
|
// Component Functions
|
||||||
|
|
||||||
_handleOnDropdownSelect = (index) => {
|
_handleOnDropdownSelect = (index) => {
|
||||||
console.log(`selected index is:${index}`);
|
const { getActivities } = this.props;
|
||||||
|
const { filters } = this.state;
|
||||||
|
|
||||||
|
getActivities(filters[index].key);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notifications } = this.props;
|
const { notifications } = this.props;
|
||||||
|
const { filters } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<FilterBar
|
<FilterBar
|
||||||
dropdownIconName="md-arrow-dropdown"
|
dropdownIconName="md-arrow-dropdown"
|
||||||
options={['ALL ACTIVITIES', 'VOTES', 'REPLIES', 'MENTIONS', 'FOLLOWS', 'REBLOGS']}
|
options={filters.map(item => item.value)}
|
||||||
defaultText="ALL NOTIFICATION"
|
defaultText="ALL ACTIVITIES"
|
||||||
onDropdownSelect={this._handleOnDropdownSelect}
|
onDropdownSelect={this._handleOnDropdownSelect}
|
||||||
rightIconName="ios-checkmark"
|
rightIconName="ios-checkmark"
|
||||||
/>
|
/>
|
||||||
@ -81,7 +71,7 @@ class NotificationView extends Component {
|
|||||||
<FlatList
|
<FlatList
|
||||||
data={notifications}
|
data={notifications}
|
||||||
renderItem={({ item }) => <NotificationLine notification={item} />}
|
renderItem={({ item }) => <NotificationLine notification={item} />}
|
||||||
keyExtractor={item => item.email}
|
keyExtractor={item => item.id}
|
||||||
/>
|
/>
|
||||||
{/* Will remove follow lines */}
|
{/* Will remove follow lines */}
|
||||||
{/* <ContainerHeader hasSeperator isBoldTitle title="Yesterday" />
|
{/* <ContainerHeader hasSeperator isBoldTitle title="Yesterday" />
|
||||||
|
@ -223,8 +223,32 @@ export const updateDraft = data => new Promise((resolve, reject) => {
|
|||||||
|
|
||||||
export const getActivities = data => new Promise((resolve, reject) => {
|
export const getActivities = data => new Promise((resolve, reject) => {
|
||||||
resolve(testData);
|
resolve(testData);
|
||||||
|
let url = null;
|
||||||
|
switch (data.type) {
|
||||||
|
case 'activities':
|
||||||
|
url = `/activities/${data.user}`;
|
||||||
|
break;
|
||||||
|
case 'votes':
|
||||||
|
url = `/rvotes/${data.user}`;
|
||||||
|
break;
|
||||||
|
case 'replies':
|
||||||
|
url = `/replies/${data.user}`;
|
||||||
|
break;
|
||||||
|
case 'mentions':
|
||||||
|
url = `/mentions/${data.user}`;
|
||||||
|
break;
|
||||||
|
case 'follows':
|
||||||
|
url = `/follows/${data.user}`;
|
||||||
|
break;
|
||||||
|
case 'reblogs':
|
||||||
|
url = `/reblogs/${data.user}`;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
url = `/activities/${data.user}`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
api
|
api
|
||||||
.get(`/activities/${data.user}`, {
|
.get(url, {
|
||||||
params: {
|
params: {
|
||||||
since: data.since,
|
since: data.since,
|
||||||
},
|
},
|
||||||
|
@ -15,16 +15,26 @@ class NotificationContainer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
getActivities({ user: 'mistikk' }).then((res) => {
|
this._getAvtivities();
|
||||||
|
}
|
||||||
|
|
||||||
|
_getAvtivities = (type = null) => {
|
||||||
|
getActivities({ user: 'mistikk', type }).then((res) => {
|
||||||
console.log('res :', res);
|
console.log('res :', res);
|
||||||
this.setState({ notifications: res });
|
this.setState({ notifications: res });
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notifications } = this.state;
|
const { notifications } = this.state;
|
||||||
|
|
||||||
return <NotificationScreen notifications={notifications} {...this.props} />;
|
return (
|
||||||
|
<NotificationScreen
|
||||||
|
getActivities={this._getAvtivities}
|
||||||
|
notifications={notifications}
|
||||||
|
{...this.props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class NotificationScreen extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notifications } = this.props;
|
const { notifications, getActivities } = this.props;
|
||||||
console.log('notifications :', notifications);
|
console.log('notifications :', notifications);
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@ -37,7 +37,7 @@ class NotificationScreen extends PureComponent {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<View tabLabel="Notification" style={styles.notificationTab}>
|
<View tabLabel="Notification" style={styles.notificationTab}>
|
||||||
<Notification notifications={notifications} />
|
<Notification getActivities={getActivities} notifications={notifications} />
|
||||||
</View>
|
</View>
|
||||||
<View tabLabel="Leaderboard" style={styles.leaderboardTab}>
|
<View tabLabel="Leaderboard" style={styles.leaderboardTab}>
|
||||||
<NoPost
|
<NoPost
|
||||||
|
Loading…
Reference in New Issue
Block a user