Skip to content

A platform for community discussion. Free, open, simple.

UX: improve data explorer SQL editor for small screens (#40343)

Kris4ca9e5f2d0ea
diff --git a/plugins/discourse-data-explorer/admin/assets/javascripts/admin/templates/admin-plugins/show/explorer/edit.gjs b/plugins/discourse-data-explorer/admin/assets/javascripts/admin/templates/admin-plugins/show/explorer/edit.gjs
index c857450e4c9..9c3263f7b46 100644
--- a/plugins/discourse-data-explorer/admin/assets/javascripts/admin/templates/admin-plugins/show/explorer/edit.gjs
+++ b/plugins/discourse-data-explorer/admin/assets/javascripts/admin/templates/admin-plugins/show/explorer/edit.gjs
@@ -149,7 +149,6 @@ export default class QueriesEdit extends Component {
}}
>
- {{dIcon "discourse-expand"}}
</div>
<div class="clear"></div>
diff --git a/plugins/discourse-data-explorer/assets/javascripts/discourse/controllers/admin-plugins/show/explorer/edit.js b/plugins/discourse-data-explorer/assets/javascripts/discourse/controllers/admin-plugins/show/explorer/edit.js
index 44ca43145b7..82d0c6ab213 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/discourse/controllers/admin-plugins/show/explorer/edit.js
+++ b/plugins/discourse-data-explorer/assets/javascripts/discourse/controllers/admin-plugins/show/explorer/edit.js
@@ -321,18 +321,16 @@ export default class PluginsExplorerController extends Controller {
@bind
dragMove(e) {
- if (!e.movementY && !e.movementX) {
+ if (!e.movementX) {
return;
}
const editPane = document.querySelector(".query-editor");
const target = editPane.querySelector(".panels-flex");
- const grippie = editPane.querySelector(".grippie");
// we need to get the initial height / width of edit pane
// before we manipulate the size
if (!this.initialPaneWidth && !this.originalPaneHeight) {
- this.originalPaneWidth = target.clientWidth;
this.originalPaneHeight = target.clientHeight;
}
@@ -340,14 +338,9 @@ export default class PluginsExplorerController extends Controller {
this.originalPaneHeight,
target.clientHeight + e.movementY
);
- const newWidth = Math.max(
- this.originalPaneWidth,
- target.clientWidth + e.movementX
- );
target.style.height = newHeight + "px";
- target.style.width = newWidth + "px";
- grippie.style.width = newWidth + "px";
+
this.appEvents.trigger("ace:resize");
}
diff --git a/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss b/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
index 2d56344d46b..fe7fd0a7be5 100644
--- a/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
+++ b/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
@@ -105,16 +105,31 @@ table.group-reports {
.panels-flex {
display: flex;
height: 400px;
- border: 1px solid var(--primary-very-low);
+ border: 1px solid var(--primary-400);
+ border-radius: var(--d-border-radius);
+ overflow: hidden;
+
+ @include viewport.until(sm) {
+ flex-direction: column;
+ height: auto;
+ }
}
.editor-panel {
- flex-grow: 1;
+ flex: 1 0 50%;
.ace-wrapper {
+ --min-height: unset;
+ min-height: var(--min-height);
position: relative;
height: 100%;
width: 100%;
+ box-sizing: border-box;
+ border: none;
+
+ @include viewport.until(sm) {
+ --min-height: 300px;
+ }
}
.ace_editor {
@@ -127,12 +142,16 @@ table.group-reports {
}
.right-panel {
+ --width: 345px;
flex-shrink: 0;
flex-grow: 0;
- width: 345px;
+ width: var(--width);
+
+ @include viewport.until(sm) {
+ --width: 100%;
+ }
.schema {
- border-left: 1px solid var(--primary-low);
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
@@ -140,6 +159,17 @@ table.group-reports {
font-size: var(--font-down-1);
position: relative;
+ @include viewport.until(sm) {
+ .schema-container {
+ height: 200px;
+ overflow: auto;
+ }
+ }
+
+ @include viewport.from(sm) {
+ border-left: 1px solid var(--primary-low);
+ }
+
.schema-search {
padding: 0.5em;
position: sticky;
@@ -149,7 +179,11 @@ table.group-reports {
display: flex;
align-items: center;
gap: 0.4em;
- border-bottom: 1px solid var(--primary-very-low);
+ border-bottom: 1px solid var(--primary-low);
+
+ @include viewport.until(sm) {
+ border-top: 1px solid var(--primary-low);
+ }
.schema-search__icon {
color: var(--primary-medium);
@@ -260,17 +294,10 @@ table.group-reports {
.grippie {
cursor: nwse-resize;
- clear: both;
- font-size: $font-down-2;
+ padding-bottom: var(--space-2);
user-select: none;
color: var(--primary);
text-align: right;
- background: var(--primary-very-low);
- border: 1px solid var(--primary-very-low);
-
- .d-icon {
- transform: rotate(90deg);
- }
}
}