Skip to content

Commit 30f4503

Browse files
committed
feat: update routing and add Calibration Gas page; refactor state management in Dilution page
1 parent a6f2579 commit 30f4503

File tree

12 files changed

+111
-39
lines changed

12 files changed

+111
-39
lines changed

src/App.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { Route, Routes } from "react-router-dom";
22

3-
import IndexPage from "@/pages/dilution";
3+
import CalibrationGasPage from "@/pages/calibrationgas";
4+
import DilutionPage from "@/pages/dilution";
45

56
function App() {
67
return (
78
<Routes>
8-
<Route element={<IndexPage />} path="/" />
9+
<Route element={<DilutionPage />} path="/" />
10+
<Route element={<CalibrationGasPage />} path="/calibrationgas" />
911
</Routes>
1012
);
1113
}

src/components/GasInlet.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
* You should have received a copy of the GNU Affero General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
18-
import React from "react";
18+
import type React from "react";
19+
1920
import {
2021
AGA8wasm,
2122
PropertiesGERGResult,
2223
type GasMixtureExt,
2324
} from "@sctg/aga8-js";
25+
import { useEffect } from "react";
2426

2527
import { GasSelector } from "./GasSelector";
2628
import { OrificeSelector } from "./OrificeSelector";
@@ -145,7 +147,7 @@ export const GasInlet: React.FC<GasInletProps> = ({
145147
onOrificeChange,
146148
onFlowDataChange,
147149
}) => {
148-
React.useEffect(() => {
150+
useEffect(() => {
149151
const updateFlow = async () => {
150152
const newFlowData = await computeGasFlowFunctionOfPressure(
151153
temperature,
@@ -169,11 +171,11 @@ export const GasInlet: React.FC<GasInletProps> = ({
169171
onChange={onPressureChange}
170172
/>
171173
<div className="my-4">
172-
<GasSelector
173-
label={`Gas ${label}`}
174-
selectedGas={selectedGas}
175-
onGasChange={onGasChange}
176-
/>
174+
<GasSelector
175+
label={`Gas ${label}`}
176+
selectedGas={selectedGas}
177+
onGasChange={onGasChange}
178+
/>
177179
</div>
178180
<OrificeSelector
179181
label={`Orifice ${label}`}

src/components/GasSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* You should have received a copy of the GNU Affero General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
18-
import React from "react";
18+
import type React from "react";
19+
1920
import { Select, SelectItem } from "@heroui/select";
2021
import { pureGasMixtures, type GasMixtureExt } from "@sctg/aga8-js";
2122

src/components/OrificeSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from "react";
1+
import type React from "react";
2+
23
import { Select, SelectItem } from "@heroui/select";
34

45
interface OrificeSelectorProps {

src/components/PressureSlider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from "react";
1+
import type React from "react";
2+
23
import { Slider } from "@heroui/slider";
34

45
interface PressureSliderProps {
@@ -27,4 +28,4 @@ export const PressureSlider: React.FC<PressureSliderProps> = ({
2728
}
2829
/>
2930
);
30-
};
31+
};

src/components/SonicNozzleTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from "react";
1+
import type React from "react";
2+
23
import {
34
Table,
45
TableHeader,

src/components/icons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from "react";
1+
import type React from "react";
22

33
import { IconSvgProps } from "@/types";
44

src/components/theme-switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useState, useEffect } from "react";
1+
import { type FC, useState, useEffect } from "react";
22
import { VisuallyHidden } from "@react-aria/visually-hidden";
33
import { SwitchProps, useSwitch } from "@heroui/switch";
44
import clsx from "clsx";

src/config/site.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ export const siteConfig = {
55
description: "Comprehensive dilution simulator for AGA8 gaz",
66
navItems: [
77
{
8-
label: "Home",
8+
label: "Dilution",
99
href: "/",
1010
},
11+
{
12+
label: "Calibration Gas",
13+
href: "/calibrationgas",
14+
},
1115
],
1216
navMenuItems: [
1317
{
14-
label: "Home",
18+
label: "Dilution",
1519
href: "/",
1620
},
21+
{
22+
label: "Calibration Gas",
23+
href: "/calibrationgas",
24+
},
1725
],
1826
links: {
1927
github: "https://github.com/sctg-development/flow-dilution",

src/main.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom/client";
1+
import { StrictMode } from "react";
2+
import { createRoot } from "react-dom/client";
33
import { BrowserRouter } from "react-router-dom";
44

55
import App from "./App.tsx";
66
import { Provider } from "./provider.tsx";
77
import "@/styles/globals.css";
88

9-
ReactDOM.createRoot(document.getElementById("root")!).render(
10-
<React.StrictMode>
9+
createRoot(document.getElementById("root")!).render(
10+
<StrictMode>
1111
<BrowserRouter basename={import.meta.env.BASE_URL}>
1212
<Provider>
1313
<App />
1414
</Provider>
1515
</BrowserRouter>
16-
</React.StrictMode>,
16+
</StrictMode>,
1717
);

0 commit comments

Comments
 (0)