Skip to content

Commit 6a745fe

Browse files
gwleclercclaude
andcommitted
feat(client): modernize frontend to Vite, React 19 and a maintained stack
Full frontend overhaul with the HTTP API the client consumes kept identical. Build/tooling: - Parcel -> Vite 8 (Go index.html template + ./assets/ layout preserved) - yarn -> npm; TypeScript -> 7; ESLint -> oxlint (typescript-eslint is incompatible with the native TS compiler); Jest -> Vitest; Node 24 - pin exact dependency versions Libraries: - redux + redux-observable + rxjs + io-ts/fp-ts -> TanStack Query + zod - React 16 -> 19 (createRoot), react-router 5 -> 7, antd 4 -> 6, CodeMirror 5 -> 6, mermaid 8 -> 11, lodash -> es-toolkit - drop axios and react-hot-loader Verified: tsc --noEmit, vite build, vitest, oxlint all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8b70b6a commit 6a745fe

39 files changed

Lines changed: 7210 additions & 11651 deletions

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.DS_Store
2-
.parcel-cache/
32
.vscode/
43
build/
54
coverage/
@@ -8,4 +7,6 @@ sessions
87
!tests/sessions
98
smocker
109
smocker.test
11-
yarn-error.log
10+
# Playwright E2E artifacts
11+
test-results/
12+
playwright-report/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
24

client/components/App.tsx

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
import { GithubFilled, ReadOutlined } from "@ant-design/icons";
22
import { Layout } from "antd";
3-
import * as React from "react";
4-
import { hot } from "react-hot-loader";
5-
import { Provider } from "react-redux";
6-
import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom";
7-
import { applyMiddleware, createStore } from "redux";
8-
import { composeWithDevTools } from "redux-devtools-extension";
9-
import { createEpicMiddleware } from "redux-observable";
10-
import { Actions } from "../modules/actions";
11-
import rootEpic from "../modules/epics";
12-
import rootReducer from "../modules/reducers";
3+
import "antd/dist/reset.css";
4+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5+
import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
6+
import { SessionProvider } from "../modules/session";
137
import "./App.scss";
148
import History from "./History";
159
import Mocks from "./Mocks";
1610
import Navbar from "./Navbar";
1711
import Sidebar from "./Sidebar";
1812
import Visualize from "./Visualize";
1913

20-
const epicMiddleware = createEpicMiddleware<Actions>();
21-
22-
const store = createStore(
23-
rootReducer,
24-
composeWithDevTools(applyMiddleware(epicMiddleware))
25-
);
26-
27-
epicMiddleware.run(rootEpic);
14+
const queryClient = new QueryClient({
15+
defaultOptions: {
16+
queries: {
17+
refetchOnWindowFocus: false,
18+
retry: false,
19+
},
20+
},
21+
});
2822

2923
const App = () => (
30-
<Provider store={store}>
31-
<BrowserRouter basename={window.basePath}>
32-
<Layout className="layout">
33-
<Navbar />
24+
<QueryClientProvider client={queryClient}>
25+
<SessionProvider>
26+
<BrowserRouter basename={window.basePath}>
3427
<Layout className="layout">
35-
<Sidebar />
36-
<Layout className="scrollable layout">
37-
<Layout.Content className="not-scrollable">
38-
<Switch>
39-
<Route exact path="/pages/history" component={History} />
40-
<Route exact path="/pages/mocks" component={Mocks} />
41-
<Route exact path="/pages/mocks/:mock_id" component={Mocks} />
42-
<Route exact path="/pages/visualize" component={Visualize} />
43-
<Redirect to="/pages/history" />
44-
</Switch>
45-
</Layout.Content>
46-
<Layout.Footer style={{ textAlign: "center" }}>
47-
Smocker version {window.version} &ndash; MIT Licensed
48-
<br />
49-
<a
50-
href="https://github.com/smocker-dev/smocker"
51-
title="Smocker on GitHub"
52-
target="_blank"
53-
rel="noreferrer"
54-
>
55-
<GithubFilled />
56-
</a>
57-
&nbsp;
58-
<a
59-
href="https://smocker.dev"
60-
title="Smocker Documentation"
61-
target="_blank"
62-
rel="noreferrer"
63-
>
64-
<ReadOutlined />
65-
</a>
66-
</Layout.Footer>
28+
<Navbar />
29+
<Layout className="layout">
30+
<Sidebar />
31+
<Layout className="scrollable layout">
32+
<Layout.Content className="not-scrollable">
33+
<Routes>
34+
<Route path="/pages/history" element={<History />} />
35+
<Route path="/pages/mocks" element={<Mocks />} />
36+
<Route path="/pages/mocks/:mock_id" element={<Mocks />} />
37+
<Route path="/pages/visualize" element={<Visualize />} />
38+
<Route
39+
path="*"
40+
element={<Navigate to="/pages/history" replace />}
41+
/>
42+
</Routes>
43+
</Layout.Content>
44+
<Layout.Footer style={{ textAlign: "center" }}>
45+
Smocker version {window.version} &ndash; MIT Licensed
46+
<br />
47+
<a
48+
href="https://github.com/smocker-dev/smocker"
49+
title="Smocker on GitHub"
50+
target="_blank"
51+
rel="noreferrer"
52+
>
53+
<GithubFilled />
54+
</a>
55+
&nbsp;
56+
<a
57+
href="https://smocker.dev"
58+
title="Smocker Documentation"
59+
target="_blank"
60+
rel="noreferrer"
61+
>
62+
<ReadOutlined />
63+
</a>
64+
</Layout.Footer>
65+
</Layout>
6766
</Layout>
6867
</Layout>
69-
</Layout>
70-
</BrowserRouter>
71-
</Provider>
68+
</BrowserRouter>
69+
</SessionProvider>
70+
</QueryClientProvider>
7271
);
73-
export default hot(module)(App);
72+
73+
export default App;

client/components/Code.scss

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
.code-editor {
2-
.CodeMirror {
3-
position: relative;
2+
border-radius: 3px;
3+
overflow: hidden;
4+
5+
.cm-editor {
46
height: auto;
5-
overflow-y: hidden;
6-
padding: 0.5em 0 0.5em 0.5em;
7-
margin: 0;
7+
padding: 0.5em 0 0.5em 0;
88
border-radius: 3px;
99

10-
.CodeMirror-scroll {
10+
.cm-scroller {
1111
height: auto;
12+
overflow-y: hidden;
13+
font-size: 12px;
14+
line-height: 1.5;
1215
}
1316

14-
.CodeMirror-line {
15-
line-height: 12px;
17+
.cm-gutters {
1618
font-size: 12px;
1719
}
20+
}
1821

19-
.CodeMirror-gutter-elt {
20-
line-height: 12px;
21-
font-size: 14px;
22-
}
22+
.cm-editor.cm-focused {
23+
outline: none;
2324
}
2425
}

0 commit comments

Comments
 (0)