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

Add save & continue editing button #635

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

Elmseld
Copy link
Collaborator

@Elmseld Elmseld commented Oct 17, 2024

Also added a 5 second visibility on info-flash-msg for better ui-experience.

@pehbehbeh pehbehbeh self-requested a review October 17, 2024 15:00
Comment on lines +133 to +138
x-data="{ isVisible: false }"
x-init="() => { isVisible = true; setTimeout(() => isVisible = false, 5000) }"
x-show="isVisible"
x-transition:leave="transition ease-in duration-2000"
x-transition:leave-start="opacity-100 transform scale-100"
x-transition:leave-end="opacity-0 transform scale-90"
Copy link
Member

Choose a reason for hiding this comment

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

Can this be done with JS commands? We would like to remove Alpine in the future, so we should prepare for it now and not add more.

Copy link
Collaborator Author

@Elmseld Elmseld Oct 18, 2024

Choose a reason for hiding this comment

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

The best I can do is either this:

    <script>
      setTimeout(() => {
        const infoFlash = document.getElementById("info-flash");

        if (infoFlash) {
          infoFlash.style.transition = "opacity 2s ease-in";
          infoFlash.style.opacity = 0;
          setTimeout(() => infoFlash.remove(), 2000);
        }
      }, 5000);
    </script>

in the html in the flash_messages function(not pretty), since there is no assets with js I can't create a hook.

Or something like this:

    <div
      :if={Phoenix.Flash.get(@flash, :info) && Phoenix.Flash.get(@flash, :info) != ""}
      class="alert bg-info text-info-content my-4 text-sm"
      id="info-flash"
      phx-click-away={JS.hide(to: "#info-flash", transition: {"transition ease-out duration-2000", "opacity-100 transform scale-100", "opacity-0 transform scale-90"})}
    >

That removes the msg when a user is using the page again. But that will remove the msg immediately on click-away which might make it disappear to fast.

lib/backpex/html/resource/form_component.html.heex Outdated Show resolved Hide resolved
lib/backpex/live_components/form_component.ex Outdated Show resolved Hide resolved
lib/backpex/live_components/form_component.ex Outdated Show resolved Hide resolved
lib/backpex/live_components/form_component.ex Outdated Show resolved Hide resolved
@Flo0807 Flo0807 added the feature New feature label Oct 23, 2024
Comment on lines -19 to +22
disabled: []
disabled: [],
enabled: [
{Credo.Check.Consistency.UnusedVariableNames, []}
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

We cannot do this as this will result in only adding the Credo.Check.Consistency.UnusedVariableNames check.

❯ mix credo
Checking 51 source files ...
Analysis took 0.06 seconds (0.06s to load, 0.00s running 1 check on 51 files)

Note that the log displays 1 check only.

The reason is that credo automatically adds all default checks if the enabled key is not defined. If its there, it will use the configured checks only.

Instead of:

checks: %{
  disabled: [],
  enabled: [
    {Credo.Check.Consistency.UnusedVariableNames, []}
  ]
}

we can do this

checks: [
  {Credo.Check.Consistency.UnusedVariableNames, []}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants