Skip to content

Commit

Permalink
Merge pull request #38 from vedant-jain03/dockerization
Browse files Browse the repository at this point in the history
dockerization
  • Loading branch information
vedant-jain03 authored Jun 3, 2023
2 parents d6eda15 + 14f3224 commit 7d74dbb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:16-alpine
WORKDIR /app
COPY . .
RUN npm i -f
CMD [ "npm", "start" ]
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
server:
build: .
ports:
- 8000:8000
26 changes: 13 additions & 13 deletions src/pages/EditorPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function EditorPage() {
const [access, setAccess] = useState(false);
const [terminal, setTerminal] = useState(false);
const [output, setOutput] = useState("");
const [editorOpen, setEditorOpen] = useState(true);
const [editorOpen, setEditorOpen] = useState(false);
const [input, setInput] = useState("");
const [langCode, setLangCode] = useState("52");
const handleChat = (e) => {
Expand Down Expand Up @@ -115,17 +115,17 @@ function EditorPage() {
const element = document.createElement("a");
const file = new Blob([liveCode], { type: 'text/plain' });
element.href = URL.createObjectURL(file);
const options = {
method: 'GET',
url: `https://judge0-ce.p.rapidapi.com/languages/${langCode}`,
headers: {
'X-RapidAPI-Key': `${process.env.REACT_APP_RAPID_API_KEY}`,
'X-RapidAPI-Host': 'judge0-ce.p.rapidapi.com'
}
};
// const options = {
// method: 'GET',
// url: `https://judge0-ce.p.rapidapi.com/languages/${langCode}`,
// headers: {
// 'X-RapidAPI-Key': `${process.env.REACT_APP_RAPID_API_KEY}`,
// 'X-RapidAPI-Host': 'judge0-ce.p.rapidapi.com'
// }
// };

const res = (await axios.request(options)).data;
element.download = res.source_file;
// const res = (await axios.request(options)).data;
element.download = 'main.txt';
document.body.appendChild(element);
element.click();
};
Expand Down Expand Up @@ -214,9 +214,9 @@ function EditorPage() {
{editorOpen && <Terminal output={output} terminal={terminal} setEditorOpen={setEditorOpen} setInput={setInput} input={input} />}
</div>
{
(clients.length !== 0 && clients[0].username === location.state.username && <button className='btn doubtBtn' style={{ right: '415px' }} onClick={lockAccess} >{access ? 'Lock' : 'Unlock'} Editor</button>)
(clients.length !== 0 && clients[0].username === location.state.username && <button className='btn doubtBtn' style={{ right: '300px' }} onClick={lockAccess} >{access ? 'Lock' : 'Unlock'} Editor</button>)
}
<button className='btn doubtBtn' style={{ right: '300px' }} onClick={() => runCode()} >Run Code</button>
{/* <button className='btn doubtBtn' style={{ right: '300px' }} onClick={() => runCode()} >Run Code</button> */}
<button className='btn doubtBtn' style={{ right: '140px' }} onClick={downloadTxtFile}>Download Code</button>
<button className='btn doubtBtn' onClick={handleChat}>Ask a doubt? </button>
{isChatShown && <DoubtSection status={setChatShown} setDoubt={setDoubt} doubt={doubt} askDoubt={askDoubt} allDoubts={allDoubts} />}
Expand Down

0 comments on commit 7d74dbb

Please sign in to comment.