Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize frontend folder structure, nomeclature #266

Merged
merged 6 commits into from
Jan 30, 2025

Conversation

WardBrian
Copy link
Collaborator

This closes #113. This just moves code around and renames some things, no behavioral changes

The organizing principles are defined in a new ARCHITECTURE.md document: link

src/app now has the following top-level folders:

pages -- just HomePage
areas -- sub-views of HomePage. The majority of the UI is here and its sub-folders
windows -- modal boxes that show up above HomePage, like the settings
components -- reusable components
core -- contexts and workers, non-UI code
util -- utility functions

For easier viewing, here's the folder layout in full:

Details

$ tree src/
src/
├── app
│   ├── App.tsx
│   ├── areas
│   │   ├── ControlArea
│   │   │   ├── DataGenerationArea
│   │   │   │   ├── code_templates
│   │   │   │   │   ├── data.py
│   │   │   │   │   └── data.R
│   │   │   │   ├── DataPyPanel.tsx
│   │   │   │   ├── DataRPanel.tsx
│   │   │   │   └── useDataGenState.ts
│   │   │   ├── DataGenerationArea.tsx
│   │   │   ├── SamplingArea
│   │   │   │   ├── ResultsArea
│   │   │   │   │   ├── AnalysisArea
│   │   │   │   │   │   ├── AnalysisPyPanel.tsx
│   │   │   │   │   │   ├── AnalysisRPanel.tsx
│   │   │   │   │   │   ├── code_templates
│   │   │   │   │   │   │   ├── analysis.py
│   │   │   │   │   │   │   └── analysis.R
│   │   │   │   │   │   └── useAnalysisState.ts
│   │   │   │   │   ├── AnalysisArea.tsx
│   │   │   │   │   ├── SamplerOutputArea
│   │   │   │   │   │   ├── ConsolePanel.tsx
│   │   │   │   │   │   ├── DrawsTablePanel.tsx
│   │   │   │   │   │   ├── HistogramsPanel.tsx
│   │   │   │   │   │   ├── Histogram.tsx
│   │   │   │   │   │   ├── SummaryPanel.tsx
│   │   │   │   │   │   ├── TracePlotsPanel.tsx
│   │   │   │   │   │   └── TracePlot.tsx
│   │   │   │   │   └── SamplerOutputArea.tsx
│   │   │   │   ├── ResultsArea.tsx
│   │   │   │   ├── RunArea
│   │   │   │   │   ├── RunOrCompilePanel.tsx
│   │   │   │   │   ├── RunWithProgressPanel.tsx
│   │   │   │   │   ├── SamplerProgress.tsx
│   │   │   │   │   └── SamplingOptsPanel.tsx
│   │   │   │   └── RunArea.tsx
│   │   │   └── SamplingArea.tsx
│   │   ├── ControlArea.tsx
│   │   ├── ModelDataArea
│   │   │   ├── DataEditorPanel.tsx
│   │   │   ├── ModelEditorPanel.tsx
│   │   │   └── StanCompileResultPanel.tsx
│   │   └── ModelDataArea.tsx
│   ├── components
│   │   ├── CloseableDialog.tsx
│   │   ├── Collapsable.tsx
│   │   ├── FileEditor
│   │   │   ├── monacoStanLanguage.ts
│   │   │   ├── PlottingScriptEditor.tsx
│   │   │   ├── ScriptEditor.tsx
│   │   │   ├── TextEditor.tsx
│   │   │   ├── ToolBar.tsx
│   │   │   └── useTemplatedFillerText.ts
│   │   ├── LazyPlotlyPlot.tsx
│   │   ├── LinearProgressWithLabel.tsx
│   │   ├── ResponsiveGrid.tsx
│   │   ├── StyledTables.tsx
│   │   └── TabWidget.tsx
│   ├── core
│   │   ├── Compilation
│   │   │   ├── CompileContextProvider.tsx
│   │   │   └── compileStanProgram.ts
│   │   ├── Project
│   │   │   ├── FileMapping.ts
│   │   │   ├── ProjectContextProvider.tsx
│   │   │   ├── ProjectDataModel.ts
│   │   │   ├── ProjectQueryLoading.ts
│   │   │   ├── ProjectReducer.ts
│   │   │   └── ProjectSerialization.ts
│   │   ├── Scripting
│   │   │   ├── InterpreterTypes.ts
│   │   │   ├── OutputDivUtils.ts
│   │   │   ├── pyodide
│   │   │   │   ├── pyodideWorker.ts
│   │   │   │   ├── pyodideWorkerTypes.ts
│   │   │   │   ├── sp_load_draws.py
│   │   │   │   ├── sp_patch_matplotlib.py
│   │   │   │   └── usePyodideWorker.ts
│   │   │   └── webR
│   │   │       ├── data_postamble.R
│   │   │       ├── sp_load_draws.R
│   │   │       ├── useWebR.ts
│   │   │       └── webR_preamble.R
│   │   ├── Settings
│   │   │   ├── UserSettingsProvider.tsx
│   │   │   └── UserSettings.ts
│   │   ├── Stanc
│   │   │   ├── Linting.ts
│   │   │   ├── stanc.js
│   │   │   ├── stancWorker.ts
│   │   │   ├── Types.ts
│   │   │   └── useStanc.ts
│   │   └── StanSampler
│   │       ├── StanModelWorker.ts
│   │       ├── StanSampler.ts
│   │       └── useStanSampler.ts
│   ├── pages
│   │   ├── CustomTheming.tsx
│   │   ├── HomePage.tsx
│   │   ├── Sidebar.tsx
│   │   └── TopBar.tsx
│   ├── util
│   │   ├── baseObjectCheck.ts
│   │   ├── gists
│   │   │   ├── loadFilesFromGist.ts
│   │   │   └── saveAsGitHubGist.ts
│   │   ├── isMonacoWorkerNoise.ts
│   │   ├── normalizeLineEndings.ts
│   │   ├── replaceSpaces.ts
│   │   ├── stan_stats
│   │   │   ├── fft.ts
│   │   │   ├── stan_stats.ts
│   │   │   └── summaryStats.ts
│   │   ├── triggerDownload.ts
│   │   ├── tryFetch.ts
│   │   ├── types
│   │   │   └── plotly-cartesian.d.ts
│   │   └── unreachable.ts
│   └── windows
│       ├── ExportProjectWindow
│       │   ├── ExportProjectPanel.tsx
│       │   ├── GistExportPanel.tsx
│       │   ├── GistUpdatePanel.tsx
│       │   ├── InputPersonalAccessToken.tsx
│       │   └── makeShareableLink.ts
│       ├── ExportProjectWindow.tsx
│       ├── LoadProjectWindow
│       │   ├── LoadProjectPanel.tsx
│       │   └── UploadFiles.tsx
│       ├── LoadProjectWindow.tsx
│       ├── SettingsWindow
│       │   ├── CompilationServerArea.tsx
│       │   └── PersonalSettingsArea.tsx
│       └── SettingsWindow.tsx
├── index.css
├── localStyles.css
└── main.tsx

33 directories, 107 files

Copy link
Collaborator

@jsoules jsoules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few recommended changes, a few relevant comments, and some less relevant ones...

Overall looks good. I've pulled and run locally and everything still seemed to be present & loaded fine, as far as I could tell.

@@ -53,7 +59,7 @@ const StanFileEditor: FunctionComponent<Props> = ({
});

// invalid syntax
if (!validSyntax && !!editedFileContent) {
if (!validSyntax && !!data.ephemera.stanFileContent) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly germane to this PR, but my fingers are itching to move the button stuff to its own file, or at least find a way to make it less repetitive.

@@ -59,7 +69,22 @@ const TopBar: FunctionComponent<TopBarProps> = ({ title, onSetCollapsed }) => {
<Brightness7 fontSize="inherit" />
)}
</IconButton>
<CompilationServerConnectionControl />
<IconButton
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inlining this component (from CompilationServerConnectionControl) is not unreasonable, it isn't super big, but it's somewhat less semantic.

@WardBrian WardBrian merged commit ccdaaac into main Jan 30, 2025
2 checks passed
@WardBrian WardBrian deleted the issue-113/reorganize-frontend branch January 30, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reorganize/tidy source folder structure throughout frontend
2 participants