Skip to content

Commit

Permalink
Merge pull request #38 from EmpowrOrg/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dri94 authored Sep 27, 2022
2 parents acc88aa + 93ebc34 commit e333640
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 152 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ their mime-types
| C++ | text/x-c++src |
| C# | text/x-csharp |
| Java | text/x-java |
| JavaScript | text/javascript |
| Kotlin | text/x-kotlin |
| Python | text/x-python |
| Scala | text/x-scala |
Expand Down
82 changes: 5 additions & 77 deletions swiftplugin/swiftplugin/static/css/swiftplugin.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
/* CSS for SwiftPluginXBlock */

.nav-tabs .nav-link {
margin-bottom: -1px;
background: rgba(0, 0, 0, 0.5);
}

.nav-link {
.nav-tabs .nav-link#yoursolution2-tab, .nav-link#empowrsolution-tab {
padding: 8px 16px;
color: #9E9E9E!important;
}
Expand All @@ -14,19 +9,14 @@
--bs-gutter-x: 0!important;
}

.nav-pills .nav-link.active {
.nav-pills#myTab, .nav-link.active#yoursolution2-tab, .nav-link.active#empowrsolution-tab {
background-color: transparent!important;
border-radius: 16px 16px 0 0!important;
font-weight: bold;
color: #424242!important;
}

.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
color: #fff;
background-color: #3D9C06;
}

.nav-link {
.nav-link#yoursolution2-tab, .nav-link#empowrsolution-tab {
display: block;
padding: .5rem 1rem;
color: white;
Expand All @@ -44,72 +34,11 @@ div#code-container-area {
overflow:hidden;
}

.code-instructions-background {
background: #3A3A3A;
}

.code-instructions {
color: white;
}

.tab-content {
}
.code-input {
height: 100%;
padding-left: 0;
padding-right: 0;
}

.code-area {
width: 100%;
resize: none;
border: none;
display: flex;
padding-right: 0;
padding-left: 0;
outline: none;
}

.response-txt {
color: black;
white-space: pre-wrap;
}

.code-row {
width: 100%;
margin-right: 0;
margin-left: 0;
display: flex;
}

.code-container {
max-width: 100%;
width: auto;
display: flex;
height: inherit;
}

.submit-btn {
background: #3D9C06;
border-radius: 6px;
color: white;
min-width: 100px;
border: 0;
}

.button-row {
padding: 8px;
}

.run-btn {
background: #2F75EC;
border-radius: 6px;
margin-left: 16px;
color: white;
border: 0;
min-width: 100px;
}

.code-bottom {
background: none;
height: 30vh;
Expand All @@ -119,7 +48,6 @@ div#code-container-area {

.tab-pane {
min-height: 100px;

}

.instructions-container {
Expand All @@ -135,13 +63,13 @@ div#code-container-area {

}

.btn-primary {
.btn-primary#run-btn, .btn-primary#submit-btn {
color: #fff !important;
background-color: #5c0e81 !important;
border-color: #5c0e81 !important;
}

.btn-primary:hover {
.btn-primary#run-btn:hover, .btn-primary#submit-btn:hover {
background-color: #7730b0 !important;
border-color: #7730b0 !important;
}
Expand Down
44 changes: 25 additions & 19 deletions swiftplugin/swiftplugin/static/js/src/swiftplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function SwiftPluginXBlock(runtime, element) {
url: showButtonsUrl,
data: JSON.stringify({}),
success: function (data) {
console.log(data)
const is_run_hidden = data.show_run_button === false
const is_submit_hidden = data.show_submit_button === false
run_btn.hidden = is_run_hidden
Expand All @@ -104,7 +103,6 @@ function SwiftPluginXBlock(runtime, element) {
url: handlerUrlLanguage,
data: JSON.stringify({}),
success: function (data) {
console.log(data)
init_code_mirror(data.problem_language)
}
});
Expand All @@ -120,7 +118,6 @@ function SwiftPluginXBlock(runtime, element) {
lineWiseCopyCut: true,
autoCloseBrackets: true,
}
console.log(codemirror_config)
var myTextArea = document.getElementById("code-area");
myCodeMirror = CodeMirror(function (elt) {
myTextArea.parentNode.replaceChild(elt, myTextArea);
Expand All @@ -146,29 +143,38 @@ function SwiftPluginXBlock(runtime, element) {
}*/


function updateResponse(response) {
if (response.response.output) {
const compilation_response = response.response.output
let output_response;
if (response.diff) {
const diff_response = response.diff
output_response = compilation_response + '</br>' + diff_response
} else {
output_response = compilation_response
}
document.getElementById('response-txt').innerHTML = output_response;
} else if (response.response.error) {
document.getElementById('response-txt').innerHTML = response.response.error;
function setOutput(response) {
const compilation_response = response.response.output
let color = response.response.success ? "#33691E" : "#B00020"
if (response.response.success) {
document.getElementById('response-txt').innerHTML = compilation_response;
} else if (response.response.diff) {
document.getElementById('response-txt').innerHTML = response.response.diff;
} else {
document.getElementById('response-txt').innerHTML = compilation_response;
}

document.getElementById('response-title').style.color = color;
}

function updateResponse(response) {
if (response.error) {
setError(response.error)
} else {
setOutput(response)
}
}

function setError(error) {
document.getElementById('response-txt').innerHTML = error;
document.getElementById('response-title').style.color = "#B00020";
}

function handleError(response) {
console.log("error")
console.log(response)
const compilation_response = response.response
const diff_response = response.diff
const output_response = compilation_response + '</br>' + diff_response
document.getElementById('response-txt').innerHTML = output_response;
setError(output_response)
}

function updateProblemDescription(response) {
Expand Down
Loading

0 comments on commit e333640

Please sign in to comment.