components

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package components provides UI components for the profiler example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateControlsPanel

func CreateControlsPanel(props ControlsPanelProps) (bubbly.Component, error)

CreateControlsPanel creates a component with profiler controls. This demonstrates: - Callback props for parent communication - Using BubblyUI Text components - Dynamic styling based on focus and state

func CreateMetricsPanel

func CreateMetricsPanel(props MetricsPanelProps) (bubbly.Component, error)

CreateMetricsPanel creates a component that displays profiler metrics. This demonstrates: - Component factory pattern - Props-based composition - Using BubblyUI Card and Text components - Dynamic styling based on focus state

func CreateStatusBar

func CreateStatusBar(props StatusBarProps) (bubbly.Component, error)

CreateStatusBar creates a status bar component. This demonstrates: - Using HStack for horizontal layout - Badge component for status indicators - Computed values for derived state

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration for display.

Types

type ControlsPanelProps

type ControlsPanelProps struct {
	// IsRunning indicates if the profiler is running
	IsRunning *bubbly.Ref[bool]

	// Focused indicates if this panel has focus
	Focused *bubbly.Ref[bool]

	// OnToggle is called when the profiler should be toggled
	OnToggle func()

	// OnReset is called when metrics should be reset
	OnReset func()

	// OnExport is called when report should be exported
	OnExport func()
}

ControlsPanelProps defines the props for the ControlsPanel component.

type FocusPane

type FocusPane int

FocusPane represents which panel is currently focused.

const (
	// FocusMetrics indicates the metrics panel is focused.
	FocusMetrics FocusPane = iota
	// FocusControls indicates the controls panel is focused.
	FocusControls
)

func (FocusPane) String

func (f FocusPane) String() string

String returns the string representation of the focus pane.

type MetricsPanelProps

type MetricsPanelProps struct {
	// Metrics holds the current profiler metrics
	Metrics *bubbly.Ref[*composables.ProfilerMetrics]

	// Focused indicates if this panel has focus
	Focused *bubbly.Ref[bool]

	// IsRunning indicates if the profiler is running
	IsRunning *bubbly.Ref[bool]
}

MetricsPanelProps defines the props for the MetricsPanel component.

type StatusBarProps

type StatusBarProps struct {
	// IsRunning indicates if the profiler is running
	IsRunning *bubbly.Ref[bool]

	// StartTime is when profiling started (used to calculate duration)
	StartTime *bubbly.Ref[time.Time]

	// FocusedPane indicates which panel is focused
	FocusedPane *bubbly.Ref[FocusPane]

	// LastExport holds the last export filename
	LastExport *bubbly.Ref[string]
}

StatusBarProps defines the props for the StatusBar component.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL