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

feat: add comment to config #3345

Merged
merged 3 commits into from
Nov 7, 2023
Merged

feat: add comment to config #3345

merged 3 commits into from
Nov 7, 2023

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Nov 7, 2023

Summary

Follow up on #3337

This PR allows us to easily add comments to the params in the generated sippet, additionally makes some proposals to improve the documentation, and add identation support to show better the config in the HTML snippet

Add comments

Before:
image

After:
Screenshot at Nov 07 11-10-19

image

Allow to add values to params

Some values like the ethereum.provider where not added because they don't serialise too well.

This PR also adds a simple way to add it back:

Before:
image

After:
image

Remove some parameters

It also removes the env parameter. I think makes people more confused than it helps them. If they want, they can still find it in the docs

image

I actually don't love this parameter. I think it should be the baseURL that we pass. But probably is fine by now. Maybe someone wants to use an IPFS one

Sanitize params moved to a const

image

Add identation support to improve HTML snippet

Before:
image

After:
Screenshot at Nov 07 11-10-35

Change some config descriptions

Changed the documentation for some config params

Test

Open the modal and check the 3 snipets

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2023 11:59am
swap-dev 🔄 Building (Inspect) Visit Preview Nov 7, 2023 11:59am
widget-configurator ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2023 11:59am

// Add values
const resultWithValues = Object.keys(VALUES_BY_PARAM_NAME).reduce((acc, propName) => {
return acc.replace(new RegExp(`("${propName}".* )(".*")(.*)$`, 'gm'), `$1${VALUES_BY_PARAM_NAME[propName]}$3`)
}, resultWithComments)
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 helps to solve the issue serialising the provider, see description of the PR

Copy link
Collaborator

@shoom3301 shoom3301 left a comment

Choose a reason for hiding this comment

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

Looks great!

@anxolin anxolin added the Widget label Nov 7, 2023
@anxolin anxolin changed the base branch from fix/widget-typeform to release/1.49.0 November 7, 2023 11:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants