From 17ef11daf6648687aa638e39d16f81e7ef0737ed Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Tue, 12 Apr 2022 21:33:38 +0600 Subject: [PATCH 01/11] Space view select viewlet with custom header (#1378) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- .../src/components/SpaceView.svelte | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/plugins/workbench-resources/src/components/SpaceView.svelte b/plugins/workbench-resources/src/components/SpaceView.svelte index 86757e9966..18e44d2c60 100644 --- a/plugins/workbench-resources/src/components/SpaceView.svelte +++ b/plugins/workbench-resources/src/components/SpaceView.svelte @@ -16,11 +16,10 @@ {#if _class && space} - {#await getHeader(space._class) then header} - {#if header} - - {:else} - - {/if} - {/await} + {#if header} + + {:else} + + {/if} {/if} From 24c547ab3927e7674441817077fb6b28e7b8c3f7 Mon Sep 17 00:00:00 2001 From: Denis Bunakalya Date: Tue, 12 Apr 2022 18:45:06 +0300 Subject: [PATCH 02/11] Chunter: Delete message (#1336) Signed-off-by: Denis Bunakalya --- plugins/chunter-assets/lang/en.json | 3 +- plugins/chunter-assets/lang/ru.json | 3 +- .../src/components/Message.svelte | 24 ++++++++-- .../src/components/ThreadComment.svelte | 10 +++- plugins/chunter-resources/src/plugin.ts | 3 +- server-plugins/chunter-resources/src/index.ts | 47 +++++++++++++++++-- 6 files changed, 77 insertions(+), 13 deletions(-) diff --git a/plugins/chunter-assets/lang/en.json b/plugins/chunter-assets/lang/en.json index c1f6497a98..725ebbbc8b 100644 --- a/plugins/chunter-assets/lang/en.json +++ b/plugins/chunter-assets/lang/en.json @@ -30,6 +30,7 @@ "New": "New", "MarkUnread": "Mark unread", "GetNewReplies": "Get notified about new replies", - "TurnOffReplies": "Turn off notifications for replies" + "TurnOffReplies": "Turn off notifications for replies", + "DeleteMessage": "Delete message" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/ru.json b/plugins/chunter-assets/lang/ru.json index 130b6eb1b8..eccff39861 100644 --- a/plugins/chunter-assets/lang/ru.json +++ b/plugins/chunter-assets/lang/ru.json @@ -29,6 +29,7 @@ "New": "Новое", "MarkUnread": "Отметить как непрочитанное", "GetNewReplies": "Получать уведомления о новых ответах", - "TurnOffReplies": "Выключить уведомления об ответах" + "TurnOffReplies": "Выключить уведомления об ответах", + "DeleteMessage": "Удалить сообщение" } } \ No newline at end of file diff --git a/plugins/chunter-resources/src/components/Message.svelte b/plugins/chunter-resources/src/components/Message.svelte index 3bd4ef242a..9f13f9871f 100644 --- a/plugins/chunter-resources/src/components/Message.svelte +++ b/plugins/chunter-resources/src/components/Message.svelte @@ -17,11 +17,11 @@ import { AttachmentList } from '@anticrm/attachment-resources' import type { Message } from '@anticrm/chunter' import { Employee, EmployeeAccount, formatName } from '@anticrm/contact' - import { Ref, WithLookup } from '@anticrm/core' + import { Ref, WithLookup, getCurrentAccount } from '@anticrm/core' import { NotificationClientImpl } from '@anticrm/notification-resources' import { getResource } from '@anticrm/platform' import { Avatar, getClient, MessageViewer } from '@anticrm/presentation' - import { ActionIcon, IconMoreH, Menu, showPopup } from '@anticrm/ui' + import { ActionIcon, IconMoreH, Menu, showPopup, getCurrentLocation, navigate } from '@anticrm/ui' import { Action } from '@anticrm/view' import { getActions } from '@anticrm/view-resources' import { createEventDispatcher } from 'svelte' @@ -59,6 +59,21 @@ action: chunter.actionImpl.SubscribeMessage } as Action) + async function deleteMessage () { + await client.remove(message) + const loc = getCurrentLocation() + + if (loc.path[3] === message._id) { + loc.path.length = 3 + navigate(loc) + } + } + + const deleteAction = { + label: chunter.string.DeleteMessage, + action: deleteMessage + } + const showMenu = async (ev: Event): Promise => { const actions = await getActions(client, message, chunter.class.Message) actions.push(subscribeAction) @@ -73,7 +88,8 @@ const impl = await getResource(a.action) await impl(message) } - })) + })), + ...(getCurrentAccount()._id === message.createBy ? [deleteAction] : []) ] }, ev.target as HTMLElement @@ -108,7 +124,7 @@ {#if !thread}
- {#if message.replies} await client.removeDoc(message._class, message.space, message._id) + } + const showMenu = async (ev: Event): Promise => { const actions = await getActions(client, message, chunter.class.ThreadMessage) actions.push(subscribeAction) @@ -67,7 +72,8 @@ const impl = await getResource(a.action) await impl(message) } - })) + })), + ...(getCurrentAccount()._id === message.createBy ? [deleteAction] : []) ] }, ev.target as HTMLElement diff --git a/plugins/chunter-resources/src/plugin.ts b/plugins/chunter-resources/src/plugin.ts index e08dbcf25e..cba353810e 100644 --- a/plugins/chunter-resources/src/plugin.ts +++ b/plugins/chunter-resources/src/plugin.ts @@ -50,6 +50,7 @@ export default mergeIds(chunterId, chunter, { LastReply: '' as IntlString, New: '' as IntlString, GetNewReplies: '' as IntlString, - TurnOffReplies: '' as IntlString + TurnOffReplies: '' as IntlString, + DeleteMessage: '' as IntlString } }) diff --git a/server-plugins/chunter-resources/src/index.ts b/server-plugins/chunter-resources/src/index.ts index 1784ccf069..fbc79374e6 100644 --- a/server-plugins/chunter-resources/src/index.ts +++ b/server-plugins/chunter-resources/src/index.ts @@ -13,9 +13,9 @@ // limitations under the License. // -import chunter, { Channel, Comment, Message } from '@anticrm/chunter' +import chunter, { Channel, Comment, Message, ThreadMessage } from '@anticrm/chunter' import { EmployeeAccount } from '@anticrm/contact' -import core, { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref, Tx, TxCreateDoc, TxProcessor, TxUpdateDoc } from '@anticrm/core' +import core, { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref, Tx, TxCreateDoc, TxProcessor, TxUpdateDoc, TxRemoveDoc } from '@anticrm/core' import login from '@anticrm/login' import { getMetadata } from '@anticrm/platform' import { TriggerControl } from '@anticrm/server-core' @@ -58,7 +58,7 @@ export async function CommentCreate (tx: Tx, control: TriggerControl): Promise) - if (!hierarchy.isDerived(doc._class, chunter.class.Comment)) { + if (!hierarchy.isDerived(doc._class, chunter.class.ThreadMessage)) { return [] } @@ -80,6 +80,44 @@ export async function CommentCreate (tx: Tx, control: TriggerControl): Promise { + const hierarchy = control.hierarchy + if (tx._class !== core.class.TxRemoveDoc) return [] + + const rmTx = tx as TxRemoveDoc + if (!hierarchy.isDerived(rmTx.objectClass, chunter.class.ThreadMessage)) { + return [] + } + const createTx = (await control.findAll(core.class.TxCreateDoc, { + objectId: rmTx.objectId + }, { limit: 1 }))[0] + + const comment = TxProcessor.createDoc2Doc(createTx as TxCreateDoc) + + const comments = await control.findAll(chunter.class.ThreadMessage, { + attachedTo: comment.attachedTo + }) + const updateTx = control.txFactory.createTxUpdateDoc( + chunter.class.Message, + comment.space, + comment.attachedTo, + { + replies: + comments + .map(comm => (control.modelDb.getObject(comm.createBy) as EmployeeAccount).employee), + lastReply: + comments.length > 0 + ? Math.max(...comments.map(comm => comm.createOn)) + : undefined + } + ) + + return [updateTx] +} + /** * @public */ @@ -112,7 +150,8 @@ export async function MessageCreate (tx: Tx, control: TriggerControl): Promise { const promises = [ MessageCreate(tx, control), - CommentCreate(tx, control) + CommentCreate(tx, control), + CommentDelete(tx, control) ] const res = await Promise.all(promises) return res.flat() From fd92ec7d8c32f38338b50282b4daef9ba9c12d3a Mon Sep 17 00:00:00 2001 From: Artyom Grigorovich Date: Wed, 13 Apr 2022 00:04:29 +0700 Subject: [PATCH 03/11] =?UTF-8?q?Tracker:=20Issue=20List=20=E2=80=93=20Pri?= =?UTF-8?q?ority=20presenter=20(#1382)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Artyom Grigorovich --- packages/presentation/src/index.ts | 1 + plugins/tracker-assets/lang/en.json | 1 + plugins/tracker-assets/lang/ru.json | 1 + .../src/components/CreateIssue.svelte | 11 +++- .../src/components/PrioritySelector.svelte | 54 +++++++++++-------- .../issues/CategoryPresenter.svelte | 1 + .../components/issues/IssuePresenter.svelte | 15 ++---- .../src/components/issues/Issues.svelte | 2 +- .../src/components/issues/IssuesList.svelte | 52 ++++++++++++++---- .../issues/PriorityPresenter.svelte | 49 +++++++++++++++++ plugins/tracker-resources/src/index.ts | 2 + plugins/tracker-resources/src/plugin.ts | 2 + 12 files changed, 145 insertions(+), 46 deletions(-) create mode 100644 plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte diff --git a/packages/presentation/src/index.ts b/packages/presentation/src/index.ts index d0aff88cd8..fc31f5d333 100644 --- a/packages/presentation/src/index.ts +++ b/packages/presentation/src/index.ts @@ -32,6 +32,7 @@ export { default as SpaceSelect } from './components/SpaceSelect.svelte' export { default as UserBox } from './components/UserBox.svelte' export { default as UserBoxList } from './components/UserBoxList.svelte' export { default as UserInfo } from './components/UserInfo.svelte' +export { default as UsersPopup } from './components/UsersPopup.svelte' export { connect, versionError } from './connect' export { default } from './plugin' export * from './types' diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index b69e3d3372..32c6d453af 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -26,6 +26,7 @@ "InProgress": "In Progress", "Done": "Done", "Canceled": "Canceled", + "SetPriority": "Set priority\u2026", "SetStatus": "Set status\u2026", "Priority": "Priority", "NoPriority": "No priority", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index a29f26a786..b7211a4919 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -22,6 +22,7 @@ "InProgress": "В работе", "Done": "Выполнено", "Canceled": "Отменено", + "SetPriority": "Установить приоритет\u2026", "SetStatus": "Установить статус\u2026", "Priority": "Установить приоритет", "NoPriority": "Нет приоритета", diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index 5be0352a9b..e3b6bfc781 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -91,7 +91,16 @@ { icon: tracker.icon.DueDate, label: tracker.string.DueDate }, { icon: tracker.icon.Parent, label: tracker.string.Parent } ] + let issueDate: number | null = null + + const handlePriorityChanged = (newPriority: IssuePriority | undefined) => { + if (newPriority === undefined) { + return + } + + object.priority = newPriority + } @@ -127,7 +136,7 @@
- + -
{/if} diff --git a/plugins/board-resources/src/components/presenters/MemberPresenter.svelte b/plugins/board-resources/src/components/presenters/MemberPresenter.svelte index 614a3258b1..f03da14ded 100644 --- a/plugins/board-resources/src/components/presenters/MemberPresenter.svelte +++ b/plugins/board-resources/src/components/presenters/MemberPresenter.svelte @@ -1,5 +1,5 @@ {#if value} diff --git a/packages/presentation/src/plugin.ts b/packages/presentation/src/plugin.ts index 9aa2fcc506..bff0f11e1a 100644 --- a/packages/presentation/src/plugin.ts +++ b/packages/presentation/src/plugin.ts @@ -42,7 +42,8 @@ export default plugin(presentationId, { Remove: '' as IntlString, Members: '' as IntlString, Search: '' as IntlString, - Unassigned: '' as IntlString + Unassigned: '' as IntlString, + CreateMore: '' as IntlString }, metadata: { RequiredVersion: '' as Metadata diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index e13120e4d2..093a8b95b9 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -244,8 +244,7 @@ p:last-child { margin-block-end: 0; } } .gap-1, .gap-1-5, .gap-2 { - & > * { margin-right: .25rem; } - & > *:last-child { margin-right: 0; } + & > *:not(:last-child) { margin-right: .25rem; } &.reverse { flex-direction: row-reverse; & > :last-child { margin-right: .25rem; } @@ -293,6 +292,8 @@ p:last-child { margin-block-end: 0; } .ml-6 { margin-left: 1.5rem; } .ml-8 { margin-left: 2rem; } .ml-10 { margin-left: 2.5rem; } +.ml-12 { margin-left: 3rem; } +.ml-22 { margin-left: 5.5rem; } .mr-1 { margin-right: .25rem; } .mr-2 { margin-right: .5rem; } .mr-3 { margin-right: .75rem; } @@ -300,6 +301,7 @@ p:last-child { margin-block-end: 0; } .mr-6 { margin-right: 1.5rem; } .mr-8 { margin-right: 2rem; } .mr-10 { margin-right: 2.5rem; } +.mt-0-5 { margin-top: .125rem; } .mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } @@ -317,6 +319,7 @@ p:last-child { margin-block-end: 0; } .mx-1 { margin: 0 .25rem; } .mx-2 { margin: 0 .5rem; } .mx-3 { margin: 0 .75rem; } +.my-4 { margin: 1rem 0; } .pr-1 { padding-right: .25rem; } .pr-4 { padding-right: 1rem; } @@ -377,6 +380,7 @@ p:last-child { margin-block-end: 0; } .min-w-4 { min-width: 1rem; } .min-w-9 { min-width: 2.25rem; } .min-h-0 { min-height: 0; } +.min-w-min { min-width: min-content; } .clear-mins { min-width: 0; min-height: 0; @@ -540,13 +544,14 @@ a.no-line { .background-bg-accent { background-color: var(--theme-bg-accent-color); } .background-bg-accent-normal { background-color: var(--theme-bg-accent-normal); } -.content-color { color: var(--theme-content-color); } +.content-color { color: var(--content-color); } .content-trans-color { color: var(--theme-content-trans-color); } -.content-accent-color { color: var(--theme-content-accent-color); } +.content-accent-color { color: var(--accent-color); } .content-dark-color { color: var(--theme-content-dark-color); } -.caption-color { color: var(--theme-caption-color); } +.caption-color { color: var(--caption-color); } .red-color { color: var(--highlight-red); } +.error-color { color: var(--error-color); } .border-radius-4 { border-radius: 1rem; } .border-radius-3 { border-radius: 0.75rem; } diff --git a/packages/theme/styles/dialogs.scss b/packages/theme/styles/dialogs.scss index 64c19874de..9d2bd1e61b 100644 --- a/packages/theme/styles/dialogs.scss +++ b/packages/theme/styles/dialogs.scss @@ -111,10 +111,14 @@ } .antiCard-content { + display: flex; + flex-direction: column; flex-shrink: 0; flex-grow: 1; margin: 0 1rem; height: fit-content; + + & > *:not(:last-child) { margin-bottom: 1rem; } } .antiCard-pool { @@ -157,20 +161,25 @@ display: flex; align-items: center; min-width: 0; + + & > *:not(:first-child) { margin-left: .375rem; } } &__divider, &__title { - margin-left: .375rem; font-weight: 400; font-size: .8125rem; } &__divider { color: var(--content-color); } &__title { color: var(--accent-color); } } - .antiCard-content { margin: 0 1.125rem; } + .antiCard-content { margin: .5rem 1.125rem 1rem; } .antiCard-pool { flex-direction: row; - margin: .375rem .75rem .75rem; + align-items: center; + margin: 0 .75rem .75rem; + font-size: .75rem; + + & > *:not(:last-child) { margin-right: .375rem; } } .antiCard-footer { direction: ltr; @@ -182,6 +191,16 @@ border-top: 1px solid var(--button-bg-color); &.reverse { flex-direction: row-reverse; } + &__error { + flex-grow: 1; + display: flex; + margin-left: .375rem; + min-width: 0; + font-weight: 500; + font-size: .75rem; + color: var(--system-error-color); + &:empty { visibility: hidden; } + } } } } diff --git a/packages/theme/styles/global.scss b/packages/theme/styles/global.scss index 37e345e846..d2449cdb9d 100644 --- a/packages/theme/styles/global.scss +++ b/packages/theme/styles/global.scss @@ -64,6 +64,7 @@ scrollbar-color: var(--theme-menu-color) var(--theme-bg-color); scrollbar-width: thin; --font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto; + --timing-shadow: cubic-bezier(0,.65,.35,1); } ::-webkit-scrollbar { diff --git a/packages/theme/styles/popups.scss b/packages/theme/styles/popups.scss index 1bb2388b6c..12ab51b071 100644 --- a/packages/theme/styles/popups.scss +++ b/packages/theme/styles/popups.scss @@ -70,6 +70,13 @@ width: 1rem; height: 1rem; } + .color { + margin-right: .75rem; + width: .875rem; + height: .875rem; + border: 1px solid rgba(0, 0, 0, .1); + border-radius: .25rem; + } .label { flex-grow: 1; min-width: 0; diff --git a/packages/ui/src/components/Button.svelte b/packages/ui/src/components/Button.svelte index 260a0b2c11..23ccdda2a0 100644 --- a/packages/ui/src/components/Button.svelte +++ b/packages/ui/src/components/Button.svelte @@ -22,7 +22,7 @@ export let label: IntlString | undefined = undefined export let labelParams: Record = {} - export let kind: 'primary' | 'secondary' | 'no-border' | 'transparent' | 'link' | 'dangerous' = 'secondary' + export let kind: 'primary' | 'secondary' | 'no-border' | 'transparent' | 'link' | 'link-bordered' | 'dangerous' = 'secondary' export let size: 'small' | 'medium' | 'large' | 'x-large' = 'medium' export let shape: 'circle' | undefined = undefined export let icon: Asset | AnySvelteComponent | undefined = undefined @@ -55,10 +55,11 @@ disabled={disabled || loading} style={width ? 'width: ' + width : ''} {title} + type={kind === 'primary' ? 'submit' : 'button'} on:click > {#if icon && !loading} -
{:else} - {#if label} -