component

package
v0.0.0-...-c858694 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package component contains individual components that can render themselves as HTML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	User users.User
	Size int // In pixels, e.g., 48.
	// contains filtered or unexported fields
}

Avatar is an avatar component.

func (Avatar) Render

func (a Avatar) Render() []*html.Node

type ChangeBadge

type ChangeBadge struct {
	State state.Change
}

ChangeBadge is a change badge, displaying the change's state.

func (ChangeBadge) Render

func (cb ChangeBadge) Render() []*html.Node

type ChangeEntry

type ChangeEntry struct {
	Change change.Change
	Unread bool // Unread indicates whether the change contains unread notifications for authenticated user.

	// TODO, THINK: This is router details, can it be factored out or cleaned up?
	BaseURL string
}

ChangeEntry is an entry within the list of changes.

func (ChangeEntry) Render

func (i ChangeEntry) Render() []*html.Node

type ChangeIcon

type ChangeIcon struct {
	State state.Change
}

ChangeIcon is a change icon, displaying the change's state.

func (ChangeIcon) Render

func (ii ChangeIcon) Render() []*html.Node

type ChangeStateBadge

type ChangeStateBadge struct {
	Change change.Change
}

ChangeStateBadge is a component that displays the state of a change with a badge, who opened it, and when it was opened.

func (ChangeStateBadge) Render

func (i ChangeStateBadge) Render() []*html.Node

type Changes

type Changes struct {
	ChangesNav ChangesNav
	Filter     change.StateFilter
	Entries    []ChangeEntry
}

Changes is a component that displays a page of changes, with a navigation bar on top.

func (Changes) Render

func (i Changes) Render() []*html.Node

type ChangesNav

type ChangesNav struct {
	OpenCount     uint64     // Open changes count.
	ClosedCount   uint64     // Closed changes count.
	Path          string     // URL path of current page (needed to generate correct links).
	Query         url.Values // URL query of current page (needed to generate correct links).
	StateQueryKey string     // Name of query key for controlling change state filter. Constant, but provided externally.
}

ChangesNav is a navigation component for displaying a header for a list of changes. It contains tabs to switch between viewing open and closed changes.

func (ChangesNav) Render

func (n ChangesNav) Render() []*html.Node

type ClosedChangesTab

type ClosedChangesTab struct {
	Count uint64 // Count of closed changes.
}

ClosedChangesTab is a "Closed Changes Tab" component.

func (ClosedChangesTab) Render

func (t ClosedChangesTab) Render() []*html.Node

type Event

type Event struct {
	Event change.TimelineItem

	// State must have BaseURL and ChangeID fields populated.
	// They are used while rendering change.CommitEvent events.
	BaseURL  string
	ChangeID uint64
}

Event is an event component.

func (Event) Render

func (e Event) Render() []*html.Node

type OpenChangesTab

type OpenChangesTab struct {
	Count uint64 // Count of open changes.
}

OpenChangesTab is an "Open Changes Tab" component.

func (OpenChangesTab) Render

func (t OpenChangesTab) Render() []*html.Node

type Time

type Time struct {
	Time time.Time
}

Time component that displays human friendly relative time (e.g., "2 hours ago", "yesterday"), but also contains a tooltip with the full absolute time (e.g., "Jan 2, 2006, 3:04 PM MST").

TODO: Factor out, it's the same as in notificationsapp.

func (Time) Render

func (t Time) Render() []*html.Node

type User

type User struct {
	User users.User
}

User is a user component.

func (User) Render

func (u User) Render() []*html.Node

Jump to

Keyboard shortcuts

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