Skip to content

Commit 46751ff

Browse files
authored
Merge branch 'develop' into main
2 parents 43d0124 + e1739f9 commit 46751ff

File tree

7 files changed

+2043
-1452
lines changed

7 files changed

+2043
-1452
lines changed
File renamed without changes.

web/package-lock.json

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

web/package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
"@types/node": "^20.11.19",
1010
"@types/react": "^18.2.55",
1111
"@types/react-dom": "^18.2.19",
12-
"@vitejs/plugin-react": "^4.2.1",
13-
"bootstrap": "5.0.0",
14-
"d3": "^7.8.5",
15-
"jquery": "^3.6.0",
12+
"@vitejs/plugin-react": "^4.3.0",
13+
"bootstrap": "5.3.8",
14+
"d3": "7.9.0",
15+
"jquery": "4.0.0",
1616
"react": "^18.2.0",
1717
"react-bootstrap": "^1.5.2",
1818
"react-bootstrap-icons": "^1.4.0",
1919
"react-dom": "^18.2.0",
20-
"react-router-dom": "^5.3.3",
20+
"react-router-dom": "7.13.2",
2121
"typescript": "^5.3.3",
2222
"underscore": "^1.13.8",
23-
"vite": "^5.4.21",
23+
"vite": "^6.0.0",
2424
"vite-tsconfig-paths": "^4.3.1"
2525
},
2626
"scripts": {
@@ -45,9 +45,8 @@
4545
"devDependencies": {
4646
"@testing-library/react": "^14.2.1",
4747
"@types/jsdom": "^21.1.6",
48-
"@types/react-router-dom": "^5.3.3",
49-
"@vitest/coverage-v8": "^1.3.1",
48+
"@vitest/coverage-v8": "4.1.2",
5049
"jsdom": "^24.0.0",
51-
"vitest": "^1.3.1"
50+
"vitest": "4.1.2"
5251
}
5352
}

web/src/Simulation/Simulation.test.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ import { test, expect } from 'vitest'
66
import { vi } from 'vitest'
77
import { act } from 'react-dom/test-utils';
88
import Simulation from './Simulation';
9-
import { BrowserRouter } from 'react-router-dom';
9+
import { MemoryRouter, Route, Routes } from 'react-router-dom';
1010

1111
vi.mock('../API/api');
1212

