Skip to content

fix: 1929 - follow on fixes to pr 1922#1950

Merged
ifsimicoded merged 14 commits intomainfrom
fix/1929/follow_on_fixes_to_PR1922
Dec 9, 2025
Merged

fix: 1929 - follow on fixes to pr 1922#1950
ifsimicoded merged 14 commits intomainfrom
fix/1929/follow_on_fixes_to_PR1922

Conversation

@ifsimicoded
Copy link
Contributor

@ifsimicoded ifsimicoded commented Dec 8, 2025

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).

⚠️ @slesaad Note that I've changed the URL parameter to viewMode=simple, so this will need to be updated in downstream consumers when the package is updated.

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.

@netlify
Copy link

netlify bot commented Dec 8, 2025

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit bb2186f
🔍 Latest deploy log https://app.netlify.com/projects/veda-ui/deploys/693871f46f1645000876df86
😎 Deploy Preview https://deploy-preview-1950--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ifsimicoded ifsimicoded marked this pull request as ready for review December 9, 2025 03:24
Comment on lines +5 to +20
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
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 })}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +194 to +196
selectedCompareDay
? 'Date shown on left map'
: 'Date shown on map'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes the tipContent issue

label=''
date={selectedCompareDay}
setDate={setSelectedComparedDay}
datasets={layers as TimelineDataset[]}
timeDensity={compareTimeDensity}
tipContent='Date shown on right map'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes tip content issue.

@vgeorge vgeorge self-requested a review December 9, 2025 14:36
Copy link
Contributor

@vgeorge vgeorge left a comment

Choose a reason for hiding this comment

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

@ifsimicoded this is looking good. Some notes:

  1. Considering ExplorarionAndAnalysis and ExplorationSimpleView now 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
  1. 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.
Image
  1. 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_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can use a more descriptive name as Container and remove StyledDiv from StyledDivTimelineContainer and StyledDivCompareTimelineContainer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@ifsimicoded
Copy link
Contributor Author

ifsimicoded commented Dec 9, 2025

1. Considering ExplorarionAndAnalysis and ExplorationSimpleView now have the same hierarchy level, it might make sense to enhance the folder structure further. Example:

👍

  1. 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.

Will do in follow on PR.

  1. This PR will supersede docs: add JSDoc comments to E&A embed mode implementation #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.

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?

@ifsimicoded ifsimicoded requested a review from vgeorge December 9, 2025 16:28
@@ -0,0 +1,148 @@
import React, { useEffect, useState } from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.
Copy link
Contributor

@vgeorge vgeorge left a comment

Choose a reason for hiding this comment

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

@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.

@ifsimicoded
Copy link
Contributor Author

@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.

Yep, I noted that in the description:
Screenshot 2025-12-09 at 10 14 40 AM

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
Copy link
Contributor Author

@ifsimicoded ifsimicoded Dec 9, 2025

Choose a reason for hiding this comment

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

@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?

Copy link
Contributor

Choose a reason for hiding this comment

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

@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.

@ifsimicoded ifsimicoded merged commit 827979f into main Dec 9, 2025
10 checks passed
@ifsimicoded ifsimicoded deleted the fix/1929/follow_on_fixes_to_PR1922 branch December 9, 2025 21:17
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.

E&A embed mode refactor / questions

3 participants