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(examples): forms #2604

Closed
wants to merge 25 commits into from
Closed

Conversation

agherasie
Copy link
Contributor

@agherasie agherasie commented Jul 18, 2024

As part of the student contributor program, I attempted to create a new example realm that allows the creation and submission of forms on gno !

Features

  • Form Creation: Create new forms with specified titles, descriptions, and fields.
    CreateForm(...)
  • Form Submission: Submit answers to forms.
    SubmitForm(...)
  • Form Retrieval: Retrieve existing forms and their submissions.
    GetForms(...), GetFormByID(...), GetAnswer(...)
  • Form Deadline: Set a precise time range during which a form can be interacted with.

Field Types

The system supports the following field types:

type example
string {"label": "Name", "fieldType": "string", "required": true}
number {"label": "Age", "fieldType": "number", "required": true}
boolean {"label": "Is Student?", "fieldType": "boolean", "required": false}
choice `{"label": "Favorite Food", "fieldType": "[Pizza
multi-choice `{"label": "Hobbies", "fieldType": "{Reading

Demo

The external repo where the initial development took place and where you can find the frontend is here.

The web app itself is hosted here

And the most recent test4 version of the contract is forms2


Screenshots :

gnoweb Render() image
a form response in the web interface image
creating a form in the web interface image

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Jul 18, 2024
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@leohhhn leohhhn marked this pull request as ready for review July 21, 2024 00:07
@leohhhn leohhhn requested review from a team as code owners July 21, 2024 00:07
@leohhhn leohhhn requested review from jaekwon and gfanton and removed request for a team July 21, 2024 00:07
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! I've left some comments, try to address them 🙏

examples/gno.land/p/demo/forms/forms.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/create.gno Show resolved Hide resolved
examples/gno.land/p/demo/forms/create_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Show resolved Hide resolved
examples/gno.land/p/demo/forms/submit_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/submit_test.gno Outdated Show resolved Hide resolved
Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

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

sgtm (after formatting the markdown table)

examples/gno.land/p/demo/forms/README.md Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/create.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/forms/forms.gno Outdated Show resolved Hide resolved
@agherasie agherasie requested review from leohhhn and gfanton August 16, 2024 15:26
@Kouteki Kouteki added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 3, 2024
@thehowl
Copy link
Member

thehowl commented Oct 4, 2024

@leohhhn @gfanton do you think this can be merged or do you want another review?

@jefft0 jefft0 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Oct 4, 2024
@jefft0
Copy link
Contributor

jefft0 commented Oct 4, 2024

Removed the "review team" label because this is already reviewed by core devs.

Comment on lines +18 to +47
type times struct {
openAt *time.Time
closeAt *time.Time
}

func parseDates(openAt string, closeAt string) (times, error) {
var openAtTime, closeAtTime *time.Time

const dateFormat = "2006-01-02T15:04:05Z"

// Parse openAt if it's not empty
if openAt != "" {
res, err := time.Parse(dateFormat, openAt)
if err != nil {
return times{}, errInvalidDate
}
openAtTime = &res
}

// Parse closeAt if it's not empty
if closeAt != "" {
res, err := time.Parse(dateFormat, closeAt)
if err != nil {
return times{}, errInvalidDate
}
closeAtTime = &res
}

return times{openAtTime, closeAtTime}, nil
}
Copy link
Contributor

@ltzmaxwell ltzmaxwell Oct 4, 2024

Choose a reason for hiding this comment

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

  1. this(times) seems to be a redundant design;
  2. using time.Time directly (without a pointer) is perfectly fine.
    @leohhhn

Copy link

github-actions bot commented Jan 4, 2025

This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months.

@github-actions github-actions bot added Stale and removed Stale labels Jan 4, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 14, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: agherasie/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@thehowl
Copy link
Member

thehowl commented Jan 14, 2025

Alas, author seems unresponsive. @agherasie, feel free to re-open this PR and bring it up to date also in the CI and I'll try to get it merged.

@agherasie
Copy link
Contributor Author

Alas, author seems unresponsive. @agherasie, feel free to re-open this PR and bring it up to date also in the CI and I'll try to get it merged.

Hi @thehowl , sorry for taking so long to update !
I just opened #3524 with small fixes for the CI + an earlier review comment that was left unaddressed !
I'd love to get the PR merged and am open to any new suggestions big or small in case it's not considered ready for merging yet !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: Done
Status: History
Development

Successfully merging this pull request may close these issues.

9 participants