Skip to content

Commit

Permalink
Merge pull request #115 from CS3219-AY2425S1/apiTest_XL
Browse files Browse the repository at this point in the history
Make changes to outputWindow
  • Loading branch information
iynixil authored Nov 13, 2024
2 parents 66a178d + d4deb25 commit e67c43e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 35 deletions.
1 change: 0 additions & 1 deletion backend/collaboration-service/handler/socketHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const handleSocketIO = (apiGatewaySocket) => {
activeUserInRoom[roomId] - 1
);

console.log("HELP", activeUserInRoom[roomId]);
setTimeout(() => {
if (!isRefreshOrClose) { //reconnected
activeUserInRoom[roomId] += 1;
Expand Down
32 changes: 11 additions & 21 deletions frontend/src/components/OutputWindow.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import "./styles/OutputWindow.css";

const OutputWindow = ({ outputDetails }) => {
const getOutput = () => {
let statusId = outputDetails?.status?.id;

if (statusId === 6) {
// Compilation error
return (
<pre style={{ padding: "8px", fontSize: "12px", color: "red" }}>
<pre className="output-text error-text">
{atob(outputDetails?.compile_output)}
</pre>
);
} else if (statusId === 3) {
return (
<pre style={{ padding: "8px", fontSize: "12px", color: "green" }}>
<pre className="output-text success-text">
{outputDetails.stdout
? `${atob(outputDetails.stdout)}`
: "Compiled successfully"}
</pre>
);
} else if (statusId === 5) {
return (
<pre style={{ padding: "8px", fontSize: "12px", color: "red" }}>
{`Time Limit Exceeded`}
</pre>
<pre className="output-text error-text">{`Time Limit Exceeded`}</pre>
);
} else {
return (
<pre style={{ padding: "8px", fontSize: "12px", color: "red" }}>
<pre className="output-text error-text">
{atob(outputDetails?.stderr)}
</pre>
);
Expand All @@ -34,21 +34,11 @@ const OutputWindow = ({ outputDetails }) => {

return (
<>
<h1 style={{ fontWeight: "bold", fontSize: "24px", marginBottom: "8px" }}>
Output
</h1>
<div
style={{
width: "100%",
height: "220px",
backgroundColor: "#1e293b",
borderRadius: "8px",
color: "white",
overflowY: "auto",
padding: "8px",
}}
>
{outputDetails ? <>{getOutput()}</> : null}
<div className="output-window">
<h1 className="output-title">Output</h1>
<div className="output-container">
{outputDetails ? getOutput() : null}
</div>
</div>
</>
);
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/components/styles/CodeEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,3 @@
#codeButton:active {
background-color: #e0e0e0;
}

#outputWindow {
background-color: #f9f9f9; /* Light grey background for output */
border: 1px solid #ccc;
border-radius: 5px;
padding: 15px;
margin-top: 20px;
font-family: monospace; /* Use a monospace font for code output */
white-space: pre-wrap; /* Preserve whitespace */
max-height: 400px; /* Limit height for scrolling */
overflow-y: auto; /* Add scrollbar if content overflows */
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}
28 changes: 28 additions & 0 deletions frontend/src/components/styles/OutputWindow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.output-title {
font-weight: bold;
font-size: 24px;
margin-bottom: 8px;
}

.output-container {
border: 2px solid var(--sds-color-border-default-default);
height: 220px;
background-color: #1e293b;
border-radius: 8px;
color: white;
overflow-y: auto;
padding: 8px;
}

.output-text {
padding: 8px;
font-size: 12px;
}

.success-text {
color: green;
}

.error-text {
color: red;
}

0 comments on commit e67c43e

Please sign in to comment.