1313
test('renders without crashing', async () => {
1414
var result:any;
1515
await act(async () => {
1616
result = render(
17-
<BrowserRouter>
18-
<Simulation match={{
19-
params: {
20-
id: ''
21-
}
22-
}}/>
23-
</BrowserRouter>
17+
<MemoryRouter initialEntries={['/simulation/']}>
18+
<Routes>
19+
<Route path='/simulation/:id' element={<Simulation/>}/>
20+
<Route path='/simulation/' element={<Simulation/>}/>
21+
</Routes>
22+
</MemoryRouter>
2423
);
2524
});
2625
expect(result).toBeDefined();

web/src/Simulation/Simulation.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react';
22
import API from '../API/api';
3-
import {Link} from 'react-router-dom';
3+
import {Link, useParams} from 'react-router-dom';
44
import {ArrowLeftCircle} from 'react-bootstrap-icons';
55
import {Card, Button, Row, Col, Container} from 'react-bootstrap'
66
import EditNameDescModal from '../Home/EditNameDescModal'
@@ -10,28 +10,21 @@ import StepsCard from './StepsCard'
1010
import { SimInfo } from '../API/SimInfo';
1111
import { Step } from '../API/Step';
1212

13-
type SimulationProps = {
14-
match: {
15-
params: {
16-
id: string;
17-
}
18-
}
19-
}
20-
21-
const Simulation = (props:SimulationProps) => {
13+
const Simulation = () => {
14+
const { id = '' } = useParams<{ id: string }>();
2215
const [sim, setSim] = useState<SimInfo>(API.emptySim());
2316
const [simsteps, setSimsteps] = useState<Array<Step>>([]);
2417
const [showsimeditmodal, setShowsimeditmodal] = useState<boolean>(false);
2518

2619
useEffect(() => {
27-
readsim(props.match.params.id);
28-
}, [props.match.params.id]);
20+
readsim(id);
21+
}, [id]);
2922

3023
const handlesimeditshow = () => setShowsimeditmodal(true);
3124
const handlesimeditclose = () => setShowsimeditmodal(false);
3225

33-
const readsim = (id:string) => {
34-
API.get(id).then(sresp => {
26+
const readsim = (simid:string) => {
27+
API.get(simid).then(sresp => {
3528
setSim(sresp);
3629
API.getSteps(sresp).then(steps => {
3730
setSimsteps(steps);

web/src/Simulation/__snapshots__/Simulation.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports[`renders without crashing 1`] = `
1010
>
1111
<a
1212
class="btn btn-outline-secondary mr-3 mt-n2 mb-2"
13+
data-discover="true"
1314
href="/"
1415
role="button"
1516
>

web/src/__snapshots__/App.test.tsx.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`renders without crashing 1`] = `
1111
<h1>
1212
<img
1313
alt="logo"
14-
src="/src/logo.svg"
14+
src="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2060%2060'%3e%3cg%20class='links'%3e%3cline%20x1='29.47845386204116'%20y1='30.2993068845328'%20x2='5'%20y2='22.76864355842357'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='29.47845386204116'%20y1='30.2993068845328'%20x2='14.07820565912296'%20y2='51.53600876990375'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='43.86203789162526'%20y1='52.0669709714013'%20x2='5'%20y2='22.76864355842357'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='43.86203789162526'%20y1='52.0669709714013'%20x2='54.36201579120926'%20y2='23.96621520614607'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='43.86203789162526'%20y1='52.0669709714013'%20x2='14.07820565912296'%20y2='51.53600876990375'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='43.86203789162526'%20y1='52.0669709714013'%20x2='30.07898864117986'%20y2='5'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='5'%20y1='22.76864355842357'%20x2='54.36201579120926'%20y2='23.96621520614607'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='5'%20y1='22.76864355842357'%20x2='14.07820565912296'%20y2='51.53600876990375'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='5'%20y1='22.76864355842357'%20x2='30.07898864117986'%20y2='5'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='54.36201579120926'%20y1='23.96621520614607'%20x2='14.07820565912296'%20y2='51.53600876990375'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='54.36201579120926'%20y1='23.96621520614607'%20x2='30.07898864117986'%20y2='5'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='14.07820565912296'%20y1='51.53600876990375'%20x2='30.07898864117986'%20y2='5'%20style='stroke:%20lightgray;'%3e%3c/line%3e%3cline%20x1='29.47845386204116'%20y1='30.2993068845328'%20x2='54.36201579120926'%20y2='23.96621520614607'%20style='stroke:%20blue;'%3e%3c/line%3e%3cline%20x1='29.47845386204116'%20y1='30.2993068845328'%20x2='43.86203789162526'%20y2='52.0669709714013'%20style='stroke:%20blue;'%3e%3c/line%3e%3cline%20x1='29.47845386204116'%20y1='30.2993068845328'%20x2='30.07898864117986'%20y2='5'%20style='stroke:%20blue;'%3e%3c/line%3e%3c/g%3e%3cg%20class='nodes'%3e%3ccircle%20r='5'%20cx='29.47845386204116'%20cy='30.2993068845328'%20style='fill:%20blue;'%3e%3ctitle%3eLead%3c/title%3e%3c/circle%3e%3ccircle%20r='5'%20cx='14.07820565912296'%20cy='51.53600876990375'%20style='fill:%20slategray;'%3e%3ctitle%3eDev_1%3c/title%3e%3c/circle%3e%3ccircle%20r='5'%20cx='30.07898864117986'%20cy='5'%20style='fill:%20blue;'%3e%3ctitle%3eDev_2%3c/title%3e%3c/circle%3e%3ccircle%20r='5'%20cx='43.86203789162526'%20cy='52.0669709714013'%20style='fill:%20blue;'%3e%3ctitle%3eDev_3%3c/title%3e%3c/circle%3e%3ccircle%20r='5'%20cx='5'%20cy='22.76864355842357'%20style='fill:%20slategray;'%3e%3ctitle%3eDev_4%3c/title%3e%3c/circle%3e%3ccircle%20r='5'%20cx='54.36201579120926'%20cy='23.96621520614607'%20style='fill:%20blue;'%3e%3ctitle%3eDev_5%3c/title%3e%3c/circle%3e%3c/g%3e%3c/svg%3e"
1515
style="height: 60px; width: 60px;"
1616
/>
1717
Simulation Set
@@ -89,6 +89,7 @@ exports[`renders without crashing 1`] = `
8989
>
9090
<a
9191
class="btn btn-primary"
92+
data-discover="true"
9293
href="/simulation/1"
9394
role="button"
9495
>
@@ -155,6 +156,7 @@ exports[`renders without crashing 1`] = `
155156
>
156157
<a
157158
class="btn btn-primary"
159+
data-discover="true"
158160
href="/simulation/2"
159161
role="button"
160162
>

0 commit comments

Comments
 (0)