templates

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

templ: version: v0.3.977

templ: version: v0.3.977

templ: version: v0.3.977

Package templates contains view model types for templating. These types mirror the analytics types to avoid import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bar

func Bar(label string, value int, max int) templ.Component

Bar renders a progress bar

func BotStatsFragment

func BotStatsFragment(stats *BotStatsViewModel, periodDays int, hourly bool, monthly bool) templ.Component

BotStatsFragment renders the complete bot stats view as HTML fragment

func BotStatsFragmentOnly

func BotStatsFragmentOnly(stats *BotStatsViewModel, days int, hourly bool, monthly bool) templ.Component

BotStatsFragmentOnly renders only the bot stats content without period selector (for talkdom updates)

func BotStatsGrid

func BotStatsGrid(stats *BotStatsViewModel) templ.Component

BotStatsGrid renders the bot stats grid

func BotTopPagesSection

func BotTopPagesSection(pages []PageStatViewModel) templ.Component

BotTopPagesSection renders the top pages for bots

func BotViewsChartSection

func BotViewsChartSection(dailyVisits []DailyViewViewModel, hourly bool, monthly bool) templ.Component

BotViewsChartSection renders the bot views over time chart

func Chart

func Chart(data []DailyViewViewModel) templ.Component

Chart renders a bar chart

func ChartBar

func ChartBar(item DailyViewViewModel, maxViews int) templ.Component

ChartBar renders a single bar in the chart

func ContentContainer

func ContentContainer() templ.Component

ContentContainer renders the main content area

func Dashboard

func Dashboard() templ.Component

Dashboard renders the main analytics dashboard page with talkDOM

func DimensionRow

func DimensionRow(stat DimensionStatViewModel, maxCount int) templ.Component

DimensionRow renders a single dimension row with bar

func DimensionSection

func DimensionSection(title string, stats []DimensionStatViewModel) templ.Component

DimensionSection renders a dimension stats section

func DimensionStatsSections

func DimensionStatsSections(browsers, os, devices, referrers []DimensionStatViewModel) templ.Component

DimensionStatsSections renders all dimension stats (browsers, OS, devices, referrers)

func LatestPageRow

func LatestPageRow(page LatestPageVisitViewModel) templ.Component

LatestPageRow renders a single latest page row

func LatestPagesSection

func LatestPagesSection(pages []LatestPageVisitViewModel) templ.Component

LatestPagesSection renders the latest visited pages

func Layout

func Layout(title string, activeTab string) templ.Component

Layout renders the base HTML layout with talkDOM and Tailwind CSS

func PageRow

func PageRow(page PageStatViewModel, maxViews int) templ.Component

PageRow renders a single page row with bar

func PeriodSelector

func PeriodSelector(activePeriod string) templ.Component

PeriodSelector renders the period buttons

func PeriodSelectorWithBotStats

func PeriodSelectorWithBotStats(period string, stats *BotStatsViewModel, days int, hourly bool, monthly bool) templ.Component

PeriodSelectorWithBotStats renders the period selector with bot stats content

func PeriodSelectorWithStats

func PeriodSelectorWithStats(period string, stats *StatsViewModel, realtime int, days int, hourly bool, monthly bool) templ.Component

PeriodSelectorWithStats renders the period selector with visitor stats content

func SetupContent

func SetupContent(origin string) templ.Component

SetupContent renders the setup tab content

func SetupFragment

func SetupFragment(origin string) templ.Component

SetupFragment renders the setup tab content

func StatsFragment

func StatsFragment(stats *StatsViewModel, realtime int, periodDays int, hourly bool, monthly bool) templ.Component

StatsFragment renders the complete stats view as HTML fragment

func StatsFragmentOnly

func StatsFragmentOnly(stats *StatsViewModel, realtime int, days int, hourly bool, monthly bool) templ.Component

StatsFragmentOnly renders only the stats content without period selector (for talkdom updates)

func StatsGridStats

func StatsGridStats(stats *StatsViewModel, realtime int) templ.Component

StatsGridStats renders the main stat cards

func TabSelector

func TabSelector(activeTab string) templ.Component

TabSelector renders the tab navigation

func TopBotsSection

func TopBotsSection(bots []DimensionStatViewModel) templ.Component

TopBotsSection renders the top bots table

func TopPagesSection

func TopPagesSection(pages []PageStatViewModel) templ.Component

TopPagesSection renders the top pages table

func ViewsChartSection

func ViewsChartSection(dailyViews []DailyViewViewModel, hourly bool, monthly bool) templ.Component

ViewsChartSection renders the views over time chart

Types

type BotStatsViewModel

type BotStatsViewModel struct {
	Period      string
	TotalVisits int
	TopBots     []DimensionStatViewModel
	TopPages    []PageStatViewModel
	DailyVisits []DailyViewViewModel
}

BotStatsViewModel represents bot analytics statistics for templating.

type DailyViewViewModel

type DailyViewViewModel struct {
	Date  string
	Views int
}

DailyViewViewModel represents views per day.

type DimensionStatViewModel

type DimensionStatViewModel struct {
	Name  string
	Count int
}

DimensionStatViewModel represents a dimension breakdown.

type LatestPageVisitViewModel

type LatestPageVisitViewModel struct {
	Path      string
	Timestamp string
	Browser   string
}

LatestPageVisitViewModel represents a single recent page visit.

type PageStatViewModel

type PageStatViewModel struct {
	Path  string
	Views int
}

PageStatViewModel represents page view statistics.

type StatsViewModel

type StatsViewModel struct {
	Period         string
	UniqueVisitors int
	TotalViews     int
	AvgDuration    int
	TopPages       []PageStatViewModel
	LatestPages    []LatestPageVisitViewModel
	BrowserStats   []DimensionStatViewModel
	OSStats        []DimensionStatViewModel
	DeviceStats    []DimensionStatViewModel
	ReferrerStats  []DimensionStatViewModel
	DailyViews     []DailyViewViewModel
}

StatsViewModel represents analytics statistics for templating.

Jump to

Keyboard shortcuts

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