chat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatKeyBindings

func ChatKeyBindings() ui.KeyBindingSet

ChatKeyBindings returns the bindings shown in the bottom help bar.

Types

type ChannelList

type ChannelList struct {
	// contains filtered or unexported fields
}

func NewChannelList

func NewChannelList() ChannelList

func (*ChannelList) ClearUnread

func (cl *ChannelList) ClearUnread(channel string)

func (*ChannelList) FindByName

func (cl *ChannelList) FindByName(name string) (sharkfin.Channel, bool)

FindByName returns the channel and true if found, or zero value and false.

func (*ChannelList) HasUnreads

func (cl *ChannelList) HasUnreads() bool

func (*ChannelList) IncrementMention

func (cl *ChannelList) IncrementMention(channel string)

func (*ChannelList) IncrementUnread

func (cl *ChannelList) IncrementUnread(channel string)

func (*ChannelList) IsMember

func (cl *ChannelList) IsMember() bool

func (*ChannelList) MoveDown

func (cl *ChannelList) MoveDown()

func (*ChannelList) MoveUp

func (cl *ChannelList) MoveUp()

func (*ChannelList) Names

func (cl *ChannelList) Names() []string

Names returns all channel names.

func (*ChannelList) SelectByName

func (cl *ChannelList) SelectByName(name string) bool

SelectByName selects a channel by name. Returns true if found.

func (*ChannelList) SelectIndex

func (cl *ChannelList) SelectIndex(i int)

func (*ChannelList) Selected

func (cl *ChannelList) Selected() string

func (*ChannelList) SetChannels

func (cl *ChannelList) SetChannels(channels []sharkfin.Channel)

func (*ChannelList) SetCounts

func (cl *ChannelList) SetCounts(channel string, unread, mentions int)

func (*ChannelList) SetSize

func (cl *ChannelList) SetSize(w, h int)

func (ChannelList) View

func (cl ChannelList) View() string

type ChannelSelectedMsg

type ChannelSelectedMsg struct {
	Name string
}

type ChatModel

type ChatModel struct {
	// contains filtered or unexported fields
}

ChatModel is the root Bubble Tea model for the chat UI.

func NewModel

func NewModel(client *sharkfin.Client, username string) ChatModel

NewModel creates a ChatModel wired to a sharkfin client.

func (ChatModel) Init

func (m ChatModel) Init() tea.Cmd

func (ChatModel) Update

func (m ChatModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ChatModel) View

func (m ChatModel) View() tea.View

type DMList

type DMList struct {
	// contains filtered or unexported fields
}

func NewDMList

func NewDMList(username string) DMList

func (*DMList) ClearUnread

func (dl *DMList) ClearUnread(channel string)

func (*DMList) HasUnreads

func (dl *DMList) HasUnreads() bool

func (*DMList) IncrementMention

func (dl *DMList) IncrementMention(channel string)

func (*DMList) IncrementUnread

func (dl *DMList) IncrementUnread(channel string)

func (*DMList) MoveDown

func (dl *DMList) MoveDown()

func (*DMList) MoveUp

func (dl *DMList) MoveUp()

func (*DMList) Participant

func (dl *DMList) Participant() string

func (*DMList) SelectByChannel

func (dl *DMList) SelectByChannel(channel string)

func (*DMList) SelectIndex

func (dl *DMList) SelectIndex(i int)

func (*DMList) Selected

func (dl *DMList) Selected() string

func (*DMList) SetCounts

func (dl *DMList) SetCounts(channel string, unread, mentions int)

func (*DMList) SetDMs

func (dl *DMList) SetDMs(dms []sharkfin.DM)

func (*DMList) SetSize

func (dl *DMList) SetSize(w, h int)

func (DMList) View

func (dl DMList) View() string

type InputBar

type InputBar struct {
	// contains filtered or unexported fields
}

func NewInputBar

func NewInputBar() InputBar

func (*InputBar) Blur

func (ib *InputBar) Blur()

func (*InputBar) Focus

func (ib *InputBar) Focus()

func (*InputBar) Focused

func (ib *InputBar) Focused() bool

func (*InputBar) Height

func (ib *InputBar) Height() int

Height returns the total height including borders (2 for border).

func (*InputBar) InsertNewline

func (ib *InputBar) InsertNewline()

func (*InputBar) InsertString

func (ib *InputBar) InsertString(s string)

func (*InputBar) Paste

func (ib *InputBar) Paste()

func (*InputBar) Reset

func (ib *InputBar) Reset()

func (*InputBar) SetReadOnly

func (ib *InputBar) SetReadOnly(ro bool)

func (*InputBar) SetWidth

func (ib *InputBar) SetWidth(w int)

func (*InputBar) TryComplete

func (ib *InputBar) TryComplete(usernames []string) bool

TryComplete attempts @mention tab-completion against the given usernames. Works on the current line at the cursor position.

func (*InputBar) UpdateTextInput

func (ib *InputBar) UpdateTextInput(msg interface{})

func (*InputBar) Value

func (ib *InputBar) Value() string

func (InputBar) View

func (ib InputBar) View() string

type MessagePane

type MessagePane struct {
	// contains filtered or unexported fields
}

func NewMessagePane

func NewMessagePane() MessagePane

