Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings_config: Add hardcoded data structure for playground-info mappings.

Sumanth V Rao36e05ed6def3
diff --git a/static/js/settings_config.js b/static/js/settings_config.js
index 3ccfe2789b1..9f01bc9a680 100644
--- a/static/js/settings_config.js
+++ b/static/js/settings_config.js
@@ -320,3 +320,52 @@ exports.all_notifications = () => ({
enable_online_push_notifications: !page_params.realm_push_notifications_enabled,
},
});
+
+const map_language_to_playground_info = {
+ // TODO: This is being hardcoded just for the prototype, post which we should
+ // add support for realm admins to configure their own choices. The keys here
+ // are the pygment lexer subclass names for the different language alias it
+ // supports.
+ Rust: [
+ {
+ name: "Rust playground",
+ url_prefix: "https://play.rust-lang.org/?code=",
+ },
+ ],
+ Julia: [
+ {
+ name: "Julia playground",
+ url_prefix: "https://repl.it/languages/julia/?code=",
+ },
+ ],
+ Python: [
+ {
+ name: "Python 3 playground",
+ url_prefix: "https://repl.it/languages/python3/?code=",
+ },
+ ],
+ "Python 2.7": [
+ {
+ name: "Python 2.7 playground",
+ url_prefix: "https://repl.it/languages/python/?code=",
+ },
+ ],
+ JavaScript: [
+ {
+ name: "JavaScript playground",
+ url_prefix: "https://repl.it/languages/javascript/?code=",
+ },
+ ],
+ Lean: [
+ {
+ name: "Lean playground",
+ url_prefix: "https://leanprover.github.io/live/latest/#code=",
+ },
+ {
+ name: "Lean community playground",
+ url_prefix: "https://leanprover-community.github.io/lean-web-editor/#code=",
+ },
+ ],
+};
+
+exports.get_playground_info_for_languages = (lang) => map_language_to_playground_info[lang];