fix: 1929 - follow on fixes to pr 1922#1950
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| const hydrateViewMode = (serialized: string | null) => { | ||
| if (serialized === 'simple') return serialized; | ||
| return 'default'; | ||
| }; | ||
|
|
||
| const dehydrateViewMode = (value: 'simple' | 'default') => { | ||
| return value ?? 'default'; | ||
| }; | ||
|
|
||
| export const viewModeAtom = atomWithUrlValueStability<'simple' | 'default'>({ | ||
| initialValue: hydrateViewMode(initialParams.get('viewMode')), | ||
| urlParam: 'viewMode', | ||
| hydrate: hydrateViewMode, | ||
| dehydrate: dehydrateViewMode, | ||
| areEqual: (prev, next) => prev === next | ||
| }); |
There was a problem hiding this comment.
This file is largely the same as the embed atom, however, we're now managing a view mode (simple or default) vs a boolean. This allows for more view modes in the future
| title='Exploration' | ||
| description='Explore and analyze datasets' | ||
| hideFooter | ||
| {...(viewMode === 'simple' && { hideNav: true, hideHeader: true })} |
There was a problem hiding this comment.
This is the intended way to hide the header and footer, such that the simpleView can be exported independently, and not need to manage the header and footer / or interfere with SPA behavior.
| selectedCompareDay | ||
| ? 'Date shown on left map' | ||
| : 'Date shown on map' |
There was a problem hiding this comment.
fixes the tipContent issue
| label='' | ||
| date={selectedCompareDay} | ||
| setDate={setSelectedComparedDay} | ||
| datasets={layers as TimelineDataset[]} | ||
| timeDensity={compareTimeDensity} | ||
| tipContent='Date shown on right map' |
There was a problem hiding this comment.
fixes tip content issue.
vgeorge
left a comment
There was a problem hiding this comment.
@ifsimicoded this is looking good. Some notes:
- Considering
ExplorarionAndAnalysisandExplorationSimpleViewnow have the same hierarchy level, it might make sense to enhance the folder structure further. Example:
/exploration/
├── index.tsx # Container (stays at root)
├── views/ # New: Views directory
│ ├── default/ # Default E&A view
│ │ └── index.tsx # ExplorationAndAnalysis
│ └── simple/ # Simple view
│ ├── index.tsx
│ └── timeline-simple-view.tsx
- I noticed that even when setting LayoutProps to hide layout components, there is still the banner and the site alert, which makes the simple view to slitghly offset and scroll. Not sure if we should address in this PR tough.
- This PR will supersede #1931, could we use this opportunity to add a bit more JSDoc on the exported helpers/types (view mode utils, props, etc.)? The code is already very readable, but this would improve IntelliSense in editors and generate autodocs in the future.
| }; | ||
|
|
||
| function EmbeddedLayersExploration(props: EmbeddedLayersExplorationProps) { | ||
| function ExplorationSimpleView_(props: ExplorationSimpleViewProps_) { |
There was a problem hiding this comment.
I suggest to use a more descript name here, maybe ExplorationSimpleviewContent?
| import { useVedaUI } from '$context/veda-ui-provider'; | ||
|
|
||
| const Carto = styled.div` | ||
| const StyledDiv = styled.div` |
There was a problem hiding this comment.
I think we can use a more descriptive name as Container and remove StyledDiv from StyledDivTimelineContainer and StyledDivCompareTimelineContainer.
There was a problem hiding this comment.
Can do! I do like to prefix Styled on components that are simply styles this way it's obvious this component contains to no functionality. It makes debugging simpler in component inspect view.
👍
Will do in follow on PR.
Will rely on you to complete this since you have a better idea of what you're looking for. Could you do that in a follow on? |
| @@ -0,0 +1,148 @@ | |||
| import React, { useEffect, useState } from 'react'; | |||
There was a problem hiding this comment.
This file is largely the same as the prior exploration/index view but I updated all the relative path imports.
| } | ||
| } | ||
| `; | ||
| import { DatasetSelectorModal } from '$components/exploration/components/dataset-selector-modal'; |
There was a problem hiding this comment.
This file is largely the same as the prior container but I updated all the relative path imports.
Add JSDoc documentation to public API exports for the new view mode system, following existing patterns in the codebase. Documents: - viewModeAtom and ViewMode type - ExplorationAndAnalysisSimpleView and ExplorationAndAnalysisDefaultView - TimelineSimpleView component - Container routing logic Supersedes JSDoc work from #1931 after file restructuring.
vgeorge
left a comment
There was a problem hiding this comment.
@ifsimicoded thanks for the updates, I’ve added JSDocs to the public API exports to give more context on why they exist. I don’t think we need to add JSDocs for internal code if it’s already readable, which seems to be the case here.
One note: this may introduce a potential breaking change if embed=true is already being used downstream. We should confirm it won’t cause issues, or add a fallback to handle embed=true.
Aside from that, this looks good to merge.
🙏
Yep, I noted that in the description: But I'll reach out to Slesa |
| * @NOTE: This container component serves as a wrapper for the purpose of data management, this is ONLY to support current instances. | ||
| * veda2 instances can just use the direct component, 'ExplorationAndAnalysis', and manage data directly in their page views | ||
| * @NOTE: This container component serves as a wrapper for the purpose of data management, | ||
| * this is ONLY to support current instances. veda2 instances can just use the direct |
There was a problem hiding this comment.
@vgeorge what is current instances vs veda2? is current instances, veda as a submodule? and veda2 is the the next-veda-ui implementation as a library (instead of submodule)?
when you say current instances, if I read this in one year, will that still apply?
There was a problem hiding this comment.
@ifsimicoded my original intent with this change was just to rename the reference component, and I was also confused by the veda2 term. After digging through past tickets, I realized it refers to a refactor effort from last year to evolve the architecture. Since this wasn’t well documented, I created a new ADR to capture what was done and how it connects to the current architecture discussions in #1952.

Related Ticket:
Relates to the work completed in PR #1922
Closes #1929
Description of Changes
This PR addresses some of the issues that came up when the "embed" mode was created for the GHGc portal. Details in the related ticket. Note, because the entire app is 'embeddable', I've changed the name of this view to be 'simple' mode. (Most of the changes are renames).
Validation / Testing
Ensure viewMode=simple renders the simple view, and any other viewMode renders the usual E&A view. embed should no longer alter the view.