Documentation
¶
Overview ¶
Package issueview fetches one td issue and renders it as a reusable card.
Hosts size the card and decide when it is active. An active card walks parent/child/sibling issues with the arrow keys; an inactive one only scrolls, so a modal can share those keys with its own chrome until the user tabs to the card and presses enter, or clicks it.
Index ¶
- func Description(renderer *markdown.Renderer, d *Data, width int) string
- func Fetch(workDir, issueID string) tea.Cmd
- func Heading(d *Data) string
- func LabelsLine(d *Data) string
- func ParentLine(d *Data) string
- func StatusLabel(status string) string
- func StatusLine(d *Data) string
- type ActionHint
- type Data
- type FetchedMsg
- type Hit
- type HitKind
- type LoadedMsg
- type Log
- type Model
- func (m *Model) ActionHints() []ActionHint
- func (m *Model) Active() bool
- func (m *Model) Data() *Data
- func (m *Model) Err() error
- func (m *Model) Focused() bool
- func (m *Model) HandleClick(x, y int) (HitKind, tea.Cmd)
- func (m *Model) HandleHover(x, y int)
- func (m *Model) HandleKey(k tea.KeyMsg) (bool, tea.Cmd)
- func (m *Model) Hits() []Hit
- func (m *Model) IssueID() string
- func (m *Model) Load(modelID int, workDir, issueID string, epoch uint64) tea.Cmd
- func (m *Model) Loading() bool
- func (m *Model) OpenSelection() tea.Cmd
- func (m *Model) Scroll(delta int)
- func (m *Model) ScrollOffset() int
- func (m *Model) SelectedID() string
- func (m *Model) SetActionHints(hints []ActionHint)
- func (m *Model) SetActive(active bool)
- func (m *Model) SetData(d *Data)
- func (m *Model) SetFocused(focused bool)
- func (m *Model) SetPendingScroll(offset int)
- func (m *Model) SetResult(msg LoadedMsg) bool
- func (m *Model) SetSize(width, height int)
- func (m *Model) Title() string
- func (m *Model) View() string
- type Ref
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Description ¶
Description renders the issue body as markdown wrapped to width, falling back to the raw text when no renderer is available. A nil renderer builds the default one.
func Fetch ¶
Fetch runs `td show` and, when that succeeds, `td tree` so the card can show subtasks and walk an epic's children. workDir sets the command's working directory so td uses the correct project database.
func Heading ¶
Heading is the issue's headline: "<id>: <title>". Hosts use this for chrome (pane chips, modal titles) so the card can draw the id separately.
func StatusLabel ¶
StatusLabel turns a td status token into the uppercase label the card draws, using the model's names rather than invented ones (in_review stays IN REVIEW, not REVIEWABLE).
func StatusLine ¶
StatusLine joins the issue's status, type, priority, and points. Kept for hosts that still want a single meta row.
Types ¶
type ActionHint ¶
type ActionHint struct {
Key, Label string
}
ActionHint is one key/label pair drawn in the card's ACTIONS row.
type Data ¶
type Data struct {
ID string `json:"id"`
Title string `json:"title"`
Status string `json:"status"`
Type string `json:"type"`
Priority string `json:"priority"`
Points int `json:"points"`
Description string `json:"description"`
Acceptance string `json:"acceptance"`
ParentID string `json:"parent_id"`
Labels []string `json:"labels"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Logs []Log `json:"logs"`
// Filled by a follow-up tree fetch; not present on `td show` JSON.
Parent *Ref `json:"-"`
Children []Ref `json:"-"`
Siblings []Ref `json:"-"`
}
Data holds one td issue plus the related rows the card needs to render and navigate: children (subtasks), parent, siblings, and recent logs.
type FetchedMsg ¶
FetchedMsg carries one td fetch result. Hosts that track their own request identity wrap it; the app's modal consumes it directly.
type LoadedMsg ¶
type LoadedMsg struct {
ModelID int
RequestGeneration uint64
Epoch uint64
IssueID string
Data *Data
Error error
}
LoadedMsg is the result of a Model load. Its identity fields ensure a result can only be applied to the model, request, and plugin epoch that issued it.
type Log ¶
type Log struct {
Timestamp string `json:"timestamp"`
Session string `json:"session"`
Message string `json:"message"`
Type string `json:"type"`
}
Log is one progress line from `td show`.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is one td issue in one content box.
func (*Model) ActionHints ¶
func (m *Model) ActionHints() []ActionHint
SetActionHints replaces the ACTIONS row. An empty list hides the section unless the card can still show its own navigation hints. ActionHints returns the host-supplied ACTIONS row.
func (*Model) HandleClick ¶
HandleClick selects and opens a parent or child row at view-local (x, y). A click on empty chrome still only activates the card so the next arrow key can navigate; hosts do not need a separate double-click path for issue rows.
func (*Model) HandleHover ¶
HandleHover updates the hover highlight from view-local coordinates.
func (*Model) HandleKey ¶
HandleKey applies issue keys. When the card is not active, arrows and j/k only scroll. When it is active, arrows walk parent/subtasks/siblings and enter opens the selected row; j/k, paging, and g/G still scroll. A navigation key returns a Load command for the new issue.
func (*Model) Hits ¶
Hits returns the interactive rectangles from the last View, in view-local cells. Hosts that want per-row regions register these; hosts that only have a pane box can call HandleClick with local coordinates instead.
func (*Model) Load ¶
Load retargets the model at issueID and returns a command that fetches it. Only the issueview-owned LoadedMsg is broadcast.
func (*Model) OpenSelection ¶
OpenSelection loads the selected parent or child. Nothing selected is a no-op.
func (*Model) ScrollOffset ¶
ScrollOffset is the current (or still-pending restore) viewport offset.
func (*Model) SelectedID ¶
SelectedID is the issue the cursor is on, or the current issue when nothing is selected.
func (*Model) SetActionHints ¶
func (m *Model) SetActionHints(hints []ActionHint)
func (*Model) SetActive ¶
SetActive enables epic/subtask arrow navigation. Hosts that share those keys with something else (the preview modal) only set this after the user tabs to the card and presses enter, or clicks it.
func (*Model) SetData ¶
SetData installs already-fetched data. Tests and hosts that fetched themselves use this instead of going through Load.
func (*Model) SetFocused ¶
SetFocused marks the card as the current tab stop. It is a visual cue distinct from Active: focused-but-inactive still scrolls on arrows.
func (*Model) SetPendingScroll ¶
SetPendingScroll remembers an offset for the current load generation. A stale result cannot consume it because SetResult rejects stale generations before applying or clearing this value.
func (*Model) SetResult ¶
SetResult applies msg if it belongs to the current load. It returns false without changing the model for stale model, request, epoch, or issue results.
func (*Model) SetSize ¶
SetSize sets the content box dimensions. A width change invalidates rendered markdown because wrapping depends on it.