Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

other languages are added to the compiler #132

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"indent": ["error", 2],
// "linebreak-style": ["error", "unix"],
"linebreak-style": ["error", "unix"],
"linebreak-style": 0,
"quotes": ["error", "double"],
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
Expand Down
24 changes: 24 additions & 0 deletions src/components/images/CLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default function CLogo({ width = 40, height = 40 }) {
return (

Check failure on line 2 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 2 spaces but found 4
<svg

Check failure on line 3 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 4 spaces but found 6
xmlns="http://www.w3.org/2000/svg"

Check failure on line 4 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
x="0px"

Check failure on line 5 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
y="0px"

Check failure on line 6 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
width={width}

Check failure on line 7 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
height={height}

Check failure on line 8 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
viewBox="0 0 256 256"

Check failure on line 9 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
>

Check failure on line 10 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 4 spaces but found 6
<g fill="none" stroke="none" strokeWidth="1">

Check failure on line 11 in src/components/images/CLogo.js

View workflow job for this annotation

GitHub Actions / Performs linting on the application

Expected indentation of 6 spaces but found 8
<path
d="M128,0 C198.6,0 256,57.4 256,128 C256,198.6 198.6,256 128,256 C57.4,256 0,198.6 0,128 C0,57.4 57.4,0 128,0 Z"
fill="#A8B9CC"
></path>
<path
d="M166.1,196.7 C178.7,196.7 189.4,192.3 197.9,184.4 C202.5,180.3 202.9,173.4 198.8,168.8 C194.7,164.2 187.8,163.8 183.2,167.9 C177.6,172.8 171.2,175.3 166.2,175.3 C151.6,175.3 139.4,163.2 139.4,148.6 L139.4,107.4 C139.4,92.8 151.6,80.6 166.2,80.6 C171.1,80.6 177.6,83.1 183.2,88.1 C187.8,92.2 194.7,91.8 198.8,87.2 C202.9,82.6 202.5,75.7 197.9,71.6 C189.4,63.7 178.7,59.3 166.1,59.3 C137.8,59.3 114.8,82.3 114.8,110.6 L114.8,145.4 C114.8,173.7 137.8,196.7 166.1,196.7 Z"
fill="#FFFFFF"
></path>
</g>
</svg>
);
}

28 changes: 28 additions & 0 deletions src/components/images/GoLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default function GoLogo({ width = 40, height = 40 }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0 0 256 256"
>
<g fill="none" stroke="none" strokeWidth="1">
<path
d="M128,0 C198.6,0 256,57.4 256,128 C256,198.6 198.6,256 128,256 C57.4,256 0,198.6 0,128 C0,57.4 57.4,0 128,0 Z"
fill="#00ADD8"
></path>
<g transform="translate(55, 90)">
<path
d="M87.9 44c-2.3-3.1-6.2-5-10.6-5-7 0-12.8 5.7-12.8 12.8 0 7 5.7 12.8 12.8 12.8 4.5 0 8.4-2.1 10.6-5.4l-3.2-2.3c-1.6 2.2-4.3 3.6-7.4 3.6-4.8 0-8.7-3.9-8.7-8.7s3.9-8.7 8.7-8.7c3.1 0 5.8 1.5 7.4 3.7l3.2-2.3zm-28.5-5c-7 0-12.8 5.7-12.8 12.8 0 7 5.7 12.8 12.8 12.8 4.5 0 8.4-2.1 10.6-5.4l-3.2-2.3c-1.6 2.2-4.3 3.6-7.4 3.6-4.8 0-8.7-3.9-8.7-8.7s3.9-8.7 8.7-8.7c3.1 0 5.8 1.5 7.4 3.7l3.2-2.3c-2.3-3.2-6.2-5.1-10.6-5.1zm-23.1.5l4.5 12.4 4.5-12.4h4.2l-7.4 19.2h-2.5l-7.4-19.2zM64 52c-.6-2.1-2.6-3.7-5-3.7H53v8h4.5c2.4 0 4.4-1.6 5-3.7v-.6z"
fill="#FFFFFF"
/>
<path
d="M98 61.8l-6.7-2.6.6-1.5 6.7 2.6-.6 1.5zm-7.9-5.7l-6.8-2.5.6-1.5 6.7 2.5-.6 1.5zm1.6-3.9l-6.7-2.6.6-1.5 6.7 2.5-.6 1.6zm-2.8-6.2l-6.8-2.5.6-1.6 6.7 2.5-.6 1.6zm-6.5 17.7l6.8 2.5-.6 1.5-6.7-2.5.5-1.5zm7.9 5.8l6.8 2.5-.6 1.5-6.7-2.5.6-1.5zm2.9 6.2l6.8 2.5-.6 1.6-6.7-2.6.5-1.5zm-1.7 4l6.8 2.5-.6 1.6-6.7-2.5.5-1.6zm-1.7 4l6.8 2.5-.6 1.5-6.7-2.5.5-1.5z"
fill="#FFFFFF"
/>
</g>
</g>
</svg>
);
}

28 changes: 28 additions & 0 deletions src/components/images/PhpLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default function PhpLogo({ width = 40, height = 40 }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width={width}
height={height}
viewBox="0 0 256 256"
>
<g fill="none" stroke="none" strokeWidth="1">
<ellipse cx="128" cy="128" rx="128" ry="70" fill="#8993BE"></ellipse>
<text
x="50%"
y="55%"
dominantBaseline="middle"
textAnchor="middle"
fontFamily="Arial, sans-serif"
fontSize="110"
fill="white"
>
PHP
</text>
</g>
</svg>
);
}

