-
Notifications
You must be signed in to change notification settings - Fork 19
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 react template #295
Conversation
36e9780
to
e67789e
Compare
6567370
to
83a01b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some fixes and an alert that there was a problem I couldn't fix (see comment re: not rendering widgets for Vec<T>
, and being unable to submit the form after I press the Add <field_name>s
button).
There are some suggestions, e.g., for follow-up PRs to DRY the code and sample values that are shared among frameworks, but those are non-blocking.
...na_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs
Outdated
Show resolved
Hide resolved
...{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{pascal_case collection_name}}.tsx.hbs
Outdated
Show resolved
Hide resolved
...role_name}}/{{coordinator_zome_manifest.name}}/Create{{pascal_case entry_type.name}}.tsx.hbs
Outdated
Show resolved
Hide resolved
...role_name}}/{{coordinator_zome_manifest.name}}/Create{{pascal_case entry_type.name}}.tsx.hbs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- One blocker re: the date picker
- One suggestion re: same
- One suggestion re: the
u32
picker - And one re: checkbox picker.
Everything else tested!
...role_name}}/{{coordinator_zome_manifest.name}}/Create{{pascal_case entry_type.name}}.tsx.hbs
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,2 @@ | |||
<label htmlFor="{{label}}">{{label}}</label> | |||
<input name="{{label}}" type="datetime-local" {{#if variable_to_read}} value={new Date({{variable_to_read}}!).toISOString()} {{/if}} onChange={(e) => set{{pascal_case variable_to_change}}(Math.floor(new Date(e.target.value).getTime() / 1000))} {{#if required}}required{{/if}} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
templates/react/field-types/Timestamp/DateTimePicker/edit/render.hbs
Outdated
Show resolved
Hide resolved
name="{{label}}" | ||
type="datetime-local" | ||
{{#if variable_to_read}} | ||
value={new Date({{variable_to_read}}! / 1000).toISOString().slice(0, 16)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value={new Date({{variable_to_read}}! / 1000).toISOString().slice(0, 16)} | |
{{!-- FIXME: This likely doesn't work across the daylight saving time transition --}} | |
value={new Date({{variable_to_read}}! / 1000 - (new Date({{variable_to_read}}! / 1000).getTimezoneOffset() * 60000)).toISOString().slice(0, 16)} |
This gives the correct local time. When getting the timezone offset for the date, we have to use the same timestamp again to account for daylight saving time. However, I suspect it won't actually work around the daylight saving boundary, which may be okay because that only causes two possible windows for error in a year, for a lot fewer lines of code than the example I shared before? :)
Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com>
…er.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com>
…er.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com>
* WIP * update ui module * add react to matched ui framework strings * hbsify templates * add base react components * react collection * react detail component * react create component * react edit template * react entry type for linked from component * field types * react link type components * fix field types * template swoop; fix issues * add missing imports, strip out eslint * fix images * refactor holochain provider * fix entry-type templates * fix link-type templates * correctly name field type widgets * add forum example * fix holochain context * check for links lengths before setting state * fix text field * styling improvments * extend base styles * improve example styling * fix mismatched components * remove ui readme * fix templates * fix imports * update elements and imports * type app signal callback * test with react template in ci * update styling * fix global styles * rename and move client context * make client context compatible with holo * fix indentation in templates * update client context template * fix entry-types for linked from component props * update detail components * add default field types * fix example app.tsx * fix vec detail render * fix vec edit render * fix timestamp * fix client context not updating loading state * fix vec input * fix vec input setters in edit components * Update templates/react/field-types/u32/NumberInput/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * Update templates/react/field-types/Timestamp/DateTimePicker/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * Update templates/react/field-types/Timestamp/DateTimePicker/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * set default and initial values for boolean inputs to false * ensure previous zip file is deleted * fix templates --------- Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com>
* bump versions * feat: Add react template (#295) * WIP * update ui module * add react to matched ui framework strings * hbsify templates * add base react components * react collection * react detail component * react create component * react edit template * react entry type for linked from component * field types * react link type components * fix field types * template swoop; fix issues * add missing imports, strip out eslint * fix images * refactor holochain provider * fix entry-type templates * fix link-type templates * correctly name field type widgets * add forum example * fix holochain context * check for links lengths before setting state * fix text field * styling improvments * extend base styles * improve example styling * fix mismatched components * remove ui readme * fix templates * fix imports * update elements and imports * type app signal callback * test with react template in ci * update styling * fix global styles * rename and move client context * make client context compatible with holo * fix indentation in templates * update client context template * fix entry-types for linked from component props * update detail components * add default field types * fix example app.tsx * fix vec detail render * fix vec edit render * fix timestamp * fix client context not updating loading state * fix vec input * fix vec input setters in edit components * Update templates/react/field-types/u32/NumberInput/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * Update templates/react/field-types/Timestamp/DateTimePicker/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * Update templates/react/field-types/Timestamp/DateTimePicker/edit/render.hbs Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * set default and initial values for boolean inputs to false * ensure previous zip file is deleted * fix templates --------- Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com> * fix: holochain client error handling (#298) * fix: holochain client error handling * fix: typescript failures in lit template * fix: holo web sdk version not part of ScaffoldWebAppData (#302) * fix: Add missing web-sdk-version to template data * rename holo web sdk template field * fix: Include react in testable templates; bump versions (#310) * fix: add react to testable templates * bump crate version; nix flake update * bump versions * nix flake update * fix: improve ts codegen and formatting for ts/tsx files (#311) * refactor: replace tempalte derived types.ts files with rust-geneted ones * fix typo * add programatic formatting * fix incorrectly named variable in tests * ignore formatting EntryTypes * fix invalid enum types * fix: improve code formatting in ts/tsx files * fix clippy warning * fix failing codgegen tests * rename tests module * update holonix version --------- Co-authored-by: Paul d'Aoust <amillionlobsters@gmail.com>
Closes #81
Know Issues
Select
andVec<T>
are poorly formatted. Their functionality is not affected however. Fix to be made in separate PR