Skip to content

Conversation

@nakul-py
Copy link
Contributor

@nakul-py nakul-py commented Sep 23, 2025

Description

Adding typing to useState hooks and Disable the Classify button if user does not provide valid number or negative.

Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--937.org.readthedocs.build/en/937/
💡 JupyterLite preview: https://jupytergis--937.org.readthedocs.build/en/937/lite

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch nakul-py/jupytergis/hooks

@github-actions
Copy link
Contributor

github-actions bot commented Sep 23, 2025

Integration tests report: appsharing.space

@nakul-py nakul-py requested a review from mfisher87 September 24, 2025 10:27
…in SingleBandPseudoColor, Categorized, and Graduated components
…SingleBandPseudoColor and Graduated components
Copy link
Member

@mfisher87 mfisher87 left a comment

Choose a reason for hiding this comment

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

I have to leave for a conference soon, so just leaving some thoughts for now :) I'd like to help out a bit more soon!


useEffect(() => {
if (selectedRamp === '' && selectedMode === '' && numberOfShades === '') {
if (selectedRamp === '') {
Copy link
Member

Choose a reason for hiding this comment

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

Should we still check if selectedMode and numberofShades are undefined here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure we can check if selectedMode and numberofShades are undefined here as it is More defensive ensures all three are unset before populating.

@nakul-py nakul-py requested a review from mfisher87 September 25, 2025 05:50
@mfisher87 mfisher87 changed the title Adding type to hooks Adding type to layer dialog hooks Oct 21, 2025
Comment on lines 219 to 220
selectedMode: ClassificationMode | undefined,
numberOfShades: number | undefined,
Copy link
Member

@mfisher87 mfisher87 Oct 21, 2025

Choose a reason for hiding this comment

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

Suggested change
selectedMode: ClassificationMode | undefined,
numberOfShades: number | undefined,
selectedMode: ClassificationMode,
numberOfShades: number,

Let's make these required and check that these are defined before allowing the user to trigger this function to be called (e.g. don't allow the "Classify" button to be clicked unless these are defined). Then we can remove the casts below!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

safely done

Comment on lines -13 to +16
selectedRamp: string;
selectedRamp: ColorRampName;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think with this change. I think using ColorRampName instead of only type string is a good option.

Copy link
Member

Choose a reason for hiding this comment

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

💯

@nakul-py nakul-py requested a review from mfisher87 October 22, 2025 09:37
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Neat! Thanks

@martinRenou
Copy link
Member

@nakul-py this conflicts with your "default classes" PR that was merged, could you please rebase this and fix conflicts?

@nakul-py
Copy link
Contributor Author

nakul-py commented Nov 5, 2025

Hey! @martinRenou I have resolved conflicts in ColorRamp.tsx :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Review and improve typing for react states

3 participants