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: bring back service type invalid on input feedback #799

Merged

Conversation

hrzlgnm
Copy link
Owner

@hrzlgnm hrzlgnm commented Mar 10, 2025

Closes #779

Summary by Sourcery

Bug Fixes:

  • Fixes the service type input field to display an error state when the input is invalid.

Copy link

sourcery-ai bot commented Mar 10, 2025

Reviewer's Guide by Sourcery

This pull request introduces visual feedback for service type validation in the AutoCompleteServiceType component. It also fixes an issue where validation errors were triggered prematurely. Additionally, the layout of the browse component was adjusted for better alignment and spacing.

Sequence diagram for service type validation

sequenceDiagram
  participant User
  participant Browse Component
  participant AutoCompleteServiceType

  User->>Browse Component: Enters service type
  Browse Component->>AutoCompleteServiceType: Updates value
  AutoCompleteServiceType-->>Browse Component: Renders with validation status
  Browse Component->>Browse Component: Checks service type validity
  alt Service type is invalid
    Browse Component-->>User: Displays error feedback
  else Service type is valid
    Browse Component-->>User: Displays valid feedback
  end
Loading

Updated class diagram for AutoCompleteServiceType component

classDiagram
  class AutoCompleteServiceType {
    -value: Model<String>
    -disabled: Signal<bool>
    +invalid: Signal<bool>
    -comp_ref: ComponentRef<AutoCompleteRef>
  }
Loading

File-Level Changes

Change Details Files
Added visual feedback to the AutoCompleteServiceType component to indicate whether the entered service type is valid or invalid.
  • Added an invalid prop to the AutoCompleteServiceType component.
  • Created a autocomplete_class signal that dynamically applies CSS classes based on the invalid prop.
  • Added CSS classes to style the AutoComplete component based on the validity of the service type.
src/app.rs
styles.css
Modified the logic for determining service type validity to prevent premature validation errors.
  • Updated the service_type_invalid signal to only trigger when the service type input is not empty and fails validation.
src/app.rs
Adjusted the layout of the browse component for better alignment and spacing.
  • Updated the Flex components in the Browse component to use FlexAlign::Center and FlexJustify::Start for better alignment.
  • Reduced the gap size between elements in the Flex components.
src/app.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#779 Reintroduce input validation for service types.
#779 Provide feedback to the user when the service type input is invalid.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the bug Something isn't working label Mar 10, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @hrzlgnm - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a more descriptive name than autocomplete_class - perhaps something indicating the class is for validation.
  • It might be better to use leptos::logging::log! instead of log::debug!.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hrzlgnm hrzlgnm force-pushed the fix/779-bring-back-service-type-input-validity-feedback branch from c48fee6 to f1b648b Compare March 10, 2025 20:29
@hrzlgnm hrzlgnm enabled auto-merge (squash) March 10, 2025 20:30
@hrzlgnm hrzlgnm merged commit 1c1eb4b into main Mar 10, 2025
5 checks passed
@hrzlgnm hrzlgnm deleted the fix/779-bring-back-service-type-input-validity-feedback branch March 10, 2025 20:43
@hrzlgnm hrzlgnm added the ignore label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ignore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make input validation work again for service types with feedback to user
1 participant