mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 19:29:56 +00:00
improve notification
This commit is contained in:
@@ -7,10 +7,15 @@ class Notification extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
showNotice: false,
|
showNotice: false,
|
||||||
notice_html: ''
|
notice_html: '',
|
||||||
|
unseenCount: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.loadUnseenCount();
|
||||||
|
}
|
||||||
|
|
||||||
onClick = () => {
|
onClick = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNotice: !this.state.showNotice
|
showNotice: !this.state.showNotice
|
||||||
@@ -22,9 +27,16 @@ class Notification extends React.Component {
|
|||||||
|
|
||||||
if (this.state.showNotice) {
|
if (this.state.showNotice) {
|
||||||
seafileAPI.updateNotifications();
|
seafileAPI.updateNotifications();
|
||||||
|
this.loadUnseenCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadUnseenCount = () => {
|
||||||
|
seafileAPI.getUnseenCount().then(res => {
|
||||||
|
this.setState({unseenCount: res.data.unseen_count});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loadNotices = () => {
|
loadNotices = () => {
|
||||||
seafileAPI.listPopupNotices().then(res => {
|
seafileAPI.listPopupNotices().then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -40,7 +52,7 @@ class Notification extends React.Component {
|
|||||||
<div id="notifications">
|
<div id="notifications">
|
||||||
<a href="#" onClick={this.onClick} className="no-deco" id="notice-icon" title="Notifications" aria-label="Notifications">
|
<a href="#" onClick={this.onClick} className="no-deco" id="notice-icon" title="Notifications" aria-label="Notifications">
|
||||||
<span className="sf2-icon-bell"></span>
|
<span className="sf2-icon-bell"></span>
|
||||||
<span className="num hide">0</span>
|
<span className={`num ${this.state.unseenCount ? '' : 'hide'}`}>{this.state.unseenCount}</span>
|
||||||
</a>
|
</a>
|
||||||
<div id="notice-popover" className={`sf-popover ${this.state.showNotice ? '': 'hide'}`}>
|
<div id="notice-popover" className={`sf-popover ${this.state.showNotice ? '': 'hide'}`}>
|
||||||
<div className="outer-caret up-outer-caret"><div className="inner-caret"></div></div>
|
<div className="outer-caret up-outer-caret"><div className="inner-caret"></div></div>
|
||||||
|
@@ -195,7 +195,7 @@ class FilesActivities extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
items: res.data.events,
|
items: res.data.events,
|
||||||
has_more: res.data.events.length == '0' ? false : true
|
has_more: res.data.events.length < 25 ? false : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -203,11 +203,8 @@ class FilesActivities extends Component {
|
|||||||
|
|
||||||
getMore() {
|
getMore() {
|
||||||
const pageNum = this.state.page + 1;
|
const pageNum = this.state.page + 1;
|
||||||
this.setState({
|
this.setState({page: pageNum});
|
||||||
page: pageNum
|
seafileAPI.listActivities(pageNum).then(res => {
|
||||||
});
|
|
||||||
seafileAPI.listActivities(pageNum)
|
|
||||||
.then(res => {
|
|
||||||
if (res.status == 403) {
|
if (res.status == 403) {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -218,7 +215,7 @@ class FilesActivities extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
items: [...this.state.items, ...res.data.events],
|
items: [...this.state.items, ...res.data.events],
|
||||||
has_more: res.data.events.length == '0' ? false : true
|
has_more: res.data.events.length < 25 ? false : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -685,6 +685,11 @@ a.op-icon:focus {
|
|||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#notice-popover .sf-popover-hd {
|
||||||
|
border-bottom: 1px solid #dfdfe1;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**** sf-popover ****/ /* e.g. top notice popup, group members popup */
|
/**** sf-popover ****/ /* e.g. top notice popup, group members popup */
|
||||||
.sf-popover-container {
|
.sf-popover-container {
|
||||||
|
Reference in New Issue
Block a user