diff --git a/plugins/board-assets/lang/en.json b/plugins/board-assets/lang/en.json index 9193ae4aed..76ea2a1173 100644 --- a/plugins/board-assets/lang/en.json +++ b/plugins/board-assets/lang/en.json @@ -97,6 +97,8 @@ "NoResults": "No results", "SwitchToLists": "Switch to lists", "SwitchToCards": "Switch to cards", - "SearchArchive": "Search archive..." + "SearchArchive": "Search archive...", + "Size": "Size", + "RemoveCover": "Remove cover" } } diff --git a/plugins/board-assets/lang/ru.json b/plugins/board-assets/lang/ru.json index fce41d21b8..01c00364ab 100644 --- a/plugins/board-assets/lang/ru.json +++ b/plugins/board-assets/lang/ru.json @@ -97,6 +97,8 @@ "NoResults": "Нет результатов", "SwitchToLists": "К спискам", "SwitchToCards": "К карточкам", - "SearchArchive": "Поиск в архиве..." + "SearchArchive": "Поиск в архиве...", + "Size": "Размер", + "RemoveCover": "Удалить обложку" } } diff --git a/plugins/board-resources/src/components/popups/CardCoverEditor.svelte b/plugins/board-resources/src/components/popups/CardCoverEditor.svelte new file mode 100644 index 0000000000..f3c898a88d --- /dev/null +++ b/plugins/board-resources/src/components/popups/CardCoverEditor.svelte @@ -0,0 +1,104 @@ + + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ {#each colorGroups as colorGroup} +
+ {#each colorGroup as color} +
+ { + updateCover({ color }) + }} + > + {#if cover && cover.color === color} +
+ +
+ {/if} +
+
+ {/each} +
+ {/each} +
+
+
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts index 48987081d6..53331ba936 100644 --- a/plugins/board-resources/src/index.ts +++ b/plugins/board-resources/src/index.ts @@ -51,6 +51,7 @@ import { updateCardMembers } from './utils/CardUtils' import { getPopupAlignment } from './utils/PopupUtils' +import CardCoverEditor from './components/popups/CardCoverEditor.svelte' async function showMoveCardPopup (object: Card, client: Client, e?: Event): Promise { showPopup(MoveCard, { object }, getPopupAlignment(e)) @@ -94,6 +95,10 @@ async function showAttachmentsPopup (object: Card, client: Client, e?: Event): P showPopup(AttachmentPicker, { object }, getPopupAlignment(e)) } +async function showCoverPopup (object: Card, client: Client, e?: Event): Promise { + showPopup(CardCoverEditor, { object }, getPopupAlignment(e)) +} + export default async (): Promise => ({ component: { CreateBoard, @@ -121,7 +126,8 @@ export default async (): Promise => ({ SendToBoard: unarchiveCard, Delete: showDeleteCardPopup, Members: showEditMembersPopup, - Copy: showCopyCardPopup + Copy: showCopyCardPopup, + Cover: showCoverPopup }, cardActionSupportedHandler: { Join: canAddCurrentUser, diff --git a/plugins/board-resources/src/plugin.ts b/plugins/board-resources/src/plugin.ts index afffffc4cf..5d029c2332 100644 --- a/plugins/board-resources/src/plugin.ts +++ b/plugins/board-resources/src/plugin.ts @@ -118,7 +118,9 @@ export default mergeIds(boardId, board, { NoResults: '' as IntlString, SwitchToLists: '' as IntlString, SwitchToCards: '' as IntlString, - SearchArchive: '' as IntlString + SearchArchive: '' as IntlString, + Size: '' as IntlString, + RemoveCover: '' as IntlString }, component: { EditCard: '' as AnyComponent, diff --git a/plugins/board-resources/src/utils/CardUtils.ts b/plugins/board-resources/src/utils/CardUtils.ts index d4e1cf1b3f..775f962cd5 100644 --- a/plugins/board-resources/src/utils/CardUtils.ts +++ b/plugins/board-resources/src/utils/CardUtils.ts @@ -43,7 +43,7 @@ export function canAddCurrentUser (card: Card): boolean { } export function hasCover (card: Card): boolean { - return card.coverColor !== undefined || card.coverImage !== undefined + return card.cover != null } export function hasDate (card: Card): boolean { diff --git a/plugins/board/src/index.ts b/plugins/board/src/index.ts index caa25f375b..bd3ca5d2c6 100644 --- a/plugins/board/src/index.ts +++ b/plugins/board/src/index.ts @@ -56,6 +56,15 @@ export interface CardDate extends Obj { startDate?: Timestamp } +/** + * @public + */ +export interface CardCover { + color?: number + image?: string + size: 'large' | 'small' +} + /** * @public */ @@ -73,8 +82,7 @@ export interface Card extends Task { location?: string - coverColor?: number - coverImage?: string + cover?: CardCover | null comments?: number attachments?: number