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

fix: Improve form inputs #157

Merged
merged 1 commit into from
Jul 17, 2024
Merged

fix: Improve form inputs #157

merged 1 commit into from
Jul 17, 2024

Conversation

mahatoankitkumar
Copy link
Collaborator

@mahatoankitkumar mahatoankitkumar commented Jul 12, 2024

Problem

Better form fields

  • enum → Toggle
  • boolean → dropdown with true and false options
Screen.Recording.2024-07-12.at.12.16.37.PM.mov

@mahatoankitkumar mahatoankitkumar requested a review from a team as a code owner July 12, 2024 05:07
@mahatoankitkumar mahatoankitkumar requested review from sauraww and Datron and removed request for a team July 12, 2024 05:09
@mahatoankitkumar mahatoankitkumar force-pushed the fix/improve/form/inputs-new branch from 31d6199 to f751edc Compare July 12, 2024 05:17
@mahatoankitkumar mahatoankitkumar force-pushed the fix/improve/form/inputs-new branch from f751edc to 6eae817 Compare July 12, 2024 06:49
Copy link
Collaborator

@Datron Datron left a comment

Choose a reason for hiding this comment

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

Lets get this in

class="input input-bordered w-full max-w-md"
value=config_value.get()
on:change=move |ev| {
logging::log!("{:?}", event_target_value(& ev));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add the desciption for the log here ?

placeholder="Value"
class="input input-bordered w-full max-w-md pt-3"
on:change=move |ev| {
logging::log!("{:?}", event_target_value(& ev));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here as well

#[prop(default = String::new())] class: String,
#[prop(default = false)] disabled: bool,
) -> impl IntoView {
let (value, set_value) = create_signal(config_value.replace("\\", ""));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we avoid replacing it ?
What if someone actually wants to send this in the input ?

on:change=move |ev| {
logging::log!("{:?}", event_target_value(&ev).parse::<u32>());
logging::log!("{:?}", event_target_value(& ev).parse::< u32 > ());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add the log description here as well ?

if schema.contains_key("enum") {
String::from("ENUM")
} else {
match schema.get("type").unwrap_or(&Value::Null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we using unwrap and match both here ?
Possible to change it to :
match schema.get("type") { Some(Value::String(str_)) => str_.to_ascii_uppercase(), _ => String::from("STRING"), }

@Datron Datron linked an issue Jul 17, 2024 that may be closed by this pull request
@Datron Datron requested a review from sauraww July 17, 2024 05:40
@Datron Datron linked an issue Jul 17, 2024 that may be closed by this pull request
@Datron Datron dismissed sauraww’s stale review July 17, 2024 05:42

Moving forward, anything missing can be addressed in a separate PR

@Datron Datron merged commit ebd2f57 into main Jul 17, 2024
4 checks passed
@Datron Datron deleted the fix/improve/form/inputs-new branch July 17, 2024 05:42
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.

ENUMs should be available as drop-downs Improve form inputs based on json schema type
4 participants