pages

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIncomingRequestsModel

func NewIncomingRequestsModel(rpcClient *app.RpcClient) incomingRequestsModel

func NewLandingModel

func NewLandingModel(rpcClient *app.RpcClient) model

Initialize the model

func NewLoginModel

func NewLoginModel(rpcClient *app.RpcClient) loginModel

NewLoginModel initializes the login component

func NewOutgoingRequestsModel

func NewOutgoingRequestsModel(rpcClient *app.RpcClient) outgoingRequestsModel

func NewRegisterModel

func NewRegisterModel(rpcClient *app.RpcClient) registerModel

NewRegisterModel initializes the register component

Types

type AcceptFriendRequestMsg

type AcceptFriendRequestMsg struct {
	RequestID int32
}

type AcceptFriendRequestResultMsg

type AcceptFriendRequestResultMsg struct {
	RequestID int32
	Err       error
}

type ChatFriendListModel

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

ChatFriendListModel manages the friends list within the chat context.

func NewChatFriendListModel

func NewChatFriendListModel(rpcClient *app.RpcClient) ChatFriendListModel

NewChatFriendListModel initializes the ChatFriendListModel.

func (ChatFriendListModel) Init

func (m ChatFriendListModel) Init() tea.Cmd

Init initializes the ChatFriendListModel with a command to fetch the friend list.

func (ChatFriendListModel) Update

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

Update handles key presses to navigate the friend list and processes incoming messages.

func (ChatFriendListModel) View

func (m ChatFriendListModel) View() string

View renders the chat friend list with the currently selected friend highlighted.

type ChatMessage

type ChatMessage struct {
	Sender  string // "self" or "other"
	Message string
}

ChatMessage represents a message in the chat.

type ChatModel

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

func NewChatModel

func NewChatModel(rpcClient *app.RpcClient) ChatModel

NewChatModel initializes a new ChatModel.

func (ChatModel) Init

func (m ChatModel) Init() tea.Cmd

Init initializes the model with a command to listen to the message channel.

func (*ChatModel) SetActiveUser

func (m *ChatModel) SetActiveUser(userID int32, username string)

func (ChatModel) Update

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

func (ChatModel) View

func (m ChatModel) View() string

View renders the chat view.

type ChatPanelModel

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

Main menu model now has ChatModel as a pointer for in-place updates

func NewChatPanelModel

func NewChatPanelModel(rpcClient *app.RpcClient) ChatPanelModel

Initialize the main menu model

func (ChatPanelModel) Init

func (m ChatPanelModel) Init() tea.Cmd

func (ChatPanelModel) Update

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

func (ChatPanelModel) View

func (m ChatPanelModel) View() string

View function renders the Main Menu UI

type Choice

type Choice int
const (
	ChoiceRegister Choice = iota
	ChoiceLogin
)

type ClearStatusMessageMsg

type ClearStatusMessageMsg struct{}

type DeclineFriendRequestMsg

type DeclineFriendRequestMsg struct {
	RequestID int32
}

type DeclineFriendRequestResultMsg

type DeclineFriendRequestResultMsg struct {
	RequestID int32
	Err       error
}

type DummyModel

type DummyModel struct{}

func NewDummyModel

func NewDummyModel() DummyModel

func (DummyModel) Init

func (m DummyModel) Init() tea.Cmd

Init function initializes the main menu model

func (DummyModel) Update

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

func (DummyModel) View

func (m DummyModel) View() string

type FriendListModel

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

FriendListModel represents the model for the friend list page

func NewFriendListModel

func NewFriendListModel(rpcClient *app.RpcClient) FriendListModel

NewFriendListModel creates and returns a new friend list model

func (FriendListModel) Init

func (m FriendListModel) Init() tea.Cmd

Init initializes the model (no initialization needed here)

func (FriendListModel) Update

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

Update handles incoming messages and updates the model's state

func (FriendListModel) View

func (m FriendListModel) View() string

View renders the UI

type FriendListMsg

type FriendListMsg struct {
	Friends []*friends.Friend // Actual Friend type from proto
	Err     error
}

Data Messages (used to pass data to child models)

type FriendManagementModel

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

func NewFriendManagementModel

func NewFriendManagementModel(rpcClient *app.RpcClient) FriendManagementModel

func (FriendManagementModel) Init

func (m FriendManagementModel) Init() tea.Cmd

func (FriendManagementModel) Update

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

func (FriendManagementModel) View

func (m FriendManagementModel) View() string

type FriendSelectedMsg

type FriendSelectedMsg struct {
	UserID   int32
	Username string
}

type IncomingFriendRequestsMsg

type IncomingFriendRequestsMsg struct {
	Requests []*friends.FriendRequest // Actual FriendRequest type from proto
	Err      error
}

type OutgoingFriendRequestsMsg

type OutgoingFriendRequestsMsg struct {
	Requests []*friends.FriendRequest // Actual FriendRequest type from proto
	Err      error
}

type ReceivedMessage

type ReceivedMessage struct {
	SenderID uint32
	Sender   string
	Message  string
}

Define a custom message type for received messages.

type RemoveFriendMsg

type RemoveFriendMsg struct {
	FriendID int32
}

type RemoveFriendResultMsg

type RemoveFriendResultMsg struct {
	FriendID int32
	Err      error
}

type SendFriendRequestMsg

type SendFriendRequestMsg struct {
	RecipientUsername string
}

Action Messages (sent from child models to parent model to request an action)

type SendFriendRequestResultMsg

type SendFriendRequestResultMsg struct {
	RecipientUsername string
	Err               error
}

Result Messages (returned by commands after action execution)

Jump to

Keyboard shortcuts

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