From a4d596fb2f7a19dfd7276b2285c91aa7800c158c Mon Sep 17 00:00:00 2001
From: Eugen Ciur <eugen@papermerge.com>
Date: Sat, 19 Mar 2022 08:26:22 +0100
Subject: [PATCH] add panel modes: swap, move to left, move to right

---
 app/components/commander/action_modes.hbs |  9 ++++++++-
 app/components/panel_modes.hbs            | 18 ++++++++++++++++++
 app/components/viewer/action_modes.hbs    |  5 +++++
 app/controllers/authenticated/document.js | 15 +++++++++++++++
 app/controllers/authenticated/nodes.js    | 15 +++++++++++++++
 app/styles/context_menu.scss              |  2 --
 6 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 app/components/panel_modes.hbs

diff --git a/app/components/commander/action_modes.hbs b/app/components/commander/action_modes.hbs
index 9525a7c..5db1cd0 100644
--- a/app/components/commander/action_modes.hbs
+++ b/app/components/commander/action_modes.hbs
@@ -1,6 +1,12 @@
 <div class="d-flex">
+
   <Commander::ViewMode
     @onViewModeChange={{@onViewModeChange}} />
+
+  <PanelModes
+    @dualPanelMode={{@dualPanelMode}}
+    @hint={{@hint}} />
+
   <div class="panel-mode">
     <button type="button" class="btn btn-light mx-1"
       {{on "click" (fn @onPanelToggle @hint) }}>
@@ -11,4 +17,5 @@
       {{/if}}
     </button>
   </div>
-</div>
\ No newline at end of file
+
+</div>
diff --git a/app/components/panel_modes.hbs b/app/components/panel_modes.hbs
new file mode 100644
index 0000000..192f584
--- /dev/null
+++ b/app/components/panel_modes.hbs
@@ -0,0 +1,18 @@
+{{#if @dualPanelMode}}
+  {{#if (is_equal @hint "left")}}
+    <button type="button"
+      class="btn btn-light mx-1">
+        <i class="bi-arrow-bar-right"></i>
+    </button>
+  {{else}}
+    <button type="button"
+      class="btn btn-light mx-1">
+        <i class="bi-arrow-bar-left"></i>
+    </button>
+  {{/if}}
+
+  <button type="button"
+    class="btn btn-light mx-1">
+      <i class="bi-arrow-left-right"></i>
+  </button>
+{{/if}}
diff --git a/app/components/viewer/action_modes.hbs b/app/components/viewer/action_modes.hbs
index cd50f34..d0e4eea 100644
--- a/app/components/viewer/action_modes.hbs
+++ b/app/components/viewer/action_modes.hbs
@@ -1,4 +1,9 @@
 <div class="d-flex">
+
+  <PanelModes
+    @dualPanelMode={{@dualPanelMode}}
+    @hint={{@hint}} />
+
   <div class="panel-mode">
     <button type="button" class="btn btn-light mx-1"
       {{on "click" (fn @onPanelToggle @hint)}}>
diff --git a/app/controllers/authenticated/document.js b/app/controllers/authenticated/document.js
index 4a7d91e..7f4f96c 100644
--- a/app/controllers/authenticated/document.js
+++ b/app/controllers/authenticated/document.js
@@ -36,4 +36,19 @@ export default class DocumentController extends DualPanelBaseController {
     }
   }
 
+  @action
+  onSwapPanels() {
+    console.log(`onSwapPanels`);
+  }
+
+  @action
+  onLeftDuplicate() {
+    console.log(`onLeftDuplicate`);
+  }
+
+  @action
+  onRightDuplicate() {
+    console.log(`onRightDuplicate`);
+  }
+
 }
diff --git a/app/controllers/authenticated/nodes.js b/app/controllers/authenticated/nodes.js
index e927302..fd41b8f 100644
--- a/app/controllers/authenticated/nodes.js
+++ b/app/controllers/authenticated/nodes.js
@@ -34,4 +34,19 @@ export default class NodesController extends DualPanelBaseController {
       this.extra_type = 'folder';
     }
   }
+
+  @action
+  onSwapPanels() {
+    console.log(`onSwapPanels`);
+  }
+
+  @action
+  onLeftDuplicate() {
+    console.log(`onLeftDuplicate`);
+  }
+
+  @action
+  onRightDuplicate() {
+    console.log(`onRightDuplicate`);
+  }
 }
diff --git a/app/styles/context_menu.scss b/app/styles/context_menu.scss
index a7cf29b..4900517 100644
--- a/app/styles/context_menu.scss
+++ b/app/styles/context_menu.scss
@@ -20,5 +20,3 @@
   }
 
 }
-
-
-- 
GitLab