From 785fa663e817dd2f58455ee3b968a8c5cc71f483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Preik=C5=A1a?= Date: Mon, 24 Jun 2024 14:57:58 +0300 Subject: [PATCH] feat: styling --- .../displays/extension/FileInstance.tsx | 19 ++- .../displays/extension/WorkspaceInstance.tsx | 141 +++++++++++------- 2 files changed, 104 insertions(+), 56 deletions(-) diff --git a/GUI/front-end/src/components/displays/extension/FileInstance.tsx b/GUI/front-end/src/components/displays/extension/FileInstance.tsx index 19986e7..c9891e3 100644 --- a/GUI/front-end/src/components/displays/extension/FileInstance.tsx +++ b/GUI/front-end/src/components/displays/extension/FileInstance.tsx @@ -45,6 +45,9 @@ const FileInstance: React.FC = () => { data.append('file_name', fileName); await createFile.mutateAsync(data); + + setFile(null); + setFileName(''); } const dataURLtoBlob = (file : string | ArrayBuffer | null) => { @@ -82,7 +85,16 @@ const FileInstance: React.FC = () => { px: '10px', }} > + + {file && fileName && (fileName)} + - {file && fileName && (fileName)} { files?.length > 0 ? ( files.map((file) => ( @@ -115,7 +130,7 @@ const FileInstance: React.FC = () => { await deleteFile.mutateAsync(data); }} > - + )) diff --git a/GUI/front-end/src/components/displays/extension/WorkspaceInstance.tsx b/GUI/front-end/src/components/displays/extension/WorkspaceInstance.tsx index 7e821b2..99c8501 100644 --- a/GUI/front-end/src/components/displays/extension/WorkspaceInstance.tsx +++ b/GUI/front-end/src/components/displays/extension/WorkspaceInstance.tsx @@ -1,4 +1,4 @@ -import { Select, useTheme, styled, MenuItem, TextField, Button, IconButton } from "@mui/material"; +import { Select, useTheme, styled, MenuItem, Button, IconButton, Input, FormControl, InputLabel } from "@mui/material"; import { ArrowDropDown as ArrowDropDownIcon } from '@mui/icons-material/'; import { useLanguageContext } from "../../../contexts"; import { useWorkspaceContext } from "../../../contexts/tool/UseWorkspaceContext"; @@ -15,6 +15,7 @@ const WorkspaceInstance: React.FC = () => { const [awailableWorkspaces, setAwailableWorkspaces] = useState([]); const [newWorkspace, setNewWorkspace] = useState(''); + const [isOpen, setIsOpen] = useState(false); const { data, isLoading, isFetching } = useGetWorkspaces(); const createWorkspace = useCreateWorkspace(); @@ -36,19 +37,33 @@ const WorkspaceInstance: React.FC = () => { return ( <> - setNewWorkspace(e.target.value)} - /> + + {!newWorkspace && + + {languageContext.language === 'en' ? 'Create new workspace' : 'Pridėti darbo aplinką'} + } + setNewWorkspace(e.target.value)} + /> + {awailableWorkspaces.length > 0 && !isFetching && !isLoading && ( <> - workspaceContext.update(e.target.value as string)} + onOpen={() => setIsOpen(true)} + onClose={() => setIsOpen(false)} + > + { + awailableWorkspaces.map((value) => ( + - - - - ))} - + {value} + {isOpen && + { + e.stopPropagation(); + await deleteWorkspace.mutate(value); + workspaceContext.update(''); + }} + > + + + } + + ))} + + )}