Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3192462

Browse files
bugs fixed
1 parent 6910d6f commit 3192462

File tree

8 files changed

+42
-7
lines changed

8 files changed

+42
-7
lines changed

‎public/favicon.ico‎

0 Bytes
Binary file not shown.

‎src/components/fileEditor/FileEditor.tsx‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
import Editor from "@monaco-editor/react";
22
import styles from "./FileEditor.module.css";
3-
import { FC, useRef, useContext } from "react";
3+
import { FC, useRef, useContext,useEffect,useState } from "react";
44
import EditorBar from "../editorBar";
55
import { AppContext } from "../context";
66

77
const FileEditor: FC = () => {
88
const { username, editorState, code, setCode, io } = useContext(AppContext);
99
const editorRef = useRef();
10+
const monacoRef = useRef();
11+
const [lang, setLang] = useState("text");
12+
13+
const languages = {
14+
html: "html",
15+
css: "css",
16+
js: "javascript",
17+
ts: "typescript",
18+
htm: "html",
19+
txt: "text",
20+
json: "json",
21+
md: "markdown",
22+
py: "python",
23+
cpp: "cpp",
24+
sass: "sass",
25+
scss: "scss",
26+
java: "java",
27+
less: "less",
28+
xml: "xml",
29+
};
1030

1131
function handleEditorChange(value: string | undefined, e: any) {
1232
if (editorState.activeTab) {
@@ -20,15 +40,26 @@ const FileEditor: FC = () => {
2040

2141
function handleEditorDidMount(editor: any, monaco: any) {
2242
editorRef.current = editor;
43+
monacoRef.current = monaco;
2344
}
2445

46+
useEffect(() => {
47+
setTimeout(() => {
48+
// @ts-ignore
49+
setLang(languages[editorState.activeTab.split(".").pop()] || "text");
50+
}, 1500);
51+
// eslint-disable-next-line react-hooks/exhaustive-deps
52+
}, [editorState.activeTab]);
53+
2554
return (
2655
<div className={styles.container}>
2756
<EditorBar />
2857
<div className={styles.editor__wrapper}>
2958
<Editor
3059
theme="vs-dark"
3160
height="100%"
61+
language={lang}
62+
// language={editorState.activeTab.split(".").pop()}
3263
value={code[editorState.activeTab]}
3364
onChange={handleEditorChange}
3465
onMount={handleEditorDidMount}

‎src/components/fileExplorer/FileExplorer.module.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.explorer__container {
22
height: 100%;
33
width: 100%;
4+
min-width: 200px;
45
display: flex;
56
flex-direction: column;
67
background: #1e1e1e;

‎src/components/fileExplorer/FileExplorer.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const FileExplorer: FC = () => {
2929
args.activeTab = args.tabs[0] === undefined ? "" : args.tabs[0];
3030
const newCode = code;
3131
delete newCode[filename];
32-
console.log("nc>", newCode, filename);
3332
setCode({ ...newCode });
3433
setEditorState((prev) => ({ ...prev, ...args }));
3534
io.current?.emit("delete_file", username, filename);
@@ -40,6 +39,10 @@ const FileExplorer: FC = () => {
4039
if (e.isTrusted) {
4140
const filename = prompt("Enter filename");
4241
if (!filename) return;
42+
if (editorState.files.includes(filename)) {
43+
alert(`File ${filename} already exists!`);
44+
return;
45+
}
4346
const args: any = {};
4447
args.tabs = [...editorState.tabs, filename];
4548
args.files = [...editorState.files, filename];

‎src/components/webRender/WebRender.module.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
.web__wrapper {
2424
width: 100%;
2525
height: 100%;
26-
background: #dddddd;
26+
background: #ffffff;
2727
}
2828

2929
.iframe {

‎src/components/xTerminal/XTerminal.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const XTerminal: React.FC = () => {
118118
return (
119119
<div className={styles.terminal__container}>
120120
<div className={styles.terminal__bar}>
121-
<div className="t-left">Terminal Session of {username}</div>
121+
<div className="t-left">Terminal Session of @{username}</div>
122122
<div className="t-right">🚀</div>
123123
</div>
124124
<div className={styles.terminal__wrapper} ref={terminalRef}>

‎src/config/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const env = {
2-
SERVER_URL: "http://localhost:4000",
3-
SOCKET_URL: "http://localhost:4000",
2+
SERVER_URL: "http://localhost:80",
3+
SOCKET_URL: "http://localhost:80",
44
};
55

66
export const { SERVER_URL, SOCKET_URL } = env;

‎src/pages/playground/PlaygroundPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const PlaygroundPage: FC = () => {
5151
<ReflexContainer orientation="horizontal">
5252
<ReflexElement className="top-pane">
5353
<ReflexContainer orientation="vertical">
54-
<ReflexElement className="left-pane" minSize={50}>
54+
<ReflexElement className="left-pane" flex={0.26}minSize={50}>
5555
<div className={styles.container}>
5656
<Panel />
5757
<FileExplorer />

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /