From 5d84e5181a65a5b0659e21f3ec1ac5c56a87196e Mon Sep 17 00:00:00 2001
From: Anna No <anna.no@xored.com>
Date: Thu, 9 Jun 2022 22:28:55 +0700
Subject: [PATCH] Board: Add labels view (#2047)

* Board: Add labels view

Signed-off-by: Anna No <anna.no@xored.com>

* fix formatting

Signed-off-by: Anna No <anna.no@xored.com>
---
 models/board/src/index.ts                       | 10 ++++++++++
 models/board/src/plugin.ts                      |  1 +
 .../src/components/LabelsView.svelte            | 17 +++++++++++++++++
 plugins/board-resources/src/index.ts            |  2 ++
 4 files changed, 30 insertions(+)
 create mode 100644 plugins/board-resources/src/components/LabelsView.svelte

diff --git a/models/board/src/index.ts b/models/board/src/index.ts
index 64cf6c320f..ddac78affb 100644
--- a/models/board/src/index.ts
+++ b/models/board/src/index.ts
@@ -149,6 +149,16 @@ export function createModel (builder: Builder): void {
             createComponent: board.component.CreateBoard
           }
         ],
+        specials: [
+          {
+            id: 'labels',
+            component: board.component.LabelsView,
+            icon: tags.icon.Tags,
+            label: board.string.Labels,
+            createItemLabel: board.string.Labels,
+            position: 'bottom'
+          }
+        ],
         aside: board.component.BoardMenu
       }
     },
diff --git a/models/board/src/plugin.ts b/models/board/src/plugin.ts
index 89409f720f..bee5b378b9 100644
--- a/models/board/src/plugin.ts
+++ b/models/board/src/plugin.ts
@@ -25,6 +25,7 @@ import { Action, ViewAction, ViewletDescriptor } from '@anticrm/view'
 export default mergeIds(boardId, board, {
   component: {
     CreateBoard: '' as AnyComponent,
+    LabelsView: '' as AnyComponent,
     CreateCard: '' as AnyComponent,
     KanbanCard: '' as AnyComponent,
     CardPresenter: '' as AnyComponent,
diff --git a/plugins/board-resources/src/components/LabelsView.svelte b/plugins/board-resources/src/components/LabelsView.svelte
new file mode 100644
index 0000000000..8d6b5eebba
--- /dev/null
+++ b/plugins/board-resources/src/components/LabelsView.svelte
@@ -0,0 +1,17 @@
+<script lang="ts">
+  import tags from '@anticrm/tags'
+  import { Component } from '@anticrm/ui'
+  import board from '../plugin'
+</script>
+
+<Component
+  is={tags.component.TagsView}
+  props={{
+    targetClass: board.class.Card,
+    title: board.string.Labels,
+    icon: tags.icon.Tags,
+    item: board.string.Labels,
+    key: 'labels',
+    сreateItemLabel: board.string.Labels
+  }}
+/>
diff --git a/plugins/board-resources/src/index.ts b/plugins/board-resources/src/index.ts
index 394dd077f4..3352655ea2 100644
--- a/plugins/board-resources/src/index.ts
+++ b/plugins/board-resources/src/index.ts
@@ -24,6 +24,7 @@ import CreateCard from './components/CreateCard.svelte'
 import EditCard from './components/EditCard.svelte'
 import KanbanCard from './components/KanbanCard.svelte'
 import KanbanView from './components/KanbanView.svelte'
+import LabelsView from './components/LabelsView.svelte'
 import MoveCard from './components/popups/MoveCard.svelte'
 import CopyCard from './components/popups/CopyCard.svelte'
 import DateRangePicker from './components/popups/DateRangePicker.svelte'
@@ -56,6 +57,7 @@ export default async (): Promise<Resources> => ({
   component: {
     CreateBoard,
     CreateCard,
+    LabelsView,
     EditCard,
     KanbanCard,
     CardPresenter,