Skip to content

Commit 0868d97

Browse files
committed
[gchq#181] adjust #controls panel template and css so it will automatically scale based on #controls height, which makes adjustWidth() redundant. Controls is now 50px height on mobile ( 70 was just a lot of wasted space that can be better spend )
1 parent 222bb62 commit 0868d97

File tree

7 files changed

+53
-57
lines changed

7 files changed

+53
-57
lines changed

src/web/App.mjs

+7-4
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class App {
314314

315315
this.columnSplitter = Split(["#operations", "#recipe", "#IO"], {
316316
sizes: [20, 30, 50],
317-
minSize: minimise ? [0, 0, 0] : [20, 30, 50],
317+
minSize: minimise ? [0, 0, 0] : [20, 330, 50],
318318
gutterSize: 4,
319319
expandToMin: true,
320320
onDrag: debounce(function() {
@@ -663,7 +663,6 @@ class App {
663663
* Adjust components to fit their containers.
664664
*/
665665
adjustComponentSizes() {
666-
this.manager.recipe.adjustWidth();
667666
this.manager.input.calcMaxTabs();
668667
this.manager.output.calcMaxTabs();
669668
}
@@ -877,7 +876,7 @@ class App {
877876
setDesktopUI(minimise){
878877
$("[data-toggle=tooltip]").tooltip("enable");
879878
this.setDesktopSplitter(minimise);
880-
// this.adjustComponentSizes();
879+
this.adjustComponentSizes();
881880
this.populateOperationsList();
882881
this.manager.recipe.clearAllSelectedClasses();
883882
}
@@ -903,7 +902,11 @@ class App {
903902
* ( themes/_structure ) if you make changes to those elements' height.
904903
*/
905904
assignAvailableHeight( isMobile ){
906-
const remainingSpace = window.innerHeight - (40+50+90-2); // banner, controls height, operations, accounting for some borders
905+
const bannerHeight = 40;
906+
const controlsHeight = 50;
907+
const operationsHeight = 90;
908+
909+
const remainingSpace = window.innerHeight - (bannerHeight+controlsHeight+operationsHeight-2);
907910

908911
// equally divide among recipe, input and output
909912
["recipe", "input", "output"].forEach(( div ) => {

src/web/TODO.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
- maybe a bit annoying that the fav cat opens whenever you add a new fav via icon-fav-click on mobile
99
- backspace on fs view should close max view. Keep making the same mistake and navigating away when for instance recipe is expanded and double click the window to fs > resolve. Reset layout
1010

11+
### Desktop
12+
- fixed status panel ( rhs ) overlays recipe column if split all the way to the right
13+
1114
### JS:
1215
- `core/Recipe.mjs`, `core/lib/Magic.js` return imports to original
1316

src/web/html/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
</div>
252252
<div class="col-6">
253253
<button type="button" class="btn btn-success btn-raised btn-block" id="bake" data-help-title="Baking" data-help="<p>Baking causes CyberChef to run the Recipe against your data. This involves three steps:</p><ol><li>The data in the Input is encoded into bytes using the character encoding selected in the Input status bar.</li><li>The data is run through each of the operations in the Recipe in turn with the output of one operation being fed into the next operation as its input.</li><li>The outcome of the final operation in the Recipe is decoded into Output text using the character encoding selected in the Output status bar.</li></ol><p>If there are multiple Inputs, the Bake button causes every Input to be baked simultaneously.</p>">
254-
<!-- <img aria-hidden="true" class="desktop-only" src="<%- require('../static/images/cook_male-32x32.png') %>" alt="Chef Icon"/>-->
254+
<img aria-hidden="true" class="desktop-only" src="<%- require('../static/images/cook_male-32x32.png') %>" alt="Chef Icon"/>
255255
<span>Bake!</span>
256256
</button>
257257
</div>

src/web/stylesheets/components/_controls.css

+33-24
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,13 @@
1515

1616
#controls-content {
1717
display: flex;
18-
align-items: center;
18+
/*align-items: center;*/
1919
padding: 10px 0;
20+
height: 100%;
2021
}
2122

22-
#auto-bake-label {
23-
/*display: inline-block;*/
24-
/*width: 100px;*/
25-
padding: 0;
26-
margin: 0;
27-
font-size: initial;
28-
/*text-align: center;*/
29-
color: var(--primary-font-colour);
30-
/*font-size: 14px;*/
31-
cursor: pointer;
32-
}
33-
34-
#auto-bake-label .check,
35-
#auto-bake-label .check::before {
36-
border-color: var(--input-highlight-colour);
37-
color: var(--input-highlight-colour);
38-
}
39-
40-
#auto-bake-label .checkbox-decorator {
41-
position: relative;
42-
margin: 0;
43-
padding: 0;
23+
#controls-content > div {
24+
height: 100%;
4425
}
4526

4627
/* bake button */
@@ -54,13 +35,41 @@
5435
margin: 0;
5536
font-size: initial;
5637
line-height: 0;
57-
height: 30px;
38+
height: 100%;
5839
}
5940

41+
/* auto bake */
6042
#controls-content .form-group {
6143
text-align: center;
44+
height: 100%;
45+
}
46+
47+
#controls-content .form-group > .checkbox {
48+
height: 100%;
49+
display: flex;
50+
align-items: center;
51+
justify-content: center;
6252
}
6353

54+
#auto-bake-label {
55+
padding: 0;
56+
margin: 0;
57+
font-size: initial;
58+
color: var(--primary-font-colour);
59+
cursor: pointer;
60+
}
61+
62+
#auto-bake-label .check,
63+
#auto-bake-label .check::before {
64+
border-color: var(--input-highlight-colour);
65+
color: var(--input-highlight-colour);
66+
}
67+
68+
#auto-bake-label .checkbox-decorator {
69+
position: relative;
70+
margin: 0;
71+
padding: 0;
72+
}
6473

6574

6675

src/web/stylesheets/layout/_structure.css

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#operations { height: var(--operations-height); }
1111
#controls { height: var(--controls-height); }
1212

13+
@media only screen and ( min-width: 768px ) {
14+
#controls { height: var(--desktop-controls-height); }
15+
}
16+
1317
#banner,
1418
#content-wrapper {
1519
position: absolute;
@@ -47,11 +51,11 @@
4751

4852
@media only screen and ( min-width: 768px ) {
4953
#recipe {
50-
padding-bottom: var(--controls-height);
54+
padding-bottom: var(--desktop-controls-height);
5155
}
5256

5357
#recipe .list-area {
54-
bottom: var(--controls-height);
58+
bottom: var(--desktop-controls-height);
5559
}
5660

5761
#workspace-wrapper {

src/web/stylesheets/themes/_structure.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
:root {
22
/* Fixed heights */
33
--banner-height: 40px;
4-
--controls-height: 50px;
54
/*initial mobile height*/
5+
--controls-height: 50px;
66
--operations-height: 90px;
7+
8+
--desktop-controls-height: 70px;
79
}
810

911
/**

src/web/waiters/RecipeWaiter.mjs

-25
Original file line numberDiff line numberDiff line change
@@ -589,31 +589,6 @@ class RecipeWaiter {
589589
}
590590

591591

592-
/**
593-
* Adjusts the number of ingredient columns as the width of the recipe changes.
594-
*/
595-
adjustWidth() {
596-
const recList = document.getElementById("rec-list");
597-
598-
// Hide Chef icon on Bake button if the page is compressed
599-
const bakeIcon = document.querySelector("#bake img");
600-
601-
if (recList.clientWidth < 370) {
602-
// Hide Chef icon on Bake button
603-
bakeIcon.style.display = "none";
604-
} else {
605-
bakeIcon.style.display = "inline-block";
606-
}
607-
608-
// Scale controls to fit pane width
609-
const controls = document.getElementById("controls");
610-
const controlsContent = document.getElementById("controls-content");
611-
const scale = (controls.clientWidth - 1) / controlsContent.scrollWidth;
612-
613-
controlsContent.style.transform = `scale(${scale})`;
614-
}
615-
616-
617592
/**
618593
* Remove all "selected" classes for op-list list items at once
619594
*

0 commit comments

Comments
 (0)