diff --git a/electron/main/index.ts b/electron/main/index.ts index 79b7e25..21b1207 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -5,6 +5,8 @@ import { autoUpdater } from "electron-updater"; import { release } from "os"; import { join } from "path"; +import { version } from "../../package.json"; + // Disable GPU Acceleration for Windows 7 if (release().startsWith("6.1")) app.disableHardwareAcceleration(); @@ -39,7 +41,7 @@ const indexHtml = join(ROOT_PATH.dist, "index.html"); async function createWindow() { win = new BrowserWindow({ - title: "RunTC", + title: "RunTC - " + version, icon: join(ROOT_PATH.public, "favicon.svg"), autoHideMenuBar: true, webPreferences: { diff --git a/index.html b/index.html index 40a3632..cc3a7d4 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,6 @@ - RunTC
diff --git a/package.json b/package.json index f3ae467..4751c23 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "@vitejs/plugin-react": "^2.0.1", "allotment": "^1.17.0", "await-to-js": "^3.0.0", + "compare-versions": "^5.0.1", "electron": "^20.0.2", "electron-builder": "^23.3.3", "electron-log": "^4.4.8", diff --git a/src/components/sidePanel/testcaseList/SelectTestcaseItem.tsx b/src/components/sidePanel/testcaseList/SelectTestcaseItem.tsx index fb795c2..3b83d02 100644 --- a/src/components/sidePanel/testcaseList/SelectTestcaseItem.tsx +++ b/src/components/sidePanel/testcaseList/SelectTestcaseItem.tsx @@ -36,10 +36,13 @@ const StyledItem = styled.div<{ selected: boolean }>` grid-template-columns: 10px minmax(16px, 1fr) max-content; align-items: center; + height: 40px; + line-height: 40px; + cursor: pointer; border-radius: 6px; margin: 0 10px; - padding: 10px 15px; + padding: 0 15px; ${(props) => props.selected && diff --git a/src/components/testcase/TerminalOutput.tsx b/src/components/testcase/TerminalOutput.tsx index 28e5d85..03bbaa0 100644 --- a/src/components/testcase/TerminalOutput.tsx +++ b/src/components/testcase/TerminalOutput.tsx @@ -26,6 +26,8 @@ const TerminalOutput: FC = ({ content }) => { const term = new Terminal({ fontFamily: "consolas", + convertEol: true, + disableStdin: true, }); const fitAddon = new FitAddon(); diff --git a/src/components/testcase/TestcaseInfo.tsx b/src/components/testcase/TestcaseInfo.tsx index c7d075a..0069915 100644 --- a/src/components/testcase/TestcaseInfo.tsx +++ b/src/components/testcase/TestcaseInfo.tsx @@ -1,11 +1,16 @@ -import { Button, Editable, EditableInput, EditablePreview } from "@chakra-ui/react"; +import { Button, Editable, EditableInput, EditablePreview, useEditableControls } from "@chakra-ui/react"; +import { css } from "@emotion/react"; import styled from "@emotion/styled"; -import { FC } from "react"; +import { FC, ReactNode } from "react"; +import { MdDelete, MdEdit, MdPlayArrow } from "react-icons/md"; import { useRecoilValue } from "recoil"; import useTestcaseCommand from "@/commands/useTestcaseCommand"; import useTestcaseRunner from "@/commands/useTestcaseRunner"; import { testcaseFamily } from "@/states/testcase"; +import { TestcaseResult, testcaseResultFamily } from "@/states/testcaseResult"; + +import { getResultColor, getResultDescription } from "../common/renderResultUtil"; interface TestcaseInfoProps { testcaseId: string; @@ -15,29 +20,110 @@ const TestcaseInfo: FC = ({ testcaseId }) => { const command = useTestcaseCommand(); const runner = useTestcaseRunner(); const testcase = useRecoilValue(testcaseFamily(testcaseId)); + const result = useRecoilValue(testcaseResultFamily(testcaseId)); return ( - command.changeValue(testcaseId, { name })} fontSize={20}> - - - - - + + command.changeValue(testcaseId, { name })} + fontSize={20}> + + + + + + + + + + {getResultDescription(result)} + + + + ); }; export default TestcaseInfo; -const StyledTestcaseInfo = styled.div` +const StyledTestcaseInfo = styled.div``; + +const NameBox = styled.div` + margin-top: 10px; + height: 40px; +`; + +const ActionBox = styled.div` display: flex; - height: 3.5rem; + margin: 0 8px; `; -const Name = styled(Editable)` +const ActionBoxLeft = styled.div` + display: flex; + align-items: center; +`; + +const Result = styled.div<{ status: TestcaseResult }>` + margin-left: 0.8rem; + font-size: 0.85rem; + + ${(props) => css` + color: ${getResultColor(props.status)}; + `} +`; + +const Spacer = styled.div` flex-grow: 1; +`; + +const Name = styled(Editable)` font-weight: 500; align-self: center; margin: 0 10px; `; + +const WithEditButton = ({ children }: { children: ReactNode }) => { + const { isEditing, getEditButtonProps } = useEditableControls(); + + return isEditing ? ( + <> + ) : ( + + {children} + + + ); +}; + +const StyledWithEditButton = styled.div` + display: grid; + grid-template-columns: max-content 20px 1fr; + align-items: center; +`; diff --git a/src/states/executableTarget.ts b/src/states/executableTarget.ts index c82d86b..33576aa 100644 --- a/src/states/executableTarget.ts +++ b/src/states/executableTarget.ts @@ -13,6 +13,8 @@ export const executableTargetFilenameSelector = selector({ return null; } - return path.split("\\").at(-1) ?? null; + const matches = path.match(/.+[\\/\\]([^\\/\\]+)/); + + return matches?.[1] ?? null; }, }); diff --git a/tsconfig.json b/tsconfig.json index 19a99be..e83dda8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,6 +20,7 @@ "noEmit": true, "jsx": "react-jsx" }, + "include": ["src"], "exclude": ["src/**/*.test.ts"], "references": [{ "path": "./tsconfig.node.json" }],