-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go 244/blank results visualization (#504)
Add empty states --------- Co-authored-by: stage-rl <[email protected]> Co-authored-by: Jan Suchal <[email protected]>
- Loading branch information
1 parent
81d334a
commit a777ed4
Showing
18 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="mx-auto text-center p-12"> | ||
<%= render Common::IconComponent.new(@icon, classes: "mx-auto size-20 text-gray-400") %> | ||
|
||
<h3 class="mt-2 text-sm font-semibold text-gray-900"><%= @header %></h3> | ||
<p class="mt-1 text-sm text-gray-500 max-w-md mx-auto"><%= @description %></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Common | ||
class BlankResultsComponent < ViewComponent::Base | ||
def initialize (reason = :not_found) | ||
@reason = reason | ||
end | ||
|
||
def before_render | ||
icon_mappings = { | ||
filters: "bookmark-slash", | ||
rules: "funnel-slash", | ||
tags: "tag-slash", | ||
not_found: "magnifying-glass", | ||
boxes: "inbox-stack", | ||
} | ||
|
||
@header = t "blank_results.#{@reason}.header" | ||
@description = t "blank_results.#{@reason}.description" | ||
@icon = icon_mappings[@reason] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
</ul> | ||
<%= next_page_area %> | ||
<% end %> | ||
<%= blank_results_area %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
app/components/settings/rules/automation_rules_list_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class Settings::Rules::AutomationRulesListComponent < ViewComponent::Base | ||
renders_many :automation_rules | ||
renders_one :blank_results_area | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
<%= render Admin::Tags::TagsListComponent.new(simple_tags: @simple_tags) %> | ||
<%= render Admin::Tags::TagsListComponent.new(simple_tags: @simple_tags) do |component| %> | ||
<% if @simple_tags.empty? %> | ||
<% component.with_blank_results_area do %> | ||
<%= render Common::BlankResultsComponent.new(:tags) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
<%= render Filters::FiltersListComponent.new(@filters) %> | ||
<%= render Filters::FiltersListComponent.new(@filters) do |component| %> | ||
<% if @filters.empty? %> | ||
<% component.with_blank_results_area do %> | ||
<%= render Common::BlankResultsComponent.new(:filters) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
<%= render Settings::Rules::AutomationRulesListComponent.new do |component| %> | ||
<% @automation_rules.each do |automation_rule| %> | ||
<% component.with_automation_rule do %> | ||
<%= render Settings::Rules::AutomationRulesTableRowComponent.new(automation_rule) %> | ||
<% if @automation_rules.any? %> | ||
<% @automation_rules.each do |automation_rule| %> | ||
<% component.with_automation_rule do %> | ||
<%= render Settings::Rules::AutomationRulesTableRowComponent.new(automation_rule) %> | ||
<% end %> | ||
<% end %> | ||
<% else %> | ||
<% component.with_blank_results_area do %> | ||
<%= render Common::BlankResultsComponent.new(:rules) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters