Class: Solidstats::Previews::StatsOverviewComponentPreview

Inherits:
ViewComponent::Preview
  • Object
show all
Defined in:
app/components/solidstats/previews/stats_overview_component_preview.rb

Overview

Preview for StatsOverviewComponent

Instance Method Summary collapse

Instance Method Details

#clickable_metricsObject

Clickable metrics



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 27

def clickable_metrics
  metrics = [
    {
      label: "Security Issues",
      value: 3,
      icon: "๐Ÿ”’",
      section: "security",
      tab: "vulnerabilities"
    },
    {
      label: "TODO Items",
      value: 15,
      icon: "๐Ÿ“",
      section: "tasks",
      href: "#tasks"
    }
  ]

  render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
end

#defaultObject

Default metrics overview



8
9
10
11
12
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 8

def default
  render(Solidstats::Ui::StatsOverviewComponent.new(
    metrics: sample_metrics
  ))
end

#different_statusesObject

Metrics with different statuses



15
16
17
18
19
20
21
22
23
24
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 15

def different_statuses
  metrics = [
    { label: "Secure Gems", value: 95, icon: "๐Ÿ”’", status: :ok },
    { label: "Vulnerabilities", value: 3, icon: "โš ๏ธ", status: :warning },
    { label: "Critical Issues", value: 1, icon: "๐Ÿšจ", status: :error },
    { label: "Outdated Gems", value: 12, icon: "๐Ÿ“…", status: :info }
  ]

  render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
end

#value_formatsObject

Various value formats



49
50
51
52
53
54
55
56
57
58
# File 'app/components/solidstats/previews/stats_overview_component_preview.rb', line 49

def value_formats
  metrics = [
    { label: "Test Coverage", value: "94%", icon: "๐Ÿงช", status: :ok },
    { label: "Build Time", value: "2.3s", icon: "โฑ๏ธ", status: :ok },
    { label: "Bundle Size", value: "1.2MB", icon: "๐Ÿ“ฆ", status: :warning },
    { label: "Dependencies", value: 127, icon: "๐Ÿ’Ž", status: :info }
  ]

  render(Solidstats::Ui::StatsOverviewComponent.new(metrics: metrics))
end