digital-asset / daml-ui-template

Apache License 2.0
10 stars 14 forks source link

Use types to select fields for form input #23

Closed leonidr-da closed 4 years ago

leonidr-da commented 4 years ago

@georg-da What do you think?

Not the previous, but my Typescript skills are getting better.

GeorgSchneider commented 4 years ago

I like this a lot for the better type safety. My only concern is that it constrains you to have the full type of a choice (or template) as the state in the dialog. What if I only want the user to fill in parts of the parameters, and some others I compute eg. based on the user input? Then I'd have to put some "dummy" values into the defaultValue. Not sure if that's a real concern though

leonidr-da commented 4 years ago

That's a good idea, let me address it.

leonidr-da commented 4 years ago

@georg-da We restrict the date of appraisal to be the current date and limit what fields we generate via types.

leonidr-da commented 4 years ago

Also ameliorate https://github.com/digital-asset/daml-ui-template/issues/22 😄

GeorgSchneider commented 4 years ago

This is really good, I think the template is much more accessible now. I've committed a couple of cosmetic changes, in particular I've come around to using functions instead of lambdas again to make the code easier to understand for beginners. I'll merge this now once the build has passed.

leonidr-da commented 4 years ago

Great!