solidstats 2.0.0 โ†’ 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -63
  3. data/README.md +27 -0
  4. data/Rakefile +3 -3
  5. data/app/assets/javascripts/solidstats/dashboard.js +0 -46
  6. data/app/assets/stylesheets/solidstats/dashboard.css +48 -0
  7. data/app/controllers/solidstats/dashboard_controller.rb +73 -61
  8. data/app/controllers/solidstats/logs_controller.rb +72 -0
  9. data/app/controllers/solidstats/performance_controller.rb +25 -0
  10. data/app/controllers/solidstats/productivity_controller.rb +39 -0
  11. data/app/controllers/solidstats/quality_controller.rb +152 -0
  12. data/app/controllers/solidstats/securities_controller.rb +30 -0
  13. data/app/helpers/solidstats/application_helper.rb +124 -11
  14. data/app/helpers/solidstats/performance_helper.rb +87 -0
  15. data/app/helpers/solidstats/productivity_helper.rb +38 -0
  16. data/app/services/solidstats/bundler_audit_service.rb +206 -0
  17. data/app/services/solidstats/coverage_compass_service.rb +335 -0
  18. data/app/services/solidstats/load_lens_service.rb +474 -0
  19. data/app/services/solidstats/log_size_monitor_service.rb +197 -66
  20. data/app/services/solidstats/my_todo_service.rb +242 -0
  21. data/app/services/solidstats/style_patrol_service.rb +319 -0
  22. data/app/views/layouts/solidstats/application.html.erb +8 -2
  23. data/app/views/layouts/solidstats/dashboard.html.erb +84 -0
  24. data/app/views/solidstats/dashboard/dashboard.html.erb +39 -0
  25. data/app/views/solidstats/logs/logs_size.html.erb +409 -0
  26. data/app/views/solidstats/performance/load_lens.html.erb +158 -0
  27. data/app/views/solidstats/productivity/_todo_list.html.erb +49 -0
  28. data/app/views/solidstats/productivity/my_todos.html.erb +84 -0
  29. data/app/views/solidstats/quality/coverage_compass.html.erb +420 -0
  30. data/app/views/solidstats/quality/style_patrol.html.erb +463 -0
  31. data/app/views/solidstats/securities/bundler_audit.html.erb +345 -0
  32. data/app/views/solidstats/shared/_dashboard_card.html.erb +160 -0
  33. data/app/views/solidstats/shared/_quick_actions.html.erb +26 -0
  34. data/config/routes.rb +31 -6
  35. data/lib/generators/solidstats/clean/clean_generator.rb +24 -0
  36. data/lib/generators/solidstats/clean/templates/README +8 -0
  37. data/lib/generators/solidstats/install/install_generator.rb +51 -10
  38. data/lib/generators/solidstats/install/templates/README +7 -0
  39. data/lib/solidstats/engine.rb +6 -71
  40. data/lib/solidstats/version.rb +1 -1
  41. data/lib/solidstats.rb +19 -303
  42. data/lib/tasks/solidstats.rake +67 -0
  43. data/lib/tasks/solidstats_performance.rake +61 -0
  44. data/lib/tasks/solidstats_tasks.rake +16 -4
  45. metadata +33 -95
  46. data/app/assets/javascripts/solidstats/gem_metadata.js +0 -554
  47. data/app/assets/stylesheets/solidstats/components/action_button.css +0 -99
  48. data/app/assets/stylesheets/solidstats/components/dashboard.css +0 -151
  49. data/app/assets/stylesheets/solidstats/components/dashboard_header.css +0 -93
  50. data/app/assets/stylesheets/solidstats/components/dashboard_layout.css +0 -97
  51. data/app/assets/stylesheets/solidstats/components/gem_metadata.css +0 -1403
  52. data/app/assets/stylesheets/solidstats/components/navigation.css +0 -80
  53. data/app/assets/stylesheets/solidstats/components/quick_navigation.css +0 -54
  54. data/app/assets/stylesheets/solidstats/components/security.css +0 -332
  55. data/app/assets/stylesheets/solidstats/components/status_badge.css +0 -58
  56. data/app/assets/stylesheets/solidstats/components/summary_card.css +0 -66
  57. data/app/assets/stylesheets/solidstats/components/tab_navigation.css +0 -95
  58. data/app/components/solidstats/base_component.rb +0 -88
  59. data/app/components/solidstats/code_quality/code_quality_section_component.html.erb +0 -0
  60. data/app/components/solidstats/code_quality/code_quality_section_component.rb +0 -0
  61. data/app/components/solidstats/code_quality/section_component.html.erb +0 -45
  62. data/app/components/solidstats/code_quality/section_component.rb +0 -34
  63. data/app/components/solidstats/dashboard_header_component.html.erb +0 -39
  64. data/app/components/solidstats/dashboard_header_component.rb +0 -33
  65. data/app/components/solidstats/previews/action_button_component_preview/button_vs_link.html.erb +0 -6
  66. data/app/components/solidstats/previews/action_button_component_preview/sizes.html.erb +0 -6
  67. data/app/components/solidstats/previews/action_button_component_preview/variants.html.erb +0 -6
  68. data/app/components/solidstats/previews/action_button_component_preview/with_icons.html.erb +0 -6
  69. data/app/components/solidstats/previews/action_button_component_preview.rb +0 -64
  70. data/app/components/solidstats/previews/navigation_component_preview.rb +0 -74
  71. data/app/components/solidstats/previews/stats_overview_component_preview.rb +0 -100
  72. data/app/components/solidstats/previews/status_badge_component_preview/sizes.html.erb +0 -6
  73. data/app/components/solidstats/previews/status_badge_component_preview/statuses.html.erb +0 -6
  74. data/app/components/solidstats/previews/status_badge_component_preview/with_icons.html.erb +0 -6
  75. data/app/components/solidstats/previews/status_badge_component_preview.rb +0 -49
  76. data/app/components/solidstats/previews/summary_card_component_preview/clickable.html.erb +0 -9
  77. data/app/components/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb +0 -9
  78. data/app/components/solidstats/previews/summary_card_component_preview/statuses.html.erb +0 -6
  79. data/app/components/solidstats/previews/summary_card_component_preview/value_formats.html.erb +0 -6
  80. data/app/components/solidstats/previews/summary_card_component_preview.rb +0 -67
  81. data/app/components/solidstats/quick_navigation_component.html.erb +0 -8
  82. data/app/components/solidstats/quick_navigation_component.rb +0 -21
  83. data/app/components/solidstats/security/gem_impact_analysis_component.html.erb +0 -44
  84. data/app/components/solidstats/security/gem_impact_analysis_component.rb +0 -45
  85. data/app/components/solidstats/security/overview_component.html.erb +0 -21
  86. data/app/components/solidstats/security/overview_component.rb +0 -104
  87. data/app/components/solidstats/security/section_component.html.erb +0 -26
  88. data/app/components/solidstats/security/section_component.rb +0 -52
  89. data/app/components/solidstats/security/timeline_component.html.erb +0 -39
  90. data/app/components/solidstats/security/timeline_component.rb +0 -43
  91. data/app/components/solidstats/tasks_section_component.html.erb +0 -17
  92. data/app/components/solidstats/tasks_section_component.rb +0 -22
  93. data/app/components/solidstats/ui/action_button_component.html.erb +0 -6
  94. data/app/components/solidstats/ui/action_button_component.rb +0 -71
  95. data/app/components/solidstats/ui/dashboard_layout_component.html.erb +0 -19
  96. data/app/components/solidstats/ui/dashboard_layout_component.rb +0 -85
  97. data/app/components/solidstats/ui/navigation_component.html.erb +0 -34
  98. data/app/components/solidstats/ui/navigation_component.rb +0 -72
  99. data/app/components/solidstats/ui/stats_overview_component.html.erb +0 -14
  100. data/app/components/solidstats/ui/stats_overview_component.rb +0 -78
  101. data/app/components/solidstats/ui/status_badge_component.html.erb +0 -6
  102. data/app/components/solidstats/ui/status_badge_component.rb +0 -42
  103. data/app/components/solidstats/ui/summary_card_component.html.erb +0 -12
  104. data/app/components/solidstats/ui/summary_card_component.rb +0 -63
  105. data/app/components/solidstats/ui/tab_navigation_component.html.erb +0 -22
  106. data/app/components/solidstats/ui/tab_navigation_component.rb +0 -79
  107. data/app/services/solidstats/audit_service.rb +0 -56
  108. data/app/services/solidstats/data_collector_service.rb +0 -83
  109. data/app/services/solidstats/gem_metadata/fetcher_service.rb +0 -136
  110. data/app/services/solidstats/todo_service.rb +0 -114
  111. data/app/views/solidstats/dashboard/_log_monitor.html.erb +0 -759
  112. data/app/views/solidstats/dashboard/_todos.html.erb +0 -151
  113. data/app/views/solidstats/dashboard/audit/_additional_styles.css +0 -22
  114. data/app/views/solidstats/dashboard/audit/_audit_badge.html.erb +0 -5
  115. data/app/views/solidstats/dashboard/audit/_audit_details.html.erb +0 -495
  116. data/app/views/solidstats/dashboard/audit/_audit_summary.html.erb +0 -26
  117. data/app/views/solidstats/dashboard/audit/_no_vulnerabilities.html.erb +0 -3
  118. data/app/views/solidstats/dashboard/audit/_security_audit.html.erb +0 -14
  119. data/app/views/solidstats/dashboard/audit/_vulnerabilities_table.html.erb +0 -1120
  120. data/app/views/solidstats/dashboard/audit/_vulnerability_details.html.erb +0 -63
  121. data/app/views/solidstats/dashboard/index.html.erb +0 -81
  122. data/app/views/solidstats/gem_metadata/_panel.html.erb +0 -419
  123. data/lib/generators/solidstats/feature/feature_generator.rb +0 -170
  124. data/lib/generators/solidstats/feature/templates/component.html.erb +0 -84
  125. data/lib/generators/solidstats/feature/templates/component.rb.erb +0 -103
  126. data/lib/generators/solidstats/feature/templates/component.scss +0 -243
  127. data/lib/generators/solidstats/feature/templates/component_test.rb.erb +0 -183
  128. data/lib/generators/solidstats/feature/templates/controller.rb.erb +0 -44
  129. data/lib/generators/solidstats/feature/templates/controller_test.rb.erb +0 -111
  130. data/lib/generators/solidstats/feature/templates/detail_view.html.erb +0 -755
  131. data/lib/generators/solidstats/feature/templates/preview.rb.erb +0 -107
  132. data/lib/generators/solidstats/feature/templates/service.rb.erb +0 -132
  133. data/lib/generators/solidstats/feature/templates/service_test.rb.erb +0 -109
  134. data/lib/generators/solidstats/install_generator.rb +0 -109
  135. data/lib/tasks/solidstats_install.rake +0 -133
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- # Base component class for all Solidstats ViewComponents
5
- # Provides common functionality and conventions for the component system
6
- class BaseComponent < ViewComponent::Base
7
- # Common helper methods available to all Solidstats components
8
-
9
- # Standard status classes for consistent styling
10
- def status_class(status)
11
- case status&.to_sym
12
- when :good, :ok
13
- "status-good"
14
- when :warning
15
- "status-warning"
16
- when :critical, :danger
17
- "status-critical"
18
- when :info
19
- "status-info"
20
- else
21
- "status-unknown"
22
- end
23
- end
24
-
25
- # Standard status icons
26
- def status_icon(status)
27
- case status&.to_sym
28
- when :good, :ok
29
- "โœ…"
30
- when :warning
31
- "โš ๏ธ"
32
- when :critical, :danger
33
- "โŒ"
34
- when :info
35
- "โ„น๏ธ"
36
- else
37
- "โ“"
38
- end
39
- end
40
-
41
- # Standard status text
42
- def status_text(status)
43
- case status&.to_sym
44
- when :good, :ok
45
- "Good"
46
- when :warning
47
- "Warning"
48
- when :critical, :danger
49
- "Critical"
50
- when :info
51
- "Info"
52
- else
53
- "Unknown"
54
- end
55
- end
56
-
57
- # Helper for formatting numbers with delimiters
58
- def format_number(number)
59
- return "0" if number.nil?
60
-
61
- case number
62
- when Numeric
63
- number_with_delimiter(number)
64
- else
65
- number.to_s
66
- end
67
- end
68
-
69
- # Helper for safe data access with fallbacks
70
- def safe_get(data, key, fallback = nil)
71
- return fallback if data.nil?
72
-
73
- data.is_a?(Hash) ? data[key] || data[key.to_s] || fallback : fallback
74
- end
75
-
76
- # CSS class helper for dynamic classes
77
- def css_classes(*classes)
78
- classes.compact.reject(&:empty?).join(" ")
79
- end
80
-
81
- private
82
-
83
- # Access to Rails number helpers
84
- def number_with_delimiter(number, options = {})
85
- ActionController::Base.helpers.number_with_delimiter(number, options)
86
- end
87
- end
88
- end
@@ -1,45 +0,0 @@
1
- <section id="code-quality" class="dashboard-section">
2
- <h2 class="section-title">Code Quality</h2>
3
-
4
- <%= render Solidstats::Ui::TabNavigationComponent.new(tabs: tab_items) %>
5
-
6
- <div class="tabs-content">
7
- <div class="tab-content active" id="quality-metrics">
8
- <div class="stat-card">
9
- <h2><span class="icon">๐Ÿงน</span> Code Quality</h2>
10
- <div class="card-content">
11
- <div class="metric">
12
- <!-- Your code quality metrics -->
13
- </div>
14
- </div>
15
- </div>
16
- </div>
17
-
18
- <div class="tab-content" id="test-coverage">
19
- <div class="stat-card <%= coverage_status %>">
20
- <h2><span class="icon">๐Ÿงช</span> Test Coverage</h2>
21
- <div class="card-content">
22
- <div class="progress-container">
23
- <div class="progress-bar" style="width: <%= coverage %>%"></div>
24
- </div>
25
- <div class="metric">
26
- <span class="metric-value"><%= coverage %>%</span>
27
- </div>
28
- </div>
29
- </div>
30
- </div>
31
-
32
- <div class="tab-content" id="code-health">
33
- <div class="stat-card">
34
- <h2><span class="icon">๐Ÿ“</span> Code Health</h2>
35
- <div class="card-content">
36
- <!-- Your code health metrics -->
37
- </div>
38
- </div>
39
- </div>
40
-
41
- <div class="tab-content" id="log-monitor">
42
- <%= render partial: 'solidstats/dashboard/log_monitor' %>
43
- </div>
44
- </div>
45
- </section>
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- module CodeQuality
5
- class SectionComponent < BaseComponent
6
- def initialize(coverage:, log_data:)
7
- @coverage = coverage
8
- @log_data = log_data
9
- super()
10
- end
11
-
12
- private
13
-
14
- attr_reader :coverage, :log_data
15
-
16
- def tab_items
17
- [
18
- { id: "quality-metrics", label: "Metrics", active: true },
19
- { id: "test-coverage", label: "Test Coverage" },
20
- { id: "code-health", label: "Code Health" },
21
- { id: "log-monitor", label: "Log Monitor", icon: "๐Ÿ“Š" }
22
- ]
23
- end
24
-
25
- def coverage_status
26
- case coverage.to_f
27
- when 80..Float::INFINITY then "status-ok"
28
- when 60...80 then "status-warning"
29
- else "status-danger"
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,39 +0,0 @@
1
- <header class="dashboard-header">
2
- <div class="header-content">
3
- <div class="header-title">
4
- <h1>Solidstats Dashboard</h1>
5
- <div class="last-updated">
6
- Last updated: <%= last_updated_date %>
7
- </div>
8
- </div>
9
-
10
- <div class="header-actions">
11
- <button class="action-button" onclick="refreshAudit(); return false;">
12
- <span class="action-icon">โ†ป</span>
13
- Refresh
14
- </button>
15
- <button class="action-button action-button--disabled" disabled title="Export is currently disabled">
16
- <span class="action-icon">โ†“</span>
17
- Export
18
- </button>
19
- </div>
20
- </div>
21
-
22
- <nav class="dashboard-nav">
23
- <ul class="nav-list">
24
- <% navigation_items.each do |item| %>
25
- <li>
26
- <% if item[:external] %>
27
- <%= link_to item[:label], item[:href], class: "nav-item #{'active' if item[:active]}" %>
28
- <% else %>
29
- <a href="<%= item[:href] %>"
30
- class="nav-item <%= 'active' if item[:active] %>"
31
- data-section="<%= item[:id] %>">
32
- <%= item[:label] %>
33
- </a>
34
- <% end %>
35
- </li>
36
- <% end %>
37
- </ul>
38
- </nav>
39
- </header>
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- class DashboardHeaderComponent < BaseComponent
5
- def initialize(audit_output:)
6
- @audit_output = audit_output
7
- super()
8
- end
9
-
10
- private
11
-
12
- attr_reader :audit_output
13
-
14
- def last_updated_date
15
- created_at = audit_output.dig("created_at")
16
- if created_at
17
- DateTime.parse(created_at).strftime("%B %d, %Y at %H:%M")
18
- else
19
- Time.now.strftime("%B %d, %Y at %H:%M")
20
- end
21
- end
22
-
23
- def navigation_items
24
- [
25
- { id: "overview", label: "Overview", href: "#overview", active: true },
26
- { id: "security", label: "Security", href: "#security" },
27
- { id: "code-quality", label: "Code Quality", href: "#code-quality" },
28
- { id: "tasks", label: "Tasks", href: "#tasks" },
29
- { id: "gem-metadata", label: "Gem Metadata", href: "#gem-metadata" }
30
- ]
31
- end
32
- end
33
- end
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/button_vs_link.html.erb %>
2
- <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
3
- <% elements.each do |element_config| %>
4
- <%= render(Solidstats::Ui::ActionButtonComponent.new(**element_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/sizes.html.erb %>
2
- <div style="display: flex; gap: 1rem; align-items: center; padding: 1rem;">
3
- <% buttons.each do |button_config| %>
4
- <%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/variants.html.erb %>
2
- <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
3
- <% buttons.each do |button_config| %>
4
- <%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/action_button_component_preview/with_icons.html.erb %>
2
- <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
3
- <% buttons.each do |button_config| %>
4
- <%= render(Solidstats::Ui::ActionButtonComponent.new(**button_config)) %>
5
- <% end %>
6
- </div>
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- module Previews
5
- # Preview for ActionButtonComponent
6
- class ActionButtonComponentPreview < ViewComponent::Preview
7
- # Default action button
8
- def default
9
- render(Solidstats::Ui::ActionButtonComponent.new(
10
- text: "Click Me",
11
- href: "#",
12
- variant: :primary
13
- ))
14
- end
15
-
16
- # Different variants
17
- def variants
18
- render_with_template(locals: {
19
- buttons: [
20
- { text: "Primary", href: "#", variant: :primary },
21
- { text: "Secondary", href: "#", variant: :secondary },
22
- { text: "Outline", href: "#", variant: :outline },
23
- { text: "Ghost", href: "#", variant: :ghost },
24
- { text: "Danger", href: "#", variant: :danger }
25
- ]
26
- })
27
- end
28
-
29
- # Different sizes
30
- def sizes
31
- render_with_template(locals: {
32
- buttons: [
33
- { text: "Small", href: "#", variant: :primary, size: :small },
34
- { text: "Medium", href: "#", variant: :primary, size: :medium },
35
- { text: "Large", href: "#", variant: :primary, size: :large }
36
- ]
37
- })
38
- end
39
-
40
- # With icons
41
- def with_icons
42
- render_with_template(locals: {
43
- buttons: [
44
- { text: "Download", href: "#", variant: :primary, icon: "โฌ‡" },
45
- { text: "Edit", href: "#", variant: :secondary, icon: "โœ" },
46
- { text: "Delete", href: "#", variant: :danger, icon: "๐Ÿ—‘" },
47
- { text: "Refresh", href: "#", variant: :outline, icon: "๐Ÿ”„" }
48
- ]
49
- })
50
- end
51
-
52
- # As buttons vs links
53
- def button_vs_link
54
- render_with_template(locals: {
55
- elements: [
56
- { text: "Link Button", href: "#", variant: :primary },
57
- { text: "Submit Button", variant: :primary, type: "submit" },
58
- { text: "Regular Button", variant: :secondary, type: "button" }
59
- ]
60
- })
61
- end
62
- end
63
- end
64
- end
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- module Previews
5
- # Preview for NavigationComponent
6
- class NavigationComponentPreview < ViewComponent::Preview
7
- # Default navigation
8
- def default
9
- render(Solidstats::Ui::NavigationComponent.new(
10
- current_section: "overview",
11
- sections: default_sections,
12
- actions: default_actions
13
- ))
14
- end
15
-
16
- # Navigation with different current section
17
- def different_current_section
18
- render(Solidstats::Ui::NavigationComponent.new(
19
- current_section: "security",
20
- sections: default_sections,
21
- actions: default_actions
22
- ))
23
- end
24
-
25
- # Navigation without actions
26
- def sections_only
27
- render(Solidstats::Ui::NavigationComponent.new(
28
- current_section: "overview",
29
- sections: default_sections,
30
- actions: []
31
- ))
32
- end
33
-
34
- # Custom sections and actions
35
- def custom_configuration
36
- custom_sections = [
37
- { id: "home", label: "Home", href: "/" },
38
- { id: "settings", label: "Settings", href: "/settings" },
39
- { id: "help", label: "Help", href: "/help" }
40
- ]
41
-
42
- custom_actions = [
43
- { label: "Save", icon: "๐Ÿ’พ", href: "#", onclick: "save(); return false;" },
44
- { label: "Reset", icon: "๐Ÿ”„", href: "#", onclick: "reset(); return false;" }
45
- ]
46
-
47
- render(Solidstats::Ui::NavigationComponent.new(
48
- current_section: "home",
49
- sections: custom_sections,
50
- actions: custom_actions
51
- ))
52
- end
53
-
54
- private
55
-
56
- def default_sections
57
- [
58
- { id: "overview", label: "Overview" },
59
- { id: "security", label: "Security" },
60
- { id: "code-quality", label: "Code Quality" },
61
- { id: "tasks", label: "Tasks" },
62
- { id: "gem-metadata", label: "Gem Metadata", href: "#gem-metadata" }
63
- ]
64
- end
65
-
66
- def default_actions
67
- [
68
- { label: "Refresh", icon: "โ†ป", href: "#", onclick: "refresh(); return false;" },
69
- { label: "Export", icon: "โ†“", disabled: true, disabled_reason: "Export disabled" }
70
- ]
71
- end
72
- end
73
- end
74
- end
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- module Previews
5
- # Preview for StatsOverviewComponent
6
- class StatsOverviewComponentPreview < ViewComponent::Preview
7
- # Default metrics overview
8
- def default
9
- render(Solidstats::Ui::StatsOverviewComponent.new(
10
- metrics: sample_metrics
11
- ))
12
- end
13
-
14
- # Metrics with different statuses
15
- def different_statuses
16
- metrics = [
17
- { label: "Secure Gems", value: 95, icon: "๐Ÿ”’", status: :ok },
18
- { label: "Vulnerabilities", value: 3, icon: "โš ๏ธ", status: :warning },
19
- { label: "Critical Issues", value: 1, icon: "๐Ÿšจ", status: :error },
20
- { label: "Outdated Gems", value: 12, icon: "๐Ÿ“…", status: :info }
21
- ]
22
-
23
- render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
24
- end
25
-
26
- # Clickable metrics
27
- def clickable_metrics
28
- metrics = [
29
- {
30
- label: "Security Issues",
31
- value: 3,
32
- icon: "๐Ÿ”’",
33
- section: "security",
34
- tab: "vulnerabilities"
35
- },
36
- {
37
- label: "TODO Items",
38
- value: 15,
39
- icon: "๐Ÿ“",
40
- section: "tasks",
41
- href: "#tasks"
42
- }
43
- ]
44
-
45
- render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
46
- end
47
-
48
- # Various value formats
49
- def value_formats
50
- metrics = [
51
- { label: "Test Coverage", value: "94%", icon: "๐Ÿงช", status: :ok },
52
- { label: "Build Time", value: "2.3s", icon: "โฑ๏ธ", status: :ok },
53
- { label: "Bundle Size", value: "1.2MB", icon: "๐Ÿ“ฆ", status: :warning },
54
- { label: "Dependencies", value: 127, icon: "๐Ÿ’Ž", status: :info }
55
- ]
56
-
57
- render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
58
- end
59
-
60
- private
61
-
62
- def sample_metrics
63
- [
64
- {
65
- label: "Security Issues",
66
- value: 0,
67
- icon: "๐Ÿ”’",
68
- zero_is_good: true,
69
- section: "security"
70
- },
71
- {
72
- label: "Gem Dependencies",
73
- value: 127,
74
- icon: "๐Ÿ’Ž",
75
- status: :info
76
- },
77
- {
78
- label: "TODO Items",
79
- value: 8,
80
- icon: "๐Ÿ“",
81
- section: "tasks",
82
- tab: "todos"
83
- },
84
- {
85
- label: "Test Coverage",
86
- value: "94%",
87
- icon: "๐Ÿงช",
88
- thresholds: { excellent: 90, good: 80, warning: 60 }
89
- },
90
- {
91
- label: "Log Files Size",
92
- value: "2.3MB",
93
- icon: "๐Ÿ“Š",
94
- status: :ok
95
- }
96
- ]
97
- end
98
- end
99
- end
100
- end
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/sizes.html.erb %>
2
- <div style="display: flex; gap: 1rem; align-items: center; padding: 1rem;">
3
- <% sizes.each do |badge_config| %>
4
- <%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/statuses.html.erb %>
2
- <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
3
- <% statuses.each do |badge_config| %>
4
- <%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/status_badge_component_preview/with_icons.html.erb %>
2
- <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
3
- <% badges.each do |badge_config| %>
4
- <%= render(Solidstats::Ui::StatusBadgeComponent.new(**badge_config)) %>
5
- <% end %>
6
- </div>
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Solidstats
4
- module Previews
5
- # Preview for StatusBadgeComponent
6
- class StatusBadgeComponentPreview < ViewComponent::Preview
7
- # Default status badge
8
- def default
9
- render(Solidstats::Ui::StatusBadgeComponent.new(status: :ok, text: "All Good"))
10
- end
11
-
12
- # Different status variants
13
- def statuses
14
- render_with_template(locals: {
15
- statuses: [
16
- { status: :ok, text: "Secure" },
17
- { status: :warning, text: "Minor Issues" },
18
- { status: :error, text: "Vulnerabilities Found" },
19
- { status: :info, text: "Info Available" },
20
- { status: :critical, text: "Critical Issues" }
21
- ]
22
- })
23
- end
24
-
25
- # Different sizes
26
- def sizes
27
- render_with_template(locals: {
28
- sizes: [
29
- { size: :small, status: :ok, text: "Small" },
30
- { size: :medium, status: :warning, text: "Medium" },
31
- { size: :large, status: :error, text: "Large" }
32
- ]
33
- })
34
- end
35
-
36
- # With icons
37
- def with_icons
38
- render_with_template(locals: {
39
- badges: [
40
- { status: :ok, text: "Secure", icon: "โœ“" },
41
- { status: :warning, text: "Warning", icon: "โš " },
42
- { status: :error, text: "Error", icon: "โœ—" },
43
- { status: :info, text: "Info", icon: "โ„น" }
44
- ]
45
- })
46
- end
47
- end
48
- end
49
- end
@@ -1,9 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/clickable.html.erb %>
2
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
3
- <% cards.each do |card_config| %>
4
- <%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
5
- <% end %>
6
- </div>
7
- <p style="padding: 1rem; font-size: 0.875rem; color: #6b7280;">
8
- These cards are clickable and will navigate to their respective sections.
9
- </p>
@@ -1,9 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/dashboard_layout.html.erb %>
2
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem; background-color: #f9fafb; border-radius: 0.5rem;">
3
- <% metrics.each do |metric_config| %>
4
- <%= render(Solidstats::Ui::SummaryCardComponent.new(**metric_config)) %>
5
- <% end %>
6
- </div>
7
- <p style="padding: 1rem; font-size: 0.875rem; color: #6b7280;">
8
- Example dashboard layout showing how summary cards work together to provide a comprehensive overview.
9
- </p>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/statuses.html.erb %>
2
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
3
- <% cards.each do |card_config| %>
4
- <%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
5
- <% end %>
6
- </div>
@@ -1,6 +0,0 @@
1
- <%# filepath: /Users/mezbah/microstartup/infolily_organizer/gems/solidstats/previews/summary_card_component_preview/value_formats.html.erb %>
2
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem;">
3
- <% cards.each do |card_config| %>
4
- <%= render(Solidstats::Ui::SummaryCardComponent.new(**card_config)) %>
5
- <% end %>
6
- </div>