feat(editor): Add lead enrichment suggestions to workflow list (#8042)

## Summary
We want to show lead enrichment template suggestions to cloud users that
agreed to this. This PR introduces the front-end part of this feature
- Handoff document
- Figma Hi-fi
- [How to
test](https://linear.app/n8n/issue/ADO-1549/[n8n-fe]-update-workflows-list-page-to-show-fake-door-templates#comment-b6644c99)

Tests are being worked on in a separate PR

## Related tickets and issues
Fixes ADO-1546
Fixes ADO-1549
Fixes ADO-1604

## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.

---------

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Milorad FIlipović
2023-12-19 15:10:03 +01:00
committed by GitHub
parent c170dd1da3
commit 36a923cf7b
26 changed files with 1387 additions and 87 deletions

View File

@@ -3,8 +3,10 @@ import type { NotificationInstance, NotificationOptions, MessageBoxState } from
import { sanitizeHtml } from '@/utils/htmlUtils';
import { useTelemetry } from '@/composables/useTelemetry';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useUIStore } from '@/stores/ui.store';
import { useI18n } from './useI18n';
import { useExternalHooks } from './useExternalHooks';
import { VIEWS } from '@/constants';
const messageDefaults: Partial<Omit<NotificationOptions, 'message'>> = {
dangerouslyUseHTMLString: true,
@@ -16,6 +18,7 @@ const stickyNotificationQueue: NotificationInstance[] = [];
export function useToast() {
const telemetry = useTelemetry();
const workflowsStore = useWorkflowsStore();
const uiStore = useUIStore();
const externalHooks = useExternalHooks();
const i18n = useI18n();
@@ -155,11 +158,30 @@ export function useToast() {
stickyNotificationQueue.length = 0;
}
// Pick up and display notifications for the given list of views
function showNotificationForViews(views: VIEWS[]) {
const notifications: NotificationOptions[] = [];
views.forEach((view) => {
notifications.push(...uiStore.getNotificationsForView(view));
});
if (notifications.length) {
notifications.forEach(async (notification) => {
// Notifications show on top of each other without this timeout
setTimeout(() => {
showMessage(notification);
}, 5);
});
// Clear the queue once all notifications are shown
uiStore.setNotificationsForView(VIEWS.WORKFLOW, []);
}
}
return {
showMessage,
showToast,
showError,
showAlert,
clearAllStickyNotifications,
showNotificationForViews,
};
}