diff --git a/gui/src/app/App.tsx b/gui/src/app/App.tsx index 6bea45a..98854d4 100644 --- a/gui/src/app/App.tsx +++ b/gui/src/app/App.tsx @@ -1,9 +1,9 @@ +import { CompileContextProvider } from "@SpCompilation/CompileContextProvider"; import ToggleableThemeProvider from "./ToggleableThemeProvider"; import ProjectContextProvider from "@SpCore/ProjectContextProvider"; import HomePage from "@SpPages/HomePage"; import { Analytics } from "@vercel/analytics/react"; import { BrowserRouter } from "react-router-dom"; -import { CompileContextProvider } from "./CompileContext/CompileContextProvider"; const App = () => { return ( diff --git a/gui/src/app/CompileContext/CompileContext.ts b/gui/src/app/Compilation/Context/CompileContext.ts similarity index 100% rename from gui/src/app/CompileContext/CompileContext.ts rename to gui/src/app/Compilation/Context/CompileContext.ts diff --git a/gui/src/app/CompileContext/CompileContextProvider.tsx b/gui/src/app/Compilation/Context/CompileContextProvider.tsx similarity index 94% rename from gui/src/app/CompileContext/CompileContextProvider.tsx rename to gui/src/app/Compilation/Context/CompileContextProvider.tsx index da91c52..15a5ee8 100644 --- a/gui/src/app/CompileContext/CompileContextProvider.tsx +++ b/gui/src/app/Compilation/Context/CompileContextProvider.tsx @@ -1,5 +1,4 @@ import { ProjectContext } from "@SpCore/ProjectContextProvider"; -import compileStanProgram from "@SpCompileContext/compileStanProgram"; import { FunctionComponent, PropsWithChildren, @@ -8,8 +7,9 @@ import { useEffect, useState, } from "react"; -import { CompileContext, CompileStatus } from "./CompileContext"; -import { publicCompilationServerUrl } from "@SpStanc/CompilationServerConnectionControl"; +import { CompileContext, CompileStatus } from "@SpCompilation/CompileContext"; +import { publicCompilationServerUrl } from "@SpCompilation/Constants"; +import compileStanProgram from "./compileStanProgram"; type CompileContextProviderProps = { // none diff --git a/gui/src/app/CompileContext/compileStanProgram.ts b/gui/src/app/Compilation/Context/compileStanProgram.ts similarity index 100% rename from gui/src/app/CompileContext/compileStanProgram.ts rename to gui/src/app/Compilation/Context/compileStanProgram.ts diff --git a/gui/src/app/CompileContext/mainJsUrlCache.ts b/gui/src/app/Compilation/Context/mainJsUrlCache.ts similarity index 100% rename from gui/src/app/CompileContext/mainJsUrlCache.ts rename to gui/src/app/Compilation/Context/mainJsUrlCache.ts diff --git a/gui/src/app/CompilationServerConnectionControl/ConfigureCompilationServerDialog.tsx b/gui/src/app/Compilation/Control/CompilationServerDialog.tsx similarity index 96% rename from gui/src/app/CompilationServerConnectionControl/ConfigureCompilationServerDialog.tsx rename to gui/src/app/Compilation/Control/CompilationServerDialog.tsx index d6a179e..a955f1b 100644 --- a/gui/src/app/CompilationServerConnectionControl/ConfigureCompilationServerDialog.tsx +++ b/gui/src/app/Compilation/Control/CompilationServerDialog.tsx @@ -1,4 +1,4 @@ -import { CompileContext } from "@SpCompileContext/CompileContext"; +import { CompileContext } from "@SpCompilation/CompileContext"; import { Refresh } from "@mui/icons-material"; import Divider from "@mui/material/Divider"; import FormControl from "@mui/material/FormControl"; @@ -10,11 +10,11 @@ import RadioGroup from "@mui/material/RadioGroup"; import TextField from "@mui/material/TextField"; import Typography from "@mui/material/Typography"; import { FunctionComponent, useCallback, useContext } from "react"; +import { serverTypeForUrl } from "./CompilationServerToolbar"; import { localCompilationServerUrl, publicCompilationServerUrl, - serverTypeForUrl, -} from "./CompilationServerConnectionControl"; +} from "./Constants"; type ConfigureCompilationServerDialogProps = { isConnected: boolean; diff --git a/gui/src/app/CompilationServerConnectionControl/CompilationServerConnectionControl.tsx b/gui/src/app/Compilation/Control/CompilationServerToolbar.tsx similarity index 84% rename from gui/src/app/CompilationServerConnectionControl/CompilationServerConnectionControl.tsx rename to gui/src/app/Compilation/Control/CompilationServerToolbar.tsx index b3dbaee..6d27113 100644 --- a/gui/src/app/CompilationServerConnectionControl/CompilationServerConnectionControl.tsx +++ b/gui/src/app/Compilation/Control/CompilationServerToolbar.tsx @@ -4,16 +4,15 @@ import CloseableDialog, { useDialogControls, } from "@SpComponents/CloseableDialog"; import { FunctionComponent, useCallback, useContext } from "react"; -import ConfigureCompilationServerDialog from "./ConfigureCompilationServerDialog"; +import ConfigureCompilationServerDialog from "./CompilationServerDialog"; import IconButton from "@mui/material/IconButton"; import Typography from "@mui/material/Typography"; -import { CompileContext } from "@SpCompileContext/CompileContext"; - -export const publicCompilationServerUrl = - "https://stan-wasm.flatironinstitute.org"; -export const localCompilationServerUrl = "http://localhost:8083"; - -type ServerType = "public" | "local" | "custom"; +import { CompileContext } from "@SpCompilation/CompileContext"; +import { + ServerType, + publicCompilationServerUrl, + localCompilationServerUrl, +} from "./Constants"; type CompilationServerConnectionControlProps = { // none diff --git a/gui/src/app/Compilation/Control/Constants.ts b/gui/src/app/Compilation/Control/Constants.ts new file mode 100644 index 0000000..678cb20 --- /dev/null +++ b/gui/src/app/Compilation/Control/Constants.ts @@ -0,0 +1,4 @@ +export const publicCompilationServerUrl = + "https://stan-wasm.flatironinstitute.org"; +export const localCompilationServerUrl = "http://localhost:8083"; +export type ServerType = "public" | "local" | "custom"; diff --git a/gui/src/app/FileEditor/StanFileEditor.tsx b/gui/src/app/FileEditor/StanFileEditor.tsx index d17608b..1182f2f 100644 --- a/gui/src/app/FileEditor/StanFileEditor.tsx +++ b/gui/src/app/FileEditor/StanFileEditor.tsx @@ -5,7 +5,7 @@ import TextEditor from "@SpComponents/TextEditor"; import { ToolbarItem } from "@SpComponents/ToolBar"; import { stancErrorsToCodeMarkers } from "@SpStanc/Linting"; import useStanc from "@SpStanc/useStanc"; -import { CompileContext } from "@SpCompileContext/CompileContext"; +import { CompileContext } from "@SpCompilation/CompileContext"; import { FunctionComponent, useContext, useMemo, useState } from "react"; type Props = { diff --git a/gui/src/app/RunPanel/RunPanel.tsx b/gui/src/app/RunPanel/RunPanel.tsx index ac72d38..442ae77 100644 --- a/gui/src/app/RunPanel/RunPanel.tsx +++ b/gui/src/app/RunPanel/RunPanel.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, useCallback, useContext, useMemo } from "react"; import Button from "@mui/material/Button"; -import { CompileContext } from "@SpCompileContext/CompileContext"; +import { CompileContext } from "@SpCompilation/CompileContext"; import { ProjectContext } from "@SpCore/ProjectContextProvider"; import { SamplingOpts, modelHasUnsavedChanges } from "@SpCore/ProjectDataModel"; import StanSampler from "@SpStanSampler/StanSampler"; diff --git a/gui/src/app/Stanc/useStanc.ts b/gui/src/app/Stanc/useStanc.ts index cd24191..12162cb 100644 --- a/gui/src/app/Stanc/useStanc.ts +++ b/gui/src/app/Stanc/useStanc.ts @@ -7,7 +7,7 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "react"; // https://vitejs.dev/guide/assets#importing-script-as-a-worker // https://vitejs.dev/guide/assets#importing-asset-as-url import stancWorkerURL from "@SpStanc/stancWorker?worker&url"; -import { CompileContext } from "@SpCompileContext/CompileContext"; +import { CompileContext } from "@SpCompilation/CompileContext"; const useStanc = ( modelName: string, diff --git a/gui/src/app/pages/HomePage/SamplingWindow/SamplingWindow.tsx b/gui/src/app/pages/HomePage/SamplingWindow/SamplingWindow.tsx index 78ed28b..b5aaa52 100644 --- a/gui/src/app/pages/HomePage/SamplingWindow/SamplingWindow.tsx +++ b/gui/src/app/pages/HomePage/SamplingWindow/SamplingWindow.tsx @@ -15,7 +15,7 @@ import { import AnalysisPyWindow from "@SpScripting/Analysis/AnalysisPyWindow"; import useStanSampler, { StanRun } from "@SpStanSampler/useStanSampler"; import AnalysisRWindow from "@SpScripting/Analysis/AnalysisRWindow"; -import { CompileContext } from "@SpCompileContext/CompileContext"; +import { CompileContext } from "@SpCompilation/CompileContext"; type SamplingWindowProps = { // none diff --git a/gui/src/app/pages/HomePage/TopBar.tsx b/gui/src/app/pages/HomePage/TopBar.tsx index 6099667..821f666 100644 --- a/gui/src/app/pages/HomePage/TopBar.tsx +++ b/gui/src/app/pages/HomePage/TopBar.tsx @@ -1,4 +1,4 @@ -import CompilationServerConnectionControl from "@SpStanc/CompilationServerConnectionControl"; +import CompilationServerConnectionControl from "@SpCompilation/CompilationServerToolbar"; import { Brightness7, DarkMode, Menu, QuestionMark } from "@mui/icons-material"; import AppBar from "@mui/material/AppBar"; import IconButton from "@mui/material/IconButton"; diff --git a/gui/tsconfig.json b/gui/tsconfig.json index a5db7f4..9ab7b8d 100644 --- a/gui/tsconfig.json +++ b/gui/tsconfig.json @@ -5,7 +5,6 @@ "lib": ["ES2020", "DOM", "DOM.Iterable", "webworker"], "module": "ESNext", "skipLibCheck": true, - "types": ["vite/client"], /* Bundler mode */ "moduleResolution": "bundler", @@ -14,13 +13,11 @@ "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, - /* Imports */ "baseUrl": "./src", "paths": { @@ -37,14 +34,21 @@ "@SpCore/gists/*": ["app/gists/*"], /* We are playing a bit fast and loose with the distinction */ "@SpPages/*": ["app/pages/HomePage/*"], - "@SpStanc/*": ["app/Stanc/*", "app/CompilationServerConnectionControl/*"], + "@SpStanc/*": ["app/Stanc/*"], "@SpStanSampler/*": ["app/StanSampler/*"], "@SpUtil/*": ["app/util/*"], "@SpStanStats/*": ["app/util/stan_stats/*"], "@SpScripting/*": ["app/Scripting/*"], - "@SpCompileContext/*": ["app/CompileContext/*"] + "@SpCompilation/*": [ + "app/Compilation/Context/*", + "app/Compilation/Control/*" + ] } }, "include": ["src", "test"], - "references": [{ "path": "./tsconfig.node.json" }] + "references": [ + { + "path": "./tsconfig.node.json" + } + ] }