func (*MessagePane) AppendMessage

func (mp *MessagePane) AppendMessage(channel string, msg sharkfin.Message)

func (*MessagePane) AtTop

func (mp *MessagePane) AtTop() bool

AtTop returns true if the viewport is scrolled to the top.

func (*MessagePane) Channel

func (mp *MessagePane) Channel() string

Channel returns the currently displayed channel name.

func (*MessagePane) Height

func (mp *MessagePane) Height() int

Height returns the inner height of the message pane in lines.

func (*MessagePane) LatestID

func (mp *MessagePane) LatestID(channel string) int

LatestID returns the largest message ID for the channel, or 0 if none.

func (*MessagePane) MergeMessages

func (mp *MessagePane) MergeMessages(channel string, msgs []sharkfin.Message)

MergeMessages adds messages not already present, maintaining sort order by ID.

func (*MessagePane) OldestID

func (mp *MessagePane) OldestID(channel string) int

OldestID returns the smallest message ID for the channel, or 0 if none.

func (*MessagePane) PrependHistory

func (mp *MessagePane) PrependHistory(channel string, msgs []sharkfin.Message)

PrependHistory adds older messages to the front, preserving scroll position.

func (*MessagePane) ScrollDown

func (mp *MessagePane) ScrollDown(n int)

func (*MessagePane) ScrollUp

func (mp *MessagePane) ScrollUp(n int)

func (*MessagePane) SetChannel

func (mp *MessagePane) SetChannel(name string)

func (*MessagePane) SetSize

func (mp *MessagePane) SetSize(w, h int)

func (MessagePane) View

func (mp MessagePane) View() string
type Modal struct {
	Type ModalType
	// contains filtered or unexported fields
}

Modal holds the state for overlay modals.

func NewModal

func NewModal(modalType ModalType) Modal

func (*Modal) HitTest

func (m *Modal) HitTest(screenX, screenY int) ModalAction

HitTest checks if screen coordinates (x, y) land on a modal button.

func (*Modal) IsPublic

func (m *Modal) IsPublic() bool

func (*Modal) SetError

func (m *Modal) SetError(err string)

func (*Modal) SetValue

func (m *Modal) SetValue(v string)

func (*Modal) TogglePublic

func (m *Modal) TogglePublic()

func (*Modal) UpdateTextInput

func (m *Modal) UpdateTextInput(msg interface{})

func (*Modal) Value

func (m *Modal) Value() string

func (*Modal) View

func (m *Modal) View(totalW, totalH int) string

type ModalAction

type ModalAction int

ModalAction identifies a clickable modal button action.

const (
	ModalActionNone ModalAction = iota
	ModalActionSubmit
	ModalActionToggle
	ModalActionCancel
)

type ModalCloseMsg

type ModalCloseMsg struct{}

type ModalType

type ModalType int

ModalType identifies which modal is active.

const (
	ModalNone ModalType = iota
	ModalChannelCreate
	ModalUserInvite
	ModalDMOpen
	ModalShortcuts
)

type Pane

type Pane int

Pane identifies which panel has focus.

const (
	PaneChannels Pane = iota
	PaneInput
)

type ShortcutGroup

type ShortcutGroup struct {
	Title string
	Items []ShortcutItem
}

ShortcutGroup is a named group of shortcuts.

func AllShortcuts

func AllShortcuts() []ShortcutGroup

AllShortcuts returns the full list of shortcuts for the shortcuts modal.

type ShortcutItem

type ShortcutItem struct {
	Key         string
	Description string
}

ShortcutItem is a single shortcut entry.

type SidebarTab

type SidebarTab int

SidebarTab identifies which sidebar list is visible.

const (
	TabChannels SidebarTab = iota
	TabDMs
	TabUsers
)

type UserList

type UserList struct {
	// contains filtered or unexported fields
}

func NewUserList

func NewUserList(username string) UserList

func (*UserList) ClearDMUnread

func (ul *UserList) ClearDMUnread(channel string)

func (*UserList) MoveDown

func (ul *UserList) MoveDown()

func (*UserList) MoveUp

func (ul *UserList) MoveUp()

func (*UserList) SelectIndex

func (ul *UserList) SelectIndex(i int)

func (*UserList) SelectedDMChannel

func (ul *UserList) SelectedDMChannel() string

SelectedDMChannel returns the DM channel for the selected user, or "".

func (*UserList) SelectedUsername

func (ul *UserList) SelectedUsername() string

SelectedUsername returns the username at the cursor.

func (*UserList) SetDMMapping

func (ul *UserList) SetDMMapping(dms []sharkfin.DM, myUsername string)

SetDMMapping updates the username -> DM channel mapping from the DM list.

func (*UserList) SetDMUnread

func (ul *UserList) SetDMUnread(channel string, count int)

func (*UserList) SetSize

func (ul *UserList) SetSize(w, h int)

func (*UserList) SetUsers

func (ul *UserList) SetUsers(users []sharkfin.User)

func (*UserList) UpdatePresence

func (ul *UserList) UpdatePresence(username string, online bool)

UpdatePresence updates a single user's online status and re-sorts.

func (UserList) View

func (ul UserList) View() string

Jump to

Keyboard shortcuts

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