From 944cfafcbab5ce9d6882a555457417758f396bbd Mon Sep 17 00:00:00 2001
From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
Date: Wed, 30 Mar 2022 11:35:09 +0600
Subject: [PATCH] Custom done states (#1238)
---
packages/ui/src/components/Icon.svelte | 2 +-
.../src/components/ApplicationsView.svelte | 2 +-
.../components/statuses/ManageStatuses.svelte | 20 ++-
.../src/components/StatusTableView.svelte | 32 +++--
.../components/kanban/KanbanDragDone.svelte | 129 ++++++++++++++++++
.../src/components/kanban/KanbanEditor.svelte | 40 +++---
.../kanban/KanbanTemplateEditor.svelte | 51 ++++---
.../src/components/kanban/KanbanView.svelte | 99 ++------------
.../components/state/DoneStatesPopup.svelte | 1 +
.../src/components/state/EditStatuses.svelte | 17 ++-
.../src/components/state/StatesEditor.svelte | 44 ++++--
11 files changed, 269 insertions(+), 168 deletions(-)
create mode 100644 plugins/task-resources/src/components/kanban/KanbanDragDone.svelte
diff --git a/packages/ui/src/components/Icon.svelte b/packages/ui/src/components/Icon.svelte
index 54d57bee64..40b9e3f8ba 100644
--- a/packages/ui/src/components/Icon.svelte
+++ b/packages/ui/src/components/Icon.svelte
@@ -14,7 +14,7 @@
-->
+
+
+ {#each wonStates as wonState}
+
{
+ hoveredDoneState = wonState._id
+ }}
+ on:dragleave={() => {
+ if (hoveredDoneState === wonState._id) {
+ hoveredDoneState = undefined
+ }
+ }}
+ on:dragover|preventDefault={() => {}}
+ on:drop={onDone(wonState)}>
+
+ {wonState.title}
+
+ {/each}
+ {#each lostStates as lostState}
+
{
+ hoveredDoneState = lostState._id
+ }}
+ on:dragleave={() => {
+ if (hoveredDoneState === lostState._id) {
+ hoveredDoneState = undefined
+ }
+ }}
+ on:dragover|preventDefault={() => {}}
+ on:drop={onDone(lostState)}>
+
+ {lostState.title}
+
+ {/each}
+
+
+
\ No newline at end of file
diff --git a/plugins/task-resources/src/components/kanban/KanbanEditor.svelte b/plugins/task-resources/src/components/kanban/KanbanEditor.svelte
index a8cb4de3cd..cffc958e15 100644
--- a/plugins/task-resources/src/components/kanban/KanbanEditor.svelte
+++ b/plugins/task-resources/src/components/kanban/KanbanEditor.svelte
@@ -1,24 +1,23 @@
-
+ { onAdd(e.detail) }} on:delete on:move={onMove}/>
diff --git a/plugins/task-resources/src/components/kanban/KanbanTemplateEditor.svelte b/plugins/task-resources/src/components/kanban/KanbanTemplateEditor.svelte
index f5f0983ea3..21b63fad7b 100644
--- a/plugins/task-resources/src/components/kanban/KanbanTemplateEditor.svelte
+++ b/plugins/task-resources/src/components/kanban/KanbanTemplateEditor.svelte
@@ -15,10 +15,10 @@
-->
-
+ { onAdd(e.detail) }} on:delete={onDelete} on:move={onMove}/>
diff --git a/plugins/task-resources/src/components/kanban/KanbanView.svelte b/plugins/task-resources/src/components/kanban/KanbanView.svelte
index 5e01f3331c..aa810295d7 100644
--- a/plugins/task-resources/src/components/kanban/KanbanView.svelte
+++ b/plugins/task-resources/src/components/kanban/KanbanView.svelte
@@ -15,14 +15,13 @@
-->
{#await cardPresenter(_class)}
@@ -227,37 +211,8 @@
- {#if isDragging && wonState !== undefined && lostState !== undefined}
-
-
{
- hoveredDoneState = wonState?._id
- }}
- on:dragleave={() => {
- hoveredDoneState = undefined
- }}
- on:dragover|preventDefault={() => {}}
- on:drop={onDone(wonState)}>
-
- {wonState.title}
-
-
{
- hoveredDoneState = lostState?._id
- }}
- on:dragleave={() => {
- hoveredDoneState = undefined
- }}
- on:dragover|preventDefault={() => {}}
- on:drop={onDone(lostState)}>
-
- {lostState.title}
-
-
+ {#if isDragging}
+ { onDone(e.detail) }} />
{/if}
{/await}
@@ -273,42 +228,6 @@
height: 100%;
}
- .done-panel {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
-
- display: flex;
- align-items: center;
- justify-content: stretch;
- padding: .5rem 2.5rem;
- background-color: var(--theme-bg-color);
- border-top: 1px solid var(--theme-dialog-divider);
- border-radius: 0 0 1.25rem 1.25rem;
- }
-
- .done-item {
- height: 3rem;
- color: var(--theme-caption-color);
- border: 1px dashed transparent;
- border-radius: .75rem;
-
- &.hovered {
- background-color: var(--theme-button-bg-enabled);
- border-color: var(--theme-dialog-divider);
- }
- }
-
- .done-icon {
- width: .5rem;
- height: .5rem;
- border-radius: 50%;
-
- &.won { background-color: #27B166; }
- &.lost { background-color: #F96E50; }
- }
-
.scrollable {
height: 100%;
margin-bottom: .25rem;
diff --git a/plugins/task-resources/src/components/state/DoneStatesPopup.svelte b/plugins/task-resources/src/components/state/DoneStatesPopup.svelte
index c21ade2898..388cd4c492 100644
--- a/plugins/task-resources/src/components/state/DoneStatesPopup.svelte
+++ b/plugins/task-resources/src/components/state/DoneStatesPopup.svelte
@@ -33,6 +33,7 @@
},
{
sort: {
+ _class: SortingOrder.Descending,
rank: SortingOrder.Ascending
}
}
diff --git a/plugins/task-resources/src/components/state/EditStatuses.svelte b/plugins/task-resources/src/components/state/EditStatuses.svelte
index 7a92c00659..f41edb6296 100644
--- a/plugins/task-resources/src/components/state/EditStatuses.svelte
+++ b/plugins/task-resources/src/components/state/EditStatuses.svelte
@@ -15,10 +15,10 @@
-->
-
+
-
+ { onAdd(task.class.State) }}/>
-
+
{#each states as state, i}
{#if state}
-
-
+
+
+ { onAdd(task.class.WonState) }}/>
-
+
{#each wonStates as state}
{#if state}
+ {#if wonStates.length > 1}
+
{
+ showPopup(StatusesPopup, { onDelete: () => dispatch('delete', { state }) }, ev.target, () => {})
+ }}
+ >
+
+
+ {/if}
{/if}
{/each}
-
-
+
+
+ { onAdd(task.class.LostState) }}/>
-
+
{#each lostStates as state}
{#if state}
+ {#if lostStates.length > 1}
+
{
+ showPopup(StatusesPopup, { onDelete: () => dispatch('delete', { state }) }, ev.target, () => {})
+ }}
+ >
+
+
+ {/if}
{/if}
{/each}