-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(frontend): code structure (#89)
An overview of the React app structure. Renames `config/view-layers` to `config/data-layers`, to avoid conflicts with `config/view-layers.ts`. Removes the old Create React App TypeScript config.
- Loading branch information
1 parent
7a7ed5f
commit 1fbf59b
Showing
111 changed files
with
142 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Code structure | ||
|
||
Author: Jim O'Donnell | ||
|
||
Date: 9 August 2024 | ||
|
||
- `src/` | ||
- `config/` - contains the configuration and code related to the various | ||
datasets and visualisation layers, as well as other pieces of configuration. | ||
- `data-layers/` - config for individual data layers. There should be a folder here for each entry in `config/view-layers.ts` | ||
- `assets/` - common functionality for "vector assets" - vector feature | ||
layers that can have damages data visualised on them. | ||
- `basemaps.ts` - configuration of basemap styles. | ||
- `interaction-groups.ts` - configuration of all the interaction groups | ||
available in the app. | ||
- `map-view.ts` - configuration of the initial map view coordinates, zoom | ||
etc. | ||
- `sections.ts` - style config for the sidebar sections. | ||
- `sources.ts` - functions to build URLs to access datasets in the | ||
vector/raster backends. | ||
- `view-layers.ts` - a list of the view layer IDs used by the map. | ||
- `views.ts` - default sidebar state (visible/hidden, expanded/collapsed etc.) for the individual map views. | ||
- `details/` - UI and logic for displaying details when a vector feature is clicked in the map. | ||
- `lib/` - self-contained library code which should be unrelated to the specific | ||
datasets/content of the app. **NOTE** there is an ESLint rule enforcing that | ||
files inside the `lib` folder cannot import code from any other folder in | ||
the project, to enforce the separation between generic and content-specific | ||
code. | ||
- `map/` - UI, layout and behaviour of the main map view of the app. Contains | ||
also the code for displaying basemap selection, legend for current layers, | ||
tooltip for current hover. | ||
- `pages/` - contents and layouts of the main pages of the app. | ||
- `sidebar/` - the main layer selection sidebar. | ||
- `sections/` - UI components for the controls displayed in various sidebar | ||
sections. Specific to the datasets displayed in the app. | ||
- `ui/` - components shared by the sidebar contents. | ||
- `SidebarContent.tsx` - defining the overall contents of the sidebar. | ||
- `SidebarPanel.tsx` - each section in the sidebar should be composed from `SidebarPanel`. | ||
- `url-state.tsx` - Recoil state synchronising the state of the sidebar | ||
sections to the URL. | ||
- `state/` - Recoil state for the app. | ||
- `data-selection/` - state used by layer selection sidebar. | ||
- `layers/` - state which creates the view layer instances based on app | ||
state and data selection state. | ||
- `data-layers/` - state of the layers pertaining to individual datasets. There should be one file here for each identifier in `config/view-layers.ts`. | ||
- `ui/` - special layers for UI (e.g. feature bounding box layer.) | ||
- `interaction-groups.ts` - state containing all active interaction groups. | ||
- `view-layers.ts` - state combining all active view layers. | ||
- `view-layer-params.ts` - state setting up the dynamic view layer | ||
parameters. | ||
- `map-view/` - map view state and syncing it to the URL. | ||
- `data-params.ts` - view layer data parameters. Updated from the sidebar and used to construct map tile URLs. | ||
- `sections.ts` - section state for individual sidebar sections. | ||
- `view.ts` - view state for individual map views. | ||
- `api-client.ts` - singleton instances of API clients. | ||
- `App.ts` - main React app component. | ||
- `index.css` - global styles (avoid, set styles in components instead.) | ||
- `index.tsx` - Vite app entry point. | ||
- `Nav.tsx` - main navigation component. | ||
- `query-client.ts` - singleton instance of react-query client. | ||
- `theme.ts` - MUI theme configuration. | ||
- `use-is-mobile.ts` - util hook. | ||
- `vite-env.d.ts` - Vite types inclusion. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...config/view-layers/assets/data-formats.ts → ...config/data-layers/assets/data-formats.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...-layers/buildings/buildings-view-layer.ts → ...-layers/buildings/buildings-view-layer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ughtOptions/drought-options-view-layer.ts → ...ughtOptions/drought-options-view-layer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...s/droughtRisks/drought-risk-view-layer.ts → ...s/droughtRisks/drought-risk-view-layer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ers/networks/infrastructure-view-layer.ts → ...ers/networks/infrastructure-view-layer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/sidebar/buildings/BuildingsControl.tsx → ...r/sections/buildings/BuildingsControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/sidebar/buildings/BuildingsSection.tsx → ...r/sections/buildings/BuildingsSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...nd/src/sidebar/regions/RegionsControl.tsx → ...debar/sections/regions/RegionsControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...d/src/sidebar/solutions/MarineControl.tsx → ...ebar/sections/solutions/MarineControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ebar/solutions/TerrestrialLandUseTree.tsx → ...ions/solutions/TerrestrialLandUseTree.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
frontend/src/state/data-selection/drought/drought-parameters.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
frontend/src/state/data-selection/networks/network-selection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.