Merge branch 'dev' into staging
This commit is contained in:
commit
45803b9f4a
@ -38,6 +38,7 @@ class ToastElementClass extends React.Component<IPropsClass, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override render(): JSX.Element {
|
public override render(): JSX.Element {
|
||||||
|
console.log(this.props);
|
||||||
const toast = this.props.toast;
|
const toast = this.props.toast;
|
||||||
const style = {
|
const style = {
|
||||||
"--data-duration": `${toast.time}ms`,
|
"--data-duration": `${toast.time}ms`,
|
||||||
@ -98,7 +99,8 @@ class ToastElementClass extends React.Component<IPropsClass, IState> {
|
|||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private close() {
|
private async close() {
|
||||||
|
await Toasts.getInstance().markRead(this.props.toast);
|
||||||
window.clearTimeout(this.closeTimeout);
|
window.clearTimeout(this.closeTimeout);
|
||||||
this.setState({
|
this.setState({
|
||||||
willClose: true,
|
willClose: true,
|
||||||
@ -110,7 +112,7 @@ class ToastElementClass extends React.Component<IPropsClass, IState> {
|
|||||||
|
|
||||||
private async handleClick(e: React.MouseEvent) {
|
private async handleClick(e: React.MouseEvent) {
|
||||||
if (this.props.toast.redirectUrl) {
|
if (this.props.toast.redirectUrl) {
|
||||||
this.onClose(e);
|
await this.onClose(e);
|
||||||
await this.props.router.push(this.props.toast.redirectUrl);
|
await this.props.router.push(this.props.toast.redirectUrl);
|
||||||
this.props.router.reload();
|
this.props.router.reload();
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.loader {
|
.loader {
|
||||||
width: 40px;
|
width: 21px;
|
||||||
height: 40px;
|
height: 21px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-width: 530px;
|
max-width: 530px;
|
||||||
margin: auto;
|
margin: 220px auto;
|
||||||
margin-top: 220px;
|
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -85,15 +85,18 @@ export default class Toasts {
|
|||||||
return () => this.close(toast);
|
return () => this.close(toast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public markRead(toast: IToast) {
|
||||||
|
if (!toast.uid) return;
|
||||||
|
Notifications.getInstance().put(toast.uid, {
|
||||||
|
read: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public close(toast: IToast) {
|
public close(toast: IToast) {
|
||||||
const index = this.toastList.indexOf(toast);
|
const index = this.toastList.indexOf(toast);
|
||||||
if (index === -1) return;
|
if (index === -1) return;
|
||||||
this.toastList.splice(index, 1);
|
this.toastList.splice(index, 1);
|
||||||
|
|
||||||
if (toast.uid)
|
|
||||||
Notifications.getInstance().put(toast.uid, {
|
|
||||||
read: true,
|
|
||||||
});
|
|
||||||
this.event.emit("change", this.toastList);
|
this.event.emit("change", this.toastList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user