Skip to content

Commit 4bf07b1

Browse files
author
Kevin Nadro
committed
new window overlay for generating
- removed the sandbox tab its not an algorithm now - the overlay can be opened by pressing “generate” button at the top menu bar - creates overlayed divs that have the functionality to generate a tracer and the code - (x) button to close and return to the algorithm
1 parent 5d7d0d2 commit 4bf07b1

File tree

10 files changed

+74
-53
lines changed

10 files changed

+74
-53
lines changed

algorithm/category.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@
6868
},
6969
"name": "Search"
7070
},
71-
"sandbox": {
72-
"list": {
73-
"create_mode": "Create Mode"
74-
},
75-
"name": "Sandbox"
76-
},
7771
"sorting": {
7872
"list": {
7973
"bucket": "Bucket Sort",

algorithm/sandbox/create_mode/desc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

algorithm/sandbox/create_mode/normal/code.js

Whitespace-only changes.

algorithm/sandbox/create_mode/normal/data.js

Whitespace-only changes.

css/stylesheet.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ section {
252252

253253
.sandbox_container{
254254
left: 50%;
255+
z-index: 100;
255256
}
256257

257258
.editor_container {
@@ -341,6 +342,7 @@ section {
341342
border-bottom: none;
342343
}
343344

345+
.close_bar,
344346
.files_bar {
345347
height: 30px;
346348
border-bottom: 1px solid #505050;
@@ -385,6 +387,11 @@ section {
385387
box-shadow: inset 16px 0 16px -16px rgba(0, 0, 0, .6), inset -16px 0 16px -16px rgba(0, 0, 0, .6);
386388
}
387389

390+
.close_bar {
391+
width: 100%;
392+
background-color: #3f3f3f;
393+
}
394+
388395
.explanation_container {
389396
border: none;
390397
top: 30px;
@@ -689,15 +696,16 @@ input[type=number]::-webkit-outer-spin-button {
689696
}
690697

691698
.auto-gen{
692-
height: 33%;
693-
border: 1px solid #515151;
699+
height: 34%;
700+
/*border: 1px solid #515151;*/
694701
text-align: center;
695702
background-color: #262626;
696703
display: flex;
697704
align-items: center;
698705
}
699706

700707
.auto-gen-tracers{
708+
top: 30px;
701709
bottom: 66%;
702710
}
703711

index.html

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ <h3>
3030
</h3>
3131
</button>
3232
<div class="top-menu-buttons">
33+
<div class="btn" id="btn_generate">
34+
<div class="wrapper">
35+
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
36+
<span class="btn-text">Generate</span>
37+
</div>
38+
</div>
39+
3340
<div class="btn" id="btn_share">
3441
<div class="wrapper">
3542
<i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared">
@@ -127,32 +134,6 @@ <h3>
127134
</div>
128135
</section>
129136
</div>
130-
<div class="sandbox_container hide">
131-
132-
<div class="auto-gen auto-gen-tracers">
133-
<button class='sb-button' id="button-2DMatrix">Create 2DMatrix</button>
134-
135-
</div>
136-
137-
<div class="auto-gen auto-gen-options">
138-
<div>
139-
# of Rows: <input class="inputs"id="numRows" type="number" value="5">
140-
</div>
141-
142-
<div>
143-
# of Columns: <input class="inputs"id="numColumns" type="number" value="5">
144-
</div>
145-
146-
<div>
147-
Tracer Name: <input class="inputs"id="tracerName" type="text" value="default">
148-
</div>
149-
</div>
150-
151-
<div class="auto-gen auto-gen-generate">
152-
<button class='sb-button' id="button-generateJS">Generate Javascript</button>
153-
</div>
154-
155-
</div>
156137
<div class="editor_container">
157138
<section class="files_bar">
158139
<button class="btn-left"><i class="fa fa-angle-left" aria-hidden="true"></i></button>

js/create/index.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,61 @@
22

33
const modules = require('../module');
44
const array2d = require('./array2d');
5+
const util = require('./util');
56

7+
const closeCreate = (modules) => {
8+
const $btnClose = $('#btn_close');
9+
10+
$btnClose.click(() => {
11+
$('.sandbox_container').remove();
12+
util.clearModules();
13+
restoreModules(modules);
14+
});
15+
};
16+
17+
const restoreModules = (modules) => {
18+
for (var i = 0; i < modules.length; i++) {
19+
$('.module_container').append(modules[i]);
20+
}
21+
};
22+
23+
const saveModules = () => {
24+
return $('.module_wrapper')
25+
};
626

727
const init = () => {
28+
var moduleWrappers = saveModules();
29+
30+
util.clearModules();
31+
$('.workspace').append("<div class='sandbox_container'>\
32+
<section class='close_bar'>\
33+
<div class='btn' id='btn_close'>\
34+
<div class='wrapper'>\
35+
<i class='fa fa-times' aria-hidden='true'></i>\
36+
</div>\
37+
</div>\
38+
</section>\
39+
<section class='auto-gen auto-gen-tracers'>\
40+
<button class='sb-button' id='button-2DMatrix'>Create 2DMatrix</button>\
41+
</section>\
42+
<section class='auto-gen auto-gen-options'>\
43+
<div>\
44+
# of Rows: <input class='inputs'id='numRows' type='number' value='5'>\
45+
</div>\
46+
<div>\
47+
# of Columns: <input class='inputs'id='numColumns' type='number' value='5'>\
48+
</div>\
49+
<div>\
50+
Tracer Name: <input class='inputs'id='tracerName' type='text' value='default'>\
51+
</div>\
52+
</section>\
53+
<section class='auto-gen auto-gen-generate'>\
54+
<button class='sb-button' id='button-generateJS'>Generate Javascript</button>\
55+
</section>\
56+
</div>");
857
array2d.setup();
58+
59+
closeCreate(moduleWrappers);
960
};
1061

1162
module.exports = {

js/dom/setup/setup_top_menu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const app = require('../../app');
44
const Server = require('../../server');
55
const Toast = require('../toast');
66
const TopMenu = require('../top_menu');
7+
const create = require('../../create');
78

89
module.exports = () => {
910

@@ -32,6 +33,7 @@ module.exports = () => {
3233
const $btnPause = $('#btn_pause');
3334
const $btnPrev = $('#btn_prev');
3435
const $btnNext = $('#btn_next');
36+
const $btnGenerate = $('#btn_generate');
3537

3638
// initially, control buttons are disabled
3739
TopMenu.disableFlowControl();
@@ -73,4 +75,8 @@ module.exports = () => {
7375
app.getTracerManager().nextStep();
7476
});
7577

78+
$btnGenerate.click(() => {
79+
create.init();
80+
});
81+
7682
};

js/dom/show_algorithm.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ module.exports = (category, algorithm, data, requestedFile) => {
2525
algorithm_name = categoryObj.list[algorithm];
2626
}
2727

28-
if(category_name === 'Sandbox'){
29-
$('.editor_container').addClass('hide');
30-
$('.sandbox_container').removeClass('hide');
31-
}else{
32-
$('.editor_container').removeClass('hide');
33-
$('.sandbox_container').addClass('hide');
34-
}
35-
3628
$('.sidemenu button').removeClass('active');
3729
$menu.addClass('active');
3830

js/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const app = require('./app');
55
const AppConstructor = require('./app/constructor');
66
const DOM = require('./dom');
77
const Server = require('./server');
8-
const Sandbox= require('./create');
98
const modules = require('./module');
109

1110
const {
@@ -73,8 +72,6 @@ $(() => {
7372
DOM.showFirstAlgorithm();
7473
}
7574

76-
Sandbox.init();
77-
7875
});
7976

8077
Server.loadWikiList().then((data) => {

0 commit comments

Comments
 (0)