From c9761b35023331aa0240d36a92ba3bee13a03166 Mon Sep 17 00:00:00 2001 From: Eduard Aksamitov Date: Mon, 18 Mar 2024 17:58:00 +0300 Subject: [PATCH] feat(planner): new layout for attached todos (#4995) Signed-off-by: Eduard Aksamitov --- models/time/package.json | 1 + models/time/src/index.ts | 5 + models/time/src/plugin.ts | 1 + packages/theme/styles/_lumia-colors.scss | 2 + packages/theme/styles/components.scss | 10 ++ .../src/components/EditDoc.svelte | 12 +- plugins/time-resources/package.json | 1 + .../src/components/ToDoElement.svelte | 66 ++----- ...ty.svelte => ToDoPriorityPresenter.svelte} | 0 .../src/components/ToDoReference.svelte | 37 ++++ .../src/components/WorkItemPresenter.svelte | 44 +++-- .../presenters/DocumentPresenter.svelte | 41 +++++ .../presenters/IssuePresenter.svelte | 168 ++---------------- plugins/time-resources/src/index.ts | 4 +- server-plugins/time-resources/src/index.ts | 4 +- .../model/documents/document-content-page.ts | 2 +- 16 files changed, 171 insertions(+), 227 deletions(-) rename plugins/time-resources/src/components/{ToDoPriority.svelte => ToDoPriorityPresenter.svelte} (100%) create mode 100644 plugins/time-resources/src/components/ToDoReference.svelte create mode 100644 plugins/time-resources/src/components/presenters/DocumentPresenter.svelte diff --git a/models/time/package.json b/models/time/package.json index 2de02e0ed4..13f5b05b1c 100644 --- a/models/time/package.json +++ b/models/time/package.json @@ -41,6 +41,7 @@ "@hcengineering/recruit": "^0.6.21", "@hcengineering/board": "^0.6.12", "@hcengineering/calendar": "^0.6.17", + "@hcengineering/model-document": "^0.6.0", "@hcengineering/model-workbench": "^0.6.1", "@hcengineering/model-core": "^0.6.0", "@hcengineering/model-view": "^0.6.0", diff --git a/models/time/src/index.ts b/models/time/src/index.ts index ac3620c311..4bf2aedb54 100644 --- a/models/time/src/index.ts +++ b/models/time/src/index.ts @@ -33,6 +33,7 @@ import { Collection, Mixin, Model, Prop, TypeRef, TypeString, UX, type Builder, import { TEvent } from '@hcengineering/model-calendar' import core, { TAttachedDoc, TClass, TDoc, TType } from '@hcengineering/model-core' import tracker from '@hcengineering/model-tracker' +import document from '@hcengineering/model-document' import view, { createAction } from '@hcengineering/model-view' import workbench from '@hcengineering/model-workbench' import notification from '@hcengineering/notification' @@ -138,6 +139,10 @@ export function createModel (builder: Builder): void { presenter: time.component.IssuePresenter }) + builder.mixin(document.class.Document, core.class.Class, time.mixin.ItemPresenter, { + presenter: time.component.DocumentPresenter + }) + builder.mixin(lead.class.Lead, core.class.Class, time.mixin.ItemPresenter, { presenter: time.component.LeadPresenter }) diff --git a/models/time/src/plugin.ts b/models/time/src/plugin.ts index 951d92a1f7..29ba775781 100644 --- a/models/time/src/plugin.ts +++ b/models/time/src/plugin.ts @@ -44,6 +44,7 @@ export default mergeIds(timeId, time, { }, component: { IssuePresenter: '' as AnyComponent, + DocumentPresenter: '' as AnyComponent, ApplicantPresenter: '' as AnyComponent, CardPresenter: '' as AnyComponent, LeadPresenter: '' as AnyComponent, diff --git a/packages/theme/styles/_lumia-colors.scss b/packages/theme/styles/_lumia-colors.scss index d913c95d09..89b5d18c54 100644 --- a/packages/theme/styles/_lumia-colors.scss +++ b/packages/theme/styles/_lumia-colors.scss @@ -70,6 +70,7 @@ --tag-on-subtle-PorpoiseText: #F2F4F6; --tag-subtle-PorpoiseBackground: #343F49; + --tag-nuance-SkyBackground: #1F2737; --icon-disabled-IconColor: #394358; @@ -144,6 +145,7 @@ --tag-on-subtle-PorpoiseText: #293139; --tag-subtle-PorpoiseBackground: #C8D1D9; + --tag-nuance-SkyBackground: #EEF4FD; --icon-disabled-IconColor: #B3BCCC; diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 21055c9431..6ed7645f26 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -618,6 +618,16 @@ height: var(--global-extra-small-Size); } } + .hulyToDoLine-reference { + padding: 0 var(--spacing-1) 0 var(--spacing-0_75); + box-shadow: inset 0 0 0 1px var(--global-subtle-ui-BorderColor); + border-radius: var(--extra-small-BorderRadius); + background-color: var(--tag-nuance-SkyBackground); + + &:hover { + box-shadow: inset 0 0 0 1px var(--global-ui-BorderColor); + } + } &.hovered, &:hover { diff --git a/plugins/document-resources/src/components/EditDoc.svelte b/plugins/document-resources/src/components/EditDoc.svelte index 7664beb3cb..6a54288ef1 100644 --- a/plugins/document-resources/src/components/EditDoc.svelte +++ b/plugins/document-resources/src/components/EditDoc.svelte @@ -62,6 +62,7 @@ export let _id: Ref export let readonly: boolean = false export let embedded: boolean = false + export let kind: 'default' | 'modern' = 'default' $: readonly = $restrictionStore.readonly @@ -229,7 +230,7 @@ {#if !$restrictionStore.disableActions} - + + diff --git a/plugins/time-resources/src/components/WorkItemPresenter.svelte b/plugins/time-resources/src/components/WorkItemPresenter.svelte index 4e2d77153d..0a1ebecf4d 100644 --- a/plugins/time-resources/src/components/WorkItemPresenter.svelte +++ b/plugins/time-resources/src/components/WorkItemPresenter.svelte @@ -1,18 +1,29 @@ + @@ -38,15 +48,11 @@ {#if kind === 'default'} -
- +
+
{:else} - + {/if} diff --git a/plugins/time-resources/src/components/presenters/DocumentPresenter.svelte b/plugins/time-resources/src/components/presenters/DocumentPresenter.svelte new file mode 100644 index 0000000000..2f3ee86a28 --- /dev/null +++ b/plugins/time-resources/src/components/presenters/DocumentPresenter.svelte @@ -0,0 +1,41 @@ + + + + + + + + + diff --git a/plugins/time-resources/src/components/presenters/IssuePresenter.svelte b/plugins/time-resources/src/components/presenters/IssuePresenter.svelte index f4e3d73bd0..4076505a64 100644 --- a/plugins/time-resources/src/components/presenters/IssuePresenter.svelte +++ b/plugins/time-resources/src/components/presenters/IssuePresenter.svelte @@ -1,162 +1,20 @@ -{#if kind === 'todo-line'} - -{:else if kind === 'todo-line-large'} - -{:else if shouldShowAvatar} -
-
- {#if !withoutSpace} -
-
- {/if} -
- {#if st} - - -
- -
- {/if} - {value.title} -
-
-
- -
-
-{:else} - {#if !withoutSpace} -
-
- {/if} -
- {#if st} - - -
- -
- {/if} - {value.title} -
-{/if} - - + + + + + + diff --git a/plugins/time-resources/src/index.ts b/plugins/time-resources/src/index.ts index 36733e39a4..076dfe8c82 100644 --- a/plugins/time-resources/src/index.ts +++ b/plugins/time-resources/src/index.ts @@ -13,12 +13,13 @@ // limitations under the License. // -import { type Resources } from '@hcengineering/platform' +import type { Resources } from '@hcengineering/platform' import Me from './components/Me.svelte' import Team from './components/team/Team.svelte' import IssuePresenter from './components/presenters/IssuePresenter.svelte' import CardPresenter from './components/presenters/CardPresenter.svelte' import LeadPresenter from './components/presenters/LeadPresenter.svelte' +import DocumentPresenter from './components/presenters/DocumentPresenter.svelte' import ApplicantPresenter from './components/presenters/ApplicantPresenter.svelte' import WorkSlotElement from './components/WorkSlotElement.svelte' import EditWorkSlot from './components/EditWorkSlot.svelte' @@ -37,6 +38,7 @@ export default async (): Promise => ({ IssuePresenter, CardPresenter, LeadPresenter, + DocumentPresenter, ApplicantPresenter, EditWorkSlot, WorkSlotElement, diff --git a/server-plugins/time-resources/src/index.ts b/server-plugins/time-resources/src/index.ts index 6a216a9ca4..7e54b60f28 100644 --- a/server-plugins/time-resources/src/index.ts +++ b/server-plugins/time-resources/src/index.ts @@ -447,10 +447,10 @@ async function getIssueToDoData ( const data: AttachedData = { attachedSpace: issue.space, workslots: 0, - description: issue.title, + description: '', priority: ToDoPriority.NoPriority, visibility: 'public', - title: issue.identifier, + title: issue.title, user: acc.person } return data diff --git a/tests/sanity/tests/model/documents/document-content-page.ts b/tests/sanity/tests/model/documents/document-content-page.ts index 7d918d0374..7d18b62903 100644 --- a/tests/sanity/tests/model/documents/document-content-page.ts +++ b/tests/sanity/tests/model/documents/document-content-page.ts @@ -18,7 +18,7 @@ export class DocumentContentPage extends CommonPage { this.buttonToolbarLink = page.locator('div.text-editor-toolbar button:nth-child(10)') this.inputFormLink = page.locator('form[id="text-editor:string:Link"] input') this.buttonFormLinkSave = page.locator('form[id="text-editor:string:Link"] button[type="submit"]') - this.buttonMoreActions = page.locator('div.popupPanel-title button:first-child') + this.buttonMoreActions = page.locator('div.popupPanel-title button#btn-doc-title-open-more') } async checkDocumentTitle (title: string): Promise {