Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add an icon for any toast, so you can pass any iocn to the toast but it's not mandatory

Behrokh Satarnejad94410462098f
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index b3864e6c284..45d38f3d538 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -693,7 +693,7 @@ en:
no_selection: "Click on a notification to view all activity details."
new_notifications:
message: "There are new notifications."
- link_text: "Click here to load them"
+ link_text: "Click here to load them."
menu:
accountable: "Accountable"
by_project: "Unread by project"
diff --git a/frontend/src/app/shared/components/toaster/toast.component.html b/frontend/src/app/shared/components/toaster/toast.component.html
index cc7944b1a47..ff64413aeed 100644
--- a/frontend/src/app/shared/components/toaster/toast.component.html
+++ b/frontend/src/app/shared/components/toaster/toast.component.html
@@ -1,4 +1,4 @@
-<div class="op-toast -{{ type }}" tabindex="0">
+<div class="op-toast -{{ type }} {{ icon }}" tabindex="0">
<div class="op-toast--content" role="alert" aria-atomic="true">
<ng-container *ngIf="type === 'loading'">
<p [textContent]="toast.message"></p>
diff --git a/frontend/src/app/shared/components/toaster/toast.component.ts b/frontend/src/app/shared/components/toaster/toast.component.ts
index 52bfe417a71..1f8276795ac 100644
--- a/frontend/src/app/shared/components/toaster/toast.component.ts
+++ b/frontend/src/app/shared/components/toaster/toast.component.ts
@@ -59,6 +59,8 @@ export class ToastComponent implements OnInit {
public type:ToastType;
+ public icon?:string;
+
public uploadCount = 0;
public show = false;
@@ -77,6 +79,7 @@ export class ToastComponent implements OnInit {
ngOnInit():void {
this.type = this.toast.type;
+ this.icon = this.toast.icon ? `toast-icon icon-${this.toast.icon}` : '';
this.removable = !['upload', 'loading'].includes(this.type);
diff --git a/frontend/src/app/shared/components/toaster/toast.service.ts b/frontend/src/app/shared/components/toaster/toast.service.ts
index 26e50bfa5f5..1f233c7280a 100644
--- a/frontend/src/app/shared/components/toaster/toast.service.ts
+++ b/frontend/src/app/shared/components/toaster/toast.service.ts
@@ -46,6 +46,7 @@ export const OPToastEvent = 'op:toasters:add';
export interface IToast {
message:string;
+ icon?:string;
link?:{ text:string, target:() => void };
type:ToastType;
data?:unknown;
@@ -183,6 +184,7 @@ export class ToastService {
message: toast.message,
type,
link: toast.link,
+ icon: toast.icon,
data: toast.data,
};
}