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 react template #295

Merged
merged 56 commits into from
Jun 11, 2024
Merged

feat: Add react template #295

merged 56 commits into from
Jun 11, 2024

Conversation

c12i
Copy link
Collaborator

@c12i c12i commented May 28, 2024

Closes #81

Know Issues

  • Some entry type widgets i.e Select and Vec<T> are poorly formatted. Their functionality is not affected however. Fix to be made in separate PR

@c12i c12i force-pushed the add-react-template branch 3 times, most recently from 36e9780 to e67789e Compare May 29, 2024 16:42
@c12i c12i requested review from matthme and pdaoust May 30, 2024 08:10
@c12i c12i marked this pull request as ready for review May 30, 2024 08:10
@c12i c12i requested a review from zippy May 30, 2024 08:10
@c12i c12i force-pushed the add-react-template branch 2 times, most recently from 6567370 to 83a01b0 Compare June 3, 2024 06:38
@c12i c12i requested a review from robbiecarlton June 6, 2024 12:05
Copy link
Collaborator

@pdaoust pdaoust left a 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.

@c12i c12i requested a review from pdaoust June 10, 2024 13:46
Copy link
Collaborator

@pdaoust pdaoust left a 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!

@@ -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}} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

image

name="{{label}}"
type="datetime-local"
{{#if variable_to_read}}
value={new Date({{variable_to_read}}! / 1000).toISOString().slice(0, 16)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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? :)

@c12i c12i requested a review from pdaoust June 11, 2024 08:12
@c12i c12i added the ShouldBackport/0.3 This change should be backported to develop-0.3 label Jun 11, 2024
@c12i c12i merged commit e4bf548 into holochain:develop Jun 11, 2024
2 of 8 checks passed
@c12i c12i removed the ShouldBackport/0.3 This change should be backported to develop-0.3 label Jun 19, 2024
c12i added a commit to c12i/scaffolding that referenced this pull request Jun 19, 2024
* 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>
c12i added a commit that referenced this pull request Jun 19, 2024
* 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>
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

Successfully merging this pull request may close these issues.

[feat] reactjs template
3 participants