From 34ddd0cb6c6bd5f295dac7487ca9e03c901f8aaf Mon Sep 17 00:00:00 2001 From: Alex <41288429+Dvinyanin@users.noreply.github.com> Date: Sun, 24 Apr 2022 12:06:20 +0700 Subject: [PATCH] Customize board header (#1492) Signed-off-by: Dvinyanin Alexandr --- models/board/src/index.ts | 5 +- plugins/board-assets/lang/en.json | 5 +- plugins/board-assets/lang/ru.json | 7 ++- .../src/components/BoardHeader.svelte | 24 +++++++++ .../src/components/popups/Menu.svelte | 50 +++++++++++++++++++ .../src/components/popups/RemoveCard.svelte | 40 +++++++++++++++ plugins/board-resources/src/index.ts | 18 ++++--- plugins/board-resources/src/plugin.ts | 8 ++- plugins/chunter-resources/src/index.ts | 2 + 9 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 plugins/board-resources/src/components/BoardHeader.svelte create mode 100644 plugins/board-resources/src/components/popups/Menu.svelte create mode 100644 plugins/board-resources/src/components/popups/RemoveCard.svelte diff --git a/models/board/src/index.ts b/models/board/src/index.ts index 693d89645d..580bd6a858 100644 --- a/models/board/src/index.ts +++ b/models/board/src/index.ts @@ -131,6 +131,9 @@ export function createModel (builder: Builder): void { // createItemLabel: board.string.CardCreateLabel } }) + builder.mixin(board.class.Board, core.class.Class, view.mixin.SpaceHeader, { + header: board.component.BoardHeader + }) builder.createDoc( workbench.class.Application, @@ -435,7 +438,7 @@ export function createModel (builder: Builder): void { { icon: board.icon.Card, isInline: true, - label: board.string.Archive, + label: board.string.ToArchive, position: 140, type: board.cardActionType.Action, handler: board.cardActionHandler.Archive, diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json index 8052d7da25..1740d2af96 100644 --- a/plugins/board-assets/lang/en.json +++ b/plugins/board-assets/lang/en.json @@ -87,6 +87,9 @@ "Edit": "Edit", "Update": "Update", "DeleteAttachment": "Deleting an attachment is permanent. There is no undo.", - "SearchMembers": "Search members" + "DeleteCard": "All actions will be removed from the activity feed and you won’t be able to re-open the card. There is no undo.", + "SearchMembers": "Search members", + "Menu": "Menu", + "ToArchive": "Archive" } } diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json index a32917bab4..53671d55b5 100644 --- a/plugins/board-assets/lang/ru.json +++ b/plugins/board-assets/lang/ru.json @@ -55,7 +55,7 @@ "MakeTemplate": "Шаблон", "Watch": "Отслеживать", "Unwatch": "Не отслеживать", - "Archive": "Архивировать", + "Archive": "Архив", "SendToBoard": "Вернуть", "Delete": "Удалить", "HideDetails": "Спрятать", @@ -87,6 +87,9 @@ "Edit": "Изменить", "Update": "Обновить", "DeleteAttachment": "Удаление вложения необратимо. Отмена невозможна.", - "SearchMembers": "Поиск участников" + "DeleteCard": "Все действия будут удалены из ленты, и вы не сможете повторно открыть карточку. Отмена невозможна.", + "SearchMembers": "Поиск участников", + "Menu": "Меню", + "ToArchive": "Архивировать" } } diff --git a/plugins/board-resources/src/components/BoardHeader.svelte b/plugins/board-resources/src/components/BoardHeader.svelte new file mode 100644 index 0000000000..4307aa76cd --- /dev/null +++ b/plugins/board-resources/src/components/BoardHeader.svelte @@ -0,0 +1,24 @@ + + +
+ {#if space} +
+
diff --git a/plugins/board-resources/src/components/popups/Menu.svelte b/plugins/board-resources/src/components/popups/Menu.svelte new file mode 100644 index 0000000000..eabb969eea --- /dev/null +++ b/plugins/board-resources/src/components/popups/Menu.svelte @@ -0,0 +1,50 @@ + + +
+
+
+
+
+
+ { dispatch('close') }} /> +
+
+
+ {#if archivedCards} + {#each archivedCards as card} + +
+
+ {/each} + {/if} +
+
diff --git a/plugins/board-resources/src/components/popups/RemoveCard.svelte b/plugins/board-resources/src/components/popups/RemoveCard.svelte new file mode 100644 index 0000000000..cad13de15a --- /dev/null +++ b/plugins/board-resources/src/components/popups/RemoveCard.svelte @@ -0,0 +1,40 @@ + + +
+
+
+
+
+
+ { dispatch('close') }} /> +
+
+
+
+
+ +
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts index 5648386c19..d68c01c6c9 100644 --- a/plugins/board-resources/src/index.ts +++ b/plugins/board-resources/src/index.ts @@ -32,24 +32,29 @@ import TemplatesIcon from './components/TemplatesIcon.svelte' import KanbanView from './components/KanbanView.svelte' import AttachmentPicker from './components/popups/AttachmentPicker.svelte' import CardLabelsPopup from './components/popups/CardLabelsPopup.svelte' -import MoveView from './components/popups/MoveCard.svelte' +import MoveCard from './components/popups/MoveCard.svelte' +import DeleteCard from './components/popups/RemoveCard.svelte' import DateRangePicker from './components/popups/DateRangePicker.svelte' import CardLabelPresenter from './components/presenters/LabelPresenter.svelte' import CardDatePresenter from './components/presenters/DatePresenter.svelte' import WatchCard from './components/WatchCard.svelte' +import BoardHeader from './components/BoardHeader.svelte' import { addCurrentUser, canAddCurrentUser, isArchived, isUnarchived, archiveCard, - unarchiveCard, - deleteCard + unarchiveCard } from './utils/CardUtils' import { getPopupAlignment } from './utils/PopupUtils' async function showMoveCardPopup (object: Card, client: Client, e?: Event): Promise { - showPopup(MoveView, { object }, getPopupAlignment(e)) + showPopup(MoveCard, { object }, getPopupAlignment(e)) +} + +async function showDeleteCardPopup (object: Card, client: Client, e?: Event): Promise { + showPopup(DeleteCard, { object }, getPopupAlignment(e)) } async function showDatePickerPopup (object: Card, client: Client, e?: Event): Promise { @@ -94,7 +99,8 @@ export default async (): Promise => ({ TemplatesIcon, KanbanView, BoardPresenter, - WatchCard + WatchCard, + BoardHeader }, cardActionHandler: { Join: addCurrentUser, @@ -104,7 +110,7 @@ export default async (): Promise => ({ Attachments: showAttachmentsPopup, Archive: archiveCard, SendToBoard: unarchiveCard, - Delete: deleteCard, + Delete: showDeleteCardPopup, Members: showEditMembersPopup }, cardActionSupportedHandler: { diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index 12fd0eb167..45fb8f464d 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -108,12 +108,16 @@ export default mergeIds(boardId, board, { Edit: '' as IntlString, Update: '' as IntlString, DeleteAttachment: '' as IntlString, - SearchMembers: '' as IntlString + SearchMembers: '' as IntlString, + DeleteCard: '' as IntlString, + Menu: '' as IntlString, + ToArchive: '' as IntlString }, component: { Boards: '' as AnyComponent, EditCard: '' as AnyComponent, Members: '' as AnyComponent, - Settings: '' as AnyComponent + Settings: '' as AnyComponent, + BoardHeader: '' as AnyComponent } }) diff --git a/plugins/chunter-resources/src/index.ts b/plugins/chunter-resources/src/index.ts index 6a877429a7..67d87ce9ef 100644 --- a/plugins/chunter-resources/src/index.ts +++ b/plugins/chunter-resources/src/index.ts @@ -40,6 +40,8 @@ import preference from '@anticrm/preference' import { getDmName } from './utils' +export { default as Header } from './components/Header.svelte' +export { classIcon } from './utils' export { CommentsPresenter } async function MarkUnread (object: Message): Promise {