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

Display size of collapsed arrays/objects #15

Open
marcklingen opened this issue Sep 26, 2023 · 9 comments
Open

Display size of collapsed arrays/objects #15

marcklingen opened this issue Sep 26, 2023 · 9 comments

Comments

@marcklingen
Copy link
Contributor

I want to show the size of collapsed arrays/objects to help users understand that they can expand it. (I understand that displaySize is wip/canary)

Currently (even when displaySize={true})
Screenshot 2023-09-25 at 18 26 22@2x

Suggestion
Screenshot 2023-09-25 at 18 26 59@2x


Thank you for your effort on this, this package is super useful!

@marcklingen marcklingen changed the title Display length of collapsed arrays/objects Display size of collapsed arrays/objects Sep 26, 2023
@marcklingen
Copy link
Contributor Author

Is there a smart way to achieve this with customizeNode? If I render a custom element to add the size of the array, I cannot use setFold to change whether it is collapsed

@YYsuni
Copy link
Owner

YYsuni commented Sep 26, 2023

This is indeed an issue that I haven't considered, and I will optimize it soon. Thank you for bringing this to my attention.🫡❤️

@YYsuni
Copy link
Owner

YYsuni commented Sep 26, 2023

Hi, I have updated it as you suggested, which makes a better experience. You can use it by running npm i react18-json-view@canary, or view the website: https://jv.yysuni.com/.
Thanks for the advice.❤️😁

@marcklingen
Copy link
Contributor Author

Hi @YYsuni, thank you, just upgrade and it looks great.

It might be interesting to offer more options:

  • displaySize={true} -> all, current implementation
  • displaySize={"collapsed"} -> this is what we are looking for, size only on collapsed objects
  • displaySize={"expanded"} -> previous behavior, no size on collapsed objects

Example from our app
Screenshot 2023-09-26 at 14 43 05@2x
-> size on collapsed objects is very useful, on expanded ones it is a bit noisy and not necessary

@YYsuni
Copy link
Owner

YYsuni commented Sep 27, 2023

You are a genius, I never thought of that before.😆 , I will do it.

@YYsuni
Copy link
Owner

YYsuni commented Sep 27, 2023

Now I have finished it and released the lastest canary version.🙌

@YYsuni
Copy link
Owner

YYsuni commented Oct 7, 2023

Now it is available in the latest version.

@marcklingen
Copy link
Contributor Author

Thank you! Already getting positive feedback by users on the new JSON viewer in Langfuse:

good set of UI features: you got me with the ability to copy parts of json!

Added shoutout to our changelog.

@YYsuni
Copy link
Owner

YYsuni commented Oct 8, 2023

haha😄😄 congratualtion!

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

No branches or pull requests

2 participants