Skip to content

Commit e7ffc21

Browse files
committed
chore(types): add type.ts files for all interfaces to enforce consistency
- Centralize all TypeScript interfaces and types across the project. - Ensure consistent typing and improve maintainability throughout the codebase.
1 parent cfc0b64 commit e7ffc21

17 files changed

+161
-67
lines changed

frontend/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ If you are developing a production application, we recommend updating the config
1313

1414
```js
1515
export default tseslint.config([
16-
globalIgnores(['dist']),
16+
globalIgnores(["dist"]),
1717
{
18-
files: ['**/*.{ts,tsx}'],
18+
files: ["**/*.{ts,tsx}"],
1919
extends: [
2020
// Other configs...
2121

@@ -30,40 +30,40 @@ export default tseslint.config([
3030
],
3131
languageOptions: {
3232
parserOptions: {
33-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
33+
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
3434
tsconfigRootDir: import.meta.dirname,
3535
},
3636
// other options...
3737
},
3838
},
39-
])
39+
]);
4040
```
4141

4242
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
4343

4444
```js
4545
// eslint.config.js
46-
import reactX from 'eslint-plugin-react-x'
47-
import reactDom from 'eslint-plugin-react-dom'
46+
import reactX from "eslint-plugin-react-x";
47+
import reactDom from "eslint-plugin-react-dom";
4848

4949
export default tseslint.config([
50-
globalIgnores(['dist']),
50+
globalIgnores(["dist"]),
5151
{
52-
files: ['**/*.{ts,tsx}'],
52+
files: ["**/*.{ts,tsx}"],
5353
extends: [
5454
// Other configs...
5555
// Enable lint rules for React
56-
reactX.configs['recommended-typescript'],
56+
reactX.configs["recommended-typescript"],
5757
// Enable lint rules for React DOM
5858
reactDom.configs.recommended,
5959
],
6060
languageOptions: {
6161
parserOptions: {
62-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
62+
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
6363
tsconfigRootDir: import.meta.dirname,
6464
},
6565
// other options...
6666
},
6767
},
68-
])
68+
]);
6969
```

frontend/package-lock.json

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "frontend",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.0.1-beta.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -22,6 +22,7 @@
2222
"clsx": "^2.1.1",
2323
"js-yaml": "^4.1.0",
2424
"lucide-react": "^0.542.0",
25+
"openapi-types": "^12.1.3",
2526
"react": "^19.1.1",
2627
"react-dom": "^19.1.1",
2728
"react-hook-form": "^7.62.0",

