From 90b4ac39fbf1d933e686fcaf80a20b48dce3d19d Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Thu, 2 Feb 2023 18:07:44 +0600 Subject: [PATCH] Send emails to many receivers (#2579) Signed-off-by: Denis Bykhov --- models/gmail/package.json | 2 + models/gmail/src/index.ts | 25 ++ models/gmail/src/plugin.ts | 4 + plugins/gmail-assets/lang/en.json | 3 +- plugins/gmail-assets/lang/ru.json | 3 +- .../src/components/NewMessages.svelte | 322 ++++++++++++++++++ plugins/gmail-resources/src/index.ts | 4 +- plugins/gmail-resources/src/plugin.ts | 3 +- plugins/gmail/src/index.ts | 3 +- 9 files changed, 364 insertions(+), 5 deletions(-) create mode 100644 plugins/gmail-resources/src/components/NewMessages.svelte diff --git a/models/gmail/package.json b/models/gmail/package.json index 2aba64d304..51ad31a4b5 100644 --- a/models/gmail/package.json +++ b/models/gmail/package.json @@ -35,6 +35,8 @@ "@hcengineering/gmail": "^0.6.0", "@hcengineering/gmail-resources": "^0.6.0", "@hcengineering/model-attachment": "^0.6.0", + "@hcengineering/model-view": "^0.6.0", + "@hcengineering/view": "^0.6.2", "@hcengineering/setting": "^0.6.2", "@hcengineering/ui": "^0.6.3" } diff --git a/models/gmail/src/index.ts b/models/gmail/src/index.ts index 63a23ed70b..0b1d9312ab 100644 --- a/models/gmail/src/index.ts +++ b/models/gmail/src/index.ts @@ -33,6 +33,7 @@ import contact from '@hcengineering/model-contact' import core, { TAttachedDoc, TDoc } from '@hcengineering/model-core' import setting from '@hcengineering/setting' import gmail from './plugin' +import view, { createAction } from '@hcengineering/model-view' export const DOMAIN_GMAIL = 'gmail' as Domain @@ -163,6 +164,30 @@ export function createModel (builder: Builder): void { }, gmail.ids.TxSharedCreate ) + + createAction( + builder, + { + action: view.actionImpl.ShowPopup, + actionProps: { + component: gmail.component.NewMessages, + element: 'float', + fillProps: { + _objects: 'value' + } + }, + label: gmail.string.WrtieEmail, + icon: contact.icon.Email, + keyBinding: [], + input: 'none', + category: contact.category.Contact, + target: contact.class.Contact, + context: { + mode: ['context', 'browser'] + } + }, + gmail.action.WriteEmail + ) } export { gmailOperation } from './migration' diff --git a/models/gmail/src/plugin.ts b/models/gmail/src/plugin.ts index e87aec7a42..d34a0a116b 100644 --- a/models/gmail/src/plugin.ts +++ b/models/gmail/src/plugin.ts @@ -20,8 +20,12 @@ import { gmailId } from '@hcengineering/gmail' import gmail from '@hcengineering/gmail-resources/src/plugin' import type { AnyComponent } from '@hcengineering/ui' import type { TxViewlet } from '@hcengineering/activity' +import { Action } from '@hcengineering/view' export default mergeIds(gmailId, gmail, { + action: { + WriteEmail: '' as Ref + }, string: { MessageID: '' as IntlString, IntegrationLabel: '' as IntlString, diff --git a/plugins/gmail-assets/lang/en.json b/plugins/gmail-assets/lang/en.json index a0cfee08a6..80f2c4bf06 100644 --- a/plugins/gmail-assets/lang/en.json +++ b/plugins/gmail-assets/lang/en.json @@ -29,6 +29,7 @@ "Incoming": "Incoming", "Email": "Email", "Status": "Status", - "EmailPlaceholder": "john.appleseed@apple.com" + "EmailPlaceholder": "john.appleseed@apple.com", + "WrtieEmail": "Wrtie Email" } } \ No newline at end of file diff --git a/plugins/gmail-assets/lang/ru.json b/plugins/gmail-assets/lang/ru.json index b1e344f018..474bec9c92 100644 --- a/plugins/gmail-assets/lang/ru.json +++ b/plugins/gmail-assets/lang/ru.json @@ -29,6 +29,7 @@ "Incoming": "Входящие", "Email": "Email", "Status": "Статус", - "EmailPlaceholder": "john.appleseed@apple.com" + "EmailPlaceholder": "john.appleseed@apple.com", + "WrtieEmail": "Написать Email" } } \ No newline at end of file diff --git a/plugins/gmail-resources/src/components/NewMessages.svelte b/plugins/gmail-resources/src/components/NewMessages.svelte new file mode 100644 index 0000000000..4dbac1f9f5 --- /dev/null +++ b/plugins/gmail-resources/src/components/NewMessages.svelte @@ -0,0 +1,322 @@ + + + + { + if (!saved) { + attachments.map((p) => removeAttachment(p)) + } + dispatch('close') + }} +> + +
+
+
+ Email +
+
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
{}} + on:dragleave={() => {}} + on:drop|preventDefault|stopPropagation={fileDrop} + > +
+ +
+
+ +
+ {#if attachments.length} +
+ {#each attachments as attachment} +
+ { + if (result !== undefined) removeAttachment(attachment) + }} + /> +
+ {/each} +
+ {/if} +
+ +
+
+
+
+ + diff --git a/plugins/gmail-resources/src/index.ts b/plugins/gmail-resources/src/index.ts index eb340b5a73..f525c11a84 100644 --- a/plugins/gmail-resources/src/index.ts +++ b/plugins/gmail-resources/src/index.ts @@ -21,12 +21,14 @@ import Connect from './components/Connect.svelte' import IconGmail from './components/icons/GmailColor.svelte' import TxSharedCreate from './components/activity/TxSharedCreate.svelte' import { concatLink } from '@hcengineering/core' +import NewMessages from './components/NewMessages.svelte' export default async (): Promise => ({ component: { Main, Connect, - IconGmail + IconGmail, + NewMessages }, activity: { TxSharedCreate diff --git a/plugins/gmail-resources/src/plugin.ts b/plugins/gmail-resources/src/plugin.ts index 3e8053248e..cf101a3ba9 100644 --- a/plugins/gmail-resources/src/plugin.ts +++ b/plugins/gmail-resources/src/plugin.ts @@ -38,6 +38,7 @@ export default mergeIds(gmailId, gmail, { NewMessageTo: '' as IntlString, Cancel: '' as IntlString, SubjectPlaceholder: '' as IntlString, - CopyPlaceholder: '' as IntlString + CopyPlaceholder: '' as IntlString, + WrtieEmail: '' as IntlString } }) diff --git a/plugins/gmail/src/index.ts b/plugins/gmail/src/index.ts index f4b78fb39b..d7c9ebb313 100644 --- a/plugins/gmail/src/index.ts +++ b/plugins/gmail/src/index.ts @@ -84,7 +84,8 @@ export default plugin(gmailId, { component: { Main: '' as AnyComponent, Connect: '' as AnyComponent, - IconGmail: '' as AnyComponent + IconGmail: '' as AnyComponent, + NewMessages: '' as AnyComponent }, integrationType: { Gmail: '' as Ref