From eb7703a44eac1e9f6582ba222a33e18a49638ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20B=C3=A4uerle?= Date: Tue, 30 Apr 2024 09:34:23 -0700 Subject: [PATCH] feat(frontend): add empty states to all tabs according to Figma (#1456) * feat(frontend): add empty states to all tabs according to Figma * import order --------- Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com> --- frontend/src/components/Browser.tsx | 33 ++++++++++---------------- frontend/src/components/CodeEditor.tsx | 27 ++++++++++++++------- frontend/src/components/Planner.tsx | 10 ++++++-- frontend/src/i18n/translation.json | 12 ++++++++++ 4 files changed, 51 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/Browser.tsx b/frontend/src/components/Browser.tsx index f56f7b4d26..d3fe8ad28c 100644 --- a/frontend/src/components/Browser.tsx +++ b/frontend/src/components/Browser.tsx @@ -1,25 +1,13 @@ import React from "react"; +import { useTranslation } from "react-i18next"; +import { IoIosGlobe } from "react-icons/io"; import { useSelector } from "react-redux"; -import { HiOutlineMagnifyingGlass } from "react-icons/hi2"; -import { HiCursorClick } from "react-icons/hi"; +import { I18nKey } from "#/i18n/declaration"; import { RootState } from "#/store"; -import logo from "../assets/logo.png"; - -function BlankPage(): JSX.Element { - return ( -
- Blank Page -
- - OpenDevin: Code Less, Make More. - -
-
- ); -} - function Browser(): JSX.Element { + const { t } = useTranslation(); + const { url, screenshotSrc } = useSelector( (state: RootState) => state.browser, ); @@ -30,15 +18,18 @@ function Browser(): JSX.Element { : `data:image/png;base64,${screenshotSrc || ""}`; return ( -
-
+
+
{url}
-
+
{screenshotSrc ? ( Browser Screenshot ) : ( - +
+ + {t(I18nKey.BROWSER$EMPTY_MESSAGE)} +
)}
diff --git a/frontend/src/components/CodeEditor.tsx b/frontend/src/components/CodeEditor.tsx index 17286b5cf4..8190c8c580 100644 --- a/frontend/src/components/CodeEditor.tsx +++ b/frontend/src/components/CodeEditor.tsx @@ -2,13 +2,17 @@ import Editor, { Monaco } from "@monaco-editor/react"; import { Tab, Tabs } from "@nextui-org/react"; import type { editor } from "monaco-editor"; import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { VscCode } from "react-icons/vsc"; import { useDispatch, useSelector } from "react-redux"; +import { I18nKey } from "#/i18n/declaration"; 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 { t } = useTranslation(); const [selectedFileName, setSelectedFileName] = useState(""); const dispatch = useDispatch(); @@ -64,14 +68,21 @@ function CodeEditor(): JSX.Element { title={selectedFileName} /> -
- +
+ {selectedFileName === "" ? ( +
+ + {t(I18nKey.CODE_EDITOR$EMPTY_MESSAGE)} +
+ ) : ( + + )}
diff --git a/frontend/src/components/Planner.tsx b/frontend/src/components/Planner.tsx index bb6afb76d4..c7f41919e7 100644 --- a/frontend/src/components/Planner.tsx +++ b/frontend/src/components/Planner.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { useTranslation } from "react-i18next"; import { FaCheckCircle, FaQuestionCircle, @@ -7,7 +8,9 @@ import { FaRegClock, FaRegTimesCircle, } from "react-icons/fa"; +import { VscListOrdered } from "react-icons/vsc"; import { useSelector } from "react-redux"; +import { I18nKey } from "#/i18n/declaration"; import { Plan, Task, TaskState } from "#/services/planService"; import { RootState } from "#/store"; @@ -55,10 +58,13 @@ interface PlanProps { } function PlanContainer({ plan }: PlanProps): JSX.Element { + const { t } = useTranslation(); + if (plan.mainGoal === undefined) { return ( -
- Nothing is currently planned. Start a task for this to change. +
+ + {t(I18nKey.PLANNER$EMPTY_MESSAGE)}
); } diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.json index 953c14d8cf..e784989dbb 100644 --- a/frontend/src/i18n/translation.json +++ b/frontend/src/i18n/translation.json @@ -328,5 +328,17 @@ "SETTINGS$API_KEY_PLACEHOLDER": { "en": "Enter your API key.", "de": "Model API key." + }, + "CODE_EDITOR$EMPTY_MESSAGE": { + "en": "No file selected.", + "de": "Keine Datei ausgewählt." + }, + "BROWSER$EMPTY_MESSAGE": { + "en": "No page loaded.", + "de": "Keine Seite geladen." + }, + "PLANNER$EMPTY_MESSAGE": { + "en": "No plan created.", + "de": "Kein Plan erstellt." } }