32 changes: 32 additions & 0 deletions src/components/images/RLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default function RLogo({ width = 40, height = 40 }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width={width}
height={height}
viewBox="0 0 256 256"
>
<g fill="none" stroke="none" strokeWidth="1">
<path
d="M128,0 C198.6,0 256,57.4 256,128 C256,198.6 198.6,256 128,256 C57.4,256 0,198.6 0,128 C0,57.4 57.4,0 128,0 Z"
fill="#276DC3"
></path>
<g transform="translate(50, 90)">
<text
x="0"
y="60"
fontSize="100"
fill="white"
fontFamily="Arial, sans-serif"
fontWeight="bold"
>
R
</text>
</g>
</g>
</svg>
);
}

24 changes: 24 additions & 0 deletions src/components/images/RubyLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export default function RubyLogo({ width = 40, height = 40 }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width={width}
height={height}
viewBox="0 0 256 256"
>
<g fill="none" stroke="none" strokeWidth="1">
<path
d="M128,0 C198.6,0 256,57.4 256,128 C256,198.6 198.6,256 128,256 C57.4,256 0,198.6 0,128 C0,57.4 57.4,0 128,0 Z"
fill="#CC342D"
></path>
<polygon
fill="white"
points="128,50 164,128 92,128 128,50"
></polygon>
</g>
</svg>
);
}

28 changes: 28 additions & 0 deletions src/components/images/TypescriptLogo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default function TypescriptLogo({ width = 40, height = 40 }) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
x="0px"
y="0px"
width={width}
height={height}
viewBox="0 0 256 256"
>
<g fill="none" stroke="none" strokeWidth="1">
<rect width="256" height="256" fill="#007ACC"></rect>
<text
x="50%"
y="50%"
dominantBaseline="middle"
textAnchor="middle"
fontFamily="Arial, sans-serif"
fontSize="100"
fill="white"
>
TS
</text>
</g>
</svg>
);
}

65 changes: 65 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import CppLogo from "../components/images/CppLogo";
import JavaLogo from "../components/images/JavaLogo";
import JavascriptLogo from "../components/images/JavaScriptLogo";
import PythonLogo from "../components/images/PythonLogo";
import CLogo from "../components/images/CLogo";
import GoLogo from "../components/images/GoLogo";
import PhpLogo from "../components/images/PhpLogo";
import RLogo from "../components/images/RLogo";
import RubyLogo from "../components/images/RubyLogo";
import TypescriptLogo from "../components/images/TypescriptLogo";

export const judge0SubmitUrl =
process.env.JUDGE0_SUMBISSION_URL || process.env.REACT_APP_RAPID_API_URL;
Expand All @@ -12,6 +18,13 @@ export const LANGUAGE_ID_FOR_JAVASCRIPT = 63;
export const LANGUAGE_ID_FOR_PYTHON3 = 71;
export const LANGUAGE_ID_FOR_CPP = 76;
export const LANGUAGE_ID_FOR_JAVA = 62;
export const LANGUAGE_ID_FOR_C = 103;
export const LANGUAGE_ID_FOR_GO = 95;
export const LANGUAGE_ID_FOR_PHP = 98;
export const LANGUAGE_ID_FOR_R = 99;
export const LANGUAGE_ID_FOR_RUBY = 72;
export const LANGUAGE_ID_FOR_TYPESCRIPT = 101;


export const LANGUAGES = [
{
Expand Down Expand Up @@ -54,6 +67,58 @@ int main(){
}
}`,
},
{
ID: LANGUAGE_ID_FOR_C,
NAME: "C",
DEFAULT_LANGUAGE: "C (gcc 9.3.0)",
LOGO: <CLogo />,
HELLO_WORLD: `#include <stdio.h>
int main() {
printf("Hello World\\n");
return 0;
}`,
},
{
ID: LANGUAGE_ID_FOR_GO,
NAME: "Go",
DEFAULT_LANGUAGE: "go",
LOGO: <GoLogo />,
HELLO_WORLD: `package main
import "fmt"
func main() {
fmt.Println("Hello World")
}`,
},
{
ID: LANGUAGE_ID_FOR_PHP,
NAME: "PHP",
DEFAULT_LANGUAGE: "php",
LOGO: <PhpLogo />,
HELLO_WORLD: `<?php
echo "Hello World";
?>`,
},
{
ID: LANGUAGE_ID_FOR_R,
NAME: "R",
DEFAULT_LANGUAGE: "R",
LOGO: <RLogo />,
HELLO_WORLD: `cat("Hello World\\n")`,
},
{
ID: LANGUAGE_ID_FOR_RUBY,
NAME: "Ruby",
DEFAULT_LANGUAGE: "ruby",
LOGO: <RubyLogo />,
HELLO_WORLD: `puts 'Hello World'`,
},
{
ID: LANGUAGE_ID_FOR_TYPESCRIPT,
NAME: "TypeScript",
DEFAULT_LANGUAGE: "typescript",
LOGO: <TypescriptLogo />,
HELLO_WORLD: `console.log("Hello World")`,
},
];

export const EDITOR_THEMES = [
Expand Down