Skip to content

Commit

Permalink
style(frontend): remove the welcome message in the code editor (#1324)
Browse files Browse the repository at this point in the history
* style(frontend): remove the welcome message in the code editor

I don't feel like we need this and it can be confusing since there is no file called "welcome". Also, the chat window already has a welcome message.

* lint

* remove empty checks

---------

Co-authored-by: Jim Su <jimsu@protonmail.com>
  • Loading branch information
Sparkier and yimothysu committed Apr 24, 2024
1 parent ab3e186 commit 2472840
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
20 changes: 6 additions & 14 deletions frontend/src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { Tab, Tabs } from "@nextui-org/react";
import type { editor } from "monaco-editor";
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { RootState } from "#/store";
import { selectFile } from "#/services/fileService";
import { setCode } from "#/state/codeSlice";
import { RootState } from "#/store";
import FileExplorer from "./file-explorer/FileExplorer";

function CodeEditor(): JSX.Element {
const [selectedFileName, setSelectedFileName] = useState("welcome");
const [selectedFileName, setSelectedFileName] = useState("");

const dispatch = useDispatch();
const code = useSelector((state: RootState) => state.code.code);
Expand Down Expand Up @@ -60,23 +60,15 @@ function CodeEditor(): JSX.Element {
aria-label="Options"
>
<Tab
key={
selectedFileName === ""
? "Welcome"
: selectedFileName.toLocaleLowerCase()
}
title={!selectedFileName ? "Welcome" : selectedFileName}
key={selectedFileName.toLocaleLowerCase()}
title={selectedFileName}
/>
</Tabs>
<div className="flex grow">
<Editor
height="100%"
path={
selectedFileName === ""
? "welcome.txt"
: selectedFileName.toLocaleLowerCase()
}
defaultValue="# Welcome to OpenDevin!"
path={selectedFileName.toLocaleLowerCase()}
defaultValue=""
value={code}
onMount={handleEditorDidMount}
/>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/state/codeSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IFlatMetadata } from "react-accessible-treeview/dist/TreeView/utils";
import { WorkspaceFile } from "#/services/fileService";

export const initialState = {
code: "# Welcome to OpenDevin!",
code: "",
selectedIds: [] as number[],
workspaceFolder: { name: "" } as WorkspaceFile,
};
Expand Down

0 comments on commit 2472840

Please sign in to comment.