diff --git a/models/telegram/src/index.ts b/models/telegram/src/index.ts index 0c7d5cddd7..18681b5bc5 100644 --- a/models/telegram/src/index.ts +++ b/models/telegram/src/index.ts @@ -16,7 +16,7 @@ import type { IntlString } from '@anticrm/platform' import { Builder, Model, TypeString, TypeBoolean, Prop, ArrOf } from '@anticrm/model' -import core, { TAttachedDoc, TDoc } from '@anticrm/model-core' +import core, { TAttachedDoc } from '@anticrm/model-core' import contact from '@anticrm/model-contact' import telegram from './plugin' import type { TelegramMessage, SharedTelegramMessage, SharedTelegramMessages } from '@anticrm/telegram' @@ -30,17 +30,11 @@ function TypeSharedMessage (): Type { return { _class: telegram.class.SharedMessage, label: 'Shared message' as IntlString } } -@Model(telegram.class.Message, core.class.Doc, DOMAIN_TELEGRAM) -export class TTelegramMessage extends TDoc implements TelegramMessage { +@Model(telegram.class.Message, core.class.AttachedDoc, DOMAIN_TELEGRAM) +export class TTelegramMessage extends TAttachedDoc implements TelegramMessage { @Prop(TypeString(), 'Content' as IntlString) content!: string - @Prop(TypeString(), 'Phone' as IntlString) - contactPhone!: string - - @Prop(TypeString(), 'User name' as IntlString) - contactUserName!: string - @Prop(TypeBoolean(), 'Incoming' as IntlString) incoming!: boolean } diff --git a/plugins/telegram-assets/lang/en.json b/plugins/telegram-assets/lang/en.json index a8dafa3b0c..7cfa48c7e5 100644 --- a/plugins/telegram-assets/lang/en.json +++ b/plugins/telegram-assets/lang/en.json @@ -1,5 +1,19 @@ { "string": { - "SharedMessages": "shared Telegram messages" + "SharedMessages": "shared Telegram messages", + "Next": "Next", + "Back": "Back", + "Connect": "Connect", + "Connecting": "Connecting...", + "ConnectFull": "Connect Telegram account", + "Password": "Password", + "Phone": "Phone", + "PhonePlaceholder": "+1 555 333 7777", + "PhoneDescr": "Enter your Telegram phone number to connect your account.", + "PasswordDescr": "Enter your second factor password", + "CodeDescr": "Enter the 5-digit code you received on your Telegram account.", + "Cancel": "Cancel", + "Share": "Share messages", + "PublishSelected": "Publish selected" } } \ No newline at end of file diff --git a/plugins/telegram-resources/src/components/Chat.svelte b/plugins/telegram-resources/src/components/Chat.svelte index a0bf76c271..f7900ca356 100644 --- a/plugins/telegram-resources/src/components/Chat.svelte +++ b/plugins/telegram-resources/src/components/Chat.svelte @@ -14,45 +14,48 @@ // limitations under the License. -->
diff --git a/plugins/telegram-resources/src/components/Message.svelte b/plugins/telegram-resources/src/components/Message.svelte index 3f0a3a6e10..fe20371f70 100644 --- a/plugins/telegram-resources/src/components/Message.svelte +++ b/plugins/telegram-resources/src/components/Message.svelte @@ -19,39 +19,13 @@ import { formatName } from '@anticrm/contact' import { CheckBox } from '@anticrm/ui' import { createEventDispatcher } from 'svelte' + import { getPlatformColorForText } from '@anticrm/ui' export let message: SharedTelegramMessage export let showName: boolean = false export let selected: boolean = false export let selectable: boolean = false - export let colors: string[] = [ - '#A5D179', - '#77C07B', - '#60B96E', - '#45AEA3', - '#46CBDE', - '#47BDF6', - '#5AADF6', - '#73A6CD', - '#B977CB', - '#7C6FCD', - '#6F7BC5', - '#F28469' - ] - - function getNameColor (name: string): string { - let hash = 0 - let i - let chr - for (i = 0; i < name.length; i++) { - chr = name.charCodeAt(i) - hash = (hash << 5) - hash + chr - hash |= 0 - } - return colors[Math.abs(hash) % colors.length] - } - const dispatch = createEventDispatcher() @@ -65,7 +39,7 @@
{#if showName} -
{formatName(message.sender)}
+
{formatName(message.sender)}
{/if}
@@ -87,6 +61,7 @@ width: fit-content; background-color: var(--theme-incoming-msg); border-radius: 0.75rem; + overflow-wrap: anywhere; &.outcoming { background-color: var(--theme-outcoming-msg); diff --git a/plugins/telegram-resources/src/plugin.ts b/plugins/telegram-resources/src/plugin.ts index 403d932e41..9f5ae5a760 100644 --- a/plugins/telegram-resources/src/plugin.ts +++ b/plugins/telegram-resources/src/plugin.ts @@ -14,8 +14,25 @@ // limitations under the License. // -import { mergeIds } from '@anticrm/platform' +import { IntlString, mergeIds } from '@anticrm/platform' import telegram, { telegramId } from '@anticrm/telegram' -export default mergeIds(telegramId, telegram, {}) +export default mergeIds(telegramId, telegram, { + string: { + Next: '' as IntlString, + Back: '' as IntlString, + Connect: '' as IntlString, + Connecting: '' as IntlString, + ConnectFull: '' as IntlString, + Password: '' as IntlString, + Phone: '' as IntlString, + PhonePlaceholder: '' as IntlString, + PhoneDescr: '' as IntlString, + PasswordDescr: '' as IntlString, + CodeDescr: '' as IntlString, + Cancel: '' as IntlString, + Share: '' as IntlString, + PublishSelected: '' as IntlString + } +}) diff --git a/plugins/telegram/src/index.ts b/plugins/telegram/src/index.ts index cbfcbcaf19..2b0303d336 100644 --- a/plugins/telegram/src/index.ts +++ b/plugins/telegram/src/index.ts @@ -22,11 +22,9 @@ import type { IntegrationType, Handler } from '@anticrm/setting' /** * @public */ -export interface TelegramMessage extends Doc { +export interface TelegramMessage extends AttachedDoc { content: string incoming: boolean - contactPhone?: string - contactUserName?: string } /**