diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 9857a69559..c42ee0a578 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -28,7 +28,8 @@ import { Organizations, Person, Persons, - Status + Status, + ContactsTab } from '@hcengineering/contact' import { Class, DateRangeMode, Domain, DOMAIN_MODEL, IndexKind, Ref, Timestamp } from '@hcengineering/core' import { @@ -53,6 +54,7 @@ import view, { createAction, ViewAction, Viewlet } from '@hcengineering/model-vi import workbench from '@hcengineering/model-workbench' import type { Asset, IntlString, Resource } from '@hcengineering/platform' import setting from '@hcengineering/setting' +import { AnyComponent } from '@hcengineering/ui' import contact from './plugin' export const DOMAIN_CONTACT = 'contact' as Domain @@ -169,6 +171,13 @@ export class TOrganizations extends TSpace implements Organizations {} @UX(contact.string.PersonsFolder, contact.icon.Person) export class TPersons extends TSpace implements Persons {} +@Model(contact.class.ContactsTab, core.class.Doc, DOMAIN_MODEL) +export class TContactsTab extends TDoc implements ContactsTab { + label!: IntlString + component!: AnyComponent + index!: number +} + export function createModel (builder: Builder): void { builder.createModel( TAvatarProvider, @@ -182,7 +191,8 @@ export function createModel (builder: Builder): void { TEmployeeAccount, TChannel, TStatus, - TMember + TMember, + TContactsTab ) builder.mixin(contact.class.Employee, core.class.Class, view.mixin.ObjectFactory, { @@ -205,11 +215,17 @@ export function createModel (builder: Builder): void { icon: contact.icon.ContactApplication, alias: contactId, hidden: false, - component: contact.component.Contacts + component: contact.component.ContactsTabs }, contact.app.Contacts ) + builder.createDoc(contact.class.ContactsTab, core.space.Model, { + component: contact.component.Contacts, + label: contact.string.Contacts, + index: 100 + }) + builder.createDoc( view.class.Viewlet, core.space.Model, diff --git a/models/contact/src/plugin.ts b/models/contact/src/plugin.ts index 983bb2bd0c..bd8cbafdc7 100644 --- a/models/contact/src/plugin.ts +++ b/models/contact/src/plugin.ts @@ -33,6 +33,7 @@ export default mergeIds(contactId, contact, { CreateOrganizations: '' as AnyComponent, OrganizationPresenter: '' as AnyComponent, Contacts: '' as AnyComponent, + ContactsTabs: '' as AnyComponent, EmployeeAccountPresenter: '' as AnyComponent, OrganizationEditor: '' as AnyComponent, EmployeePresenter: '' as AnyComponent, diff --git a/plugins/contact-resources/src/components/ContactsTabs.svelte b/plugins/contact-resources/src/components/ContactsTabs.svelte new file mode 100644 index 0000000000..a7a42594e2 --- /dev/null +++ b/plugins/contact-resources/src/components/ContactsTabs.svelte @@ -0,0 +1,41 @@ + + + +{#if tabs && tabs.length > 1} +
+ +
+{:else if tabs?.[0]} + +{/if} diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts index 9bab9c9141..f1157c6ed8 100644 --- a/plugins/contact-resources/src/index.ts +++ b/plugins/contact-resources/src/index.ts @@ -27,6 +27,7 @@ import ChannelsPresenter from './components/ChannelsPresenter.svelte' import ChannelsView from './components/ChannelsView.svelte' import ContactPresenter from './components/ContactPresenter.svelte' import Contacts from './components/Contacts.svelte' +import ContactsTabs from './components/ContactsTabs.svelte' import CreateEmployee from './components/CreateEmployee.svelte' import CreateOrganization from './components/CreateOrganization.svelte' import CreateOrganizations from './components/CreateOrganizations.svelte' @@ -156,6 +157,7 @@ export default async (): Promise => ({ CreateOrganizations, SocialEditor, Contacts, + ContactsTabs, EmployeeAccountPresenter, EmployeePresenter, EmployeeRefPresenter, diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts index b1b49b6673..c9563767c8 100644 --- a/plugins/contact/src/index.ts +++ b/plugins/contact/src/index.ts @@ -152,6 +152,15 @@ export interface EmployeeAccount extends Account { name: string } +/** + * @public + */ +export interface ContactsTab extends Doc { + label: IntlString + component: AnyComponent + index: number +} + const SEP = ',' /** @@ -203,7 +212,8 @@ const contactPlugin = plugin(contactId, { Organizations: '' as Ref>, Employee: '' as Ref>, EmployeeAccount: '' as Ref>, - Status: '' as Ref> + Status: '' as Ref>, + ContactsTab: '' as Ref> }, component: { SocialEditor: '' as AnyComponent,