frontend/src/App.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import './App.css'
2-
import { FileProvider } from './context/fileContext'
3-
import { LoadingProvider } from './context/LoadingContext'
4-
import { OpenApiProvider } from './context/openApiContext'
5-
import { TerminalProvider } from './context/TerminalContext'
2+
import Navbar01 from './components/ui/navbar'
3+
import { FileProvider } from './context/FileProvider'
4+
import { LoadingProvider } from './context/LoadingProvider'
5+
import { OpenApiProvider } from './context/openApiProvider'
6+
import { TerminalProvider } from './context/TerminalProvider'
7+
import { TestRunnerProvider } from './context/TestRunnerProvider'
68
import Dashboard from './features/dashboard'
79
import SchemaPage from './features/schema-input'
810
import TestDetailsPane from './features/test-details'
911
import TestRunner from './features/test-runner'
10-
import { TestRunnerProvider } from './features/test-runner/TestRunnerContext'
1112
function App() {
1213
return (
1314
<>
@@ -16,6 +17,7 @@ function App() {
1617
<FileProvider>
1718
<TerminalProvider>
1819
<LoadingProvider>
20+
<Navbar01 />
1921
<SchemaPage />
2022
<TestDetailsPane />
2123
<TestRunner />

frontend/src/components/TerminalView.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useRef } from "react";
22
import { Terminal } from "xterm";
33
import "xterm/css/xterm.css";
44
import { useWebSocket } from "../hooks/useWebSocket";
5-
import { useTerminal } from "@/context/TerminalContext";
5+
import { useTerminal } from "@/hooks/useTerminal";
66

77
export default function TerminalView() {
88
const terminalRef = useRef<HTMLDivElement | null>(null);
@@ -22,8 +22,7 @@ export default function TerminalView() {
2222
theme: {
2323
background: "#0f0f1f", // dark background
2424
foreground: "#00ffff", // neon cyan text
25-
cursor: "#00ffff", // neon cursor
26-
selection: "rgba(0, 255, 255, 0.3)" // translucent selection
25+
cursor: "#00ffff", // neon cursor
2726
}
2827
});
2928

@@ -43,9 +42,9 @@ export default function TerminalView() {
4342
if (!xtermRef.current) return;
4443

4544
if (error) {
46-
xtermRef.current.writeln(`Connection failed: ${error.message}`);
45+
xtermRef.current.writeln(`Connection failed: ${error.message}`);
4746
} else if (isConnected) {
48-
xtermRef.current.writeln("Connected to backend!");
47+
xtermRef.current.writeln("Connected to backend!");
4948
}
5049
// Print the last message from the server
5150
if (messages.length > 0) {
Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
11
import * as React from "react"
22
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
3+
import { type VariantProps } from "class-variance-authority"
44

55
import { cn } from "@/lib/utils"
6+
import { buttonVariants } from "./button/buttonVariants"
67

7-
const buttonVariants = cva(
8-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9-
{
10-
variants: {
11-
variant: {
12-
default:
13-
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
14-
destructive:
15-
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
16-
outline:
17-
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
18-
secondary:
19-
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
20-
ghost:
21-
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
22-
link: "text-primary underline-offset-4 hover:underline",
23-
},
24-
size: {
25-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
26-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
27-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
28-
icon: "size-9",
29-
},
30-
},
31-
defaultVariants: {
32-
variant: "default",
33-
size: "default",
34-
},
35-
}
36-
)
378

389
function Button({
3910
className,
@@ -56,4 +27,4 @@ function Button({
5627
)
5728
}
5829

59-
export { Button, buttonVariants }
30+
export { Button }
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { cva } from "class-variance-authority";
2+
const buttonVariants = cva(
3+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
4+
{
5+
variants: {
6+
variant: {
7+
default:
8+
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
9+
destructive:
10+
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
11+
outline:
12+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
13+
secondary:
14+
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
15+
ghost:
16+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
17+
link: "text-primary underline-offset-4 hover:underline",
18+
},
19+
size: {
20+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
21+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
22+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
23+
icon: "size-9",
24+
},
25+
},
26+
defaultVariants: {
27+
variant: "default",
28+
size: "default",
29+
},
30+
}
31+
);
32+
export { buttonVariants };
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
3+
const Navbar01: React.FC = () => {
4+
return (
5+
6+
7+
<nav className="bg-white dark:bg-gray-900 w-full z-20 top-0 start-0 border-b border-gray-200 dark:border-gray-600">
8+
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
9+
<a href="https://flowbite.com/" className="flex items-center space-x-3 rtl:space-x-reverse">
10+
<img src="https://flowbite.com/docs/images/logo.svg" className="h-8" alt="Flowbite Logo" />
11+
<span className="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
12+
</a>
13+
<div className="flex md:order-2 space-x-3 md:space-x-0 rtl:space-x-reverse">
14+
<button type="button" className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Get started</button>
15+
<button data-collapse-toggle="navbar-sticky" type="button" className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-sticky" aria-expanded="false">
16+
<span className="sr-only">Open main menu</span>
17+
<svg className="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
18+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15" />
19+
</svg>
20+
</button>
21+
</div>
22+
<div className="items-center justify-between hidden w-full md:flex md:w-auto md:order-1" id="navbar-sticky">
23+
<ul className="flex flex-col p-4 md:p-0 mt-4 font-medium border border-gray-100 rounded-lg bg-gray-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
24+
<li>
25+
<a href="#" className="block py-2 px-3 text-white bg-blue-700 rounded-sm md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500" aria-current="page">Home</a>
26+
</li>
27+
<li>
28+
<a href="#" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">About</a>
29+
</li>
30+
<li>
31+
<a href="#" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">Services</a>
32+
</li>
33+
<li>
34+
<a href="#" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">Contact</a>
35+
</li>
36+
</ul>
37+
</div>
38+
</div>
39+
</nav>
40+
41+
);
42+
};
43+
44+
export default Navbar01;
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
.schema_page {
2-
height: 80vh;
3-
.activity_area {
4-
display: grid;
5-
grid-template-columns: repeat(2, 1fr);
2+
height: 80vh;
3+
.activity_area {
4+
display: grid;
5+
grid-template-columns: repeat(2, 1fr);
66

7-
&>div {
8-
&:nth-child(2) {
9-
display: grid;
10-
}
11-
}
7+
& > div {
8+
&:nth-child(2) {
9+
display: grid;
10+
}
1211
}
13-
14-
}
12+
}
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type EndpointRow = {
2+
method: string;
3+
path: string;
4+
summary: string;
5+
responses: string;
6+
};

0 commit comments

Comments
 (0)