Documentation
¶
Overview ¶
filemenu.go
Index ¶
- func NewIncomingRequestsModel(rpcClient *app.RpcClient) incomingRequestsModel
- func NewLandingModel(rpcClient *app.RpcClient) model
- func NewLoginModel(rpcClient *app.RpcClient) loginModel
- func NewOutgoingRequestsModel(rpcClient *app.RpcClient) outgoingRequestsModel
- func NewRegisterModel(rpcClient *app.RpcClient) registerModel
- type AcceptFriendRequestMsg
- type AcceptFriendRequestResultMsg
- type BackMsg
- type ChatFriendListModel
- type ChatMessage
- type ChatModel
- func (m ChatModel) Init() tea.Cmd
- func (m ChatModel) OpenFileMenu(originalServerMessages []ChatMessage, originalActiveUser int32, ...) tea.Cmd
- func (m *ChatModel) SetActiveUser(userID int32, username string)
- func (m ChatModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m ChatModel) View() string
- type ChatPanelModel
- type Choice
- type ClearStatusMessageMsg
- type DeclineFriendRequestMsg
- type DeclineFriendRequestResultMsg
- type DummyModel
- type FileMenuModel
- type FriendListModel
- type FriendListMsg
- type FriendManagementModel
- type FriendSelectedMsg
- type IncomingFriendRequestsMsg
- type OpenFileMenuMsg
- type OutgoingFriendRequestsMsg
- type ReceivedMessage
- type RemoveFriendMsg
- type RemoveFriendResultMsg
- type SendFriendRequestMsg
- type SendFriendRequestResultMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLoginModel ¶
NewLoginModel initializes the login component
func NewRegisterModel ¶
NewRegisterModel initializes the register component
Types ¶
type AcceptFriendRequestMsg ¶
type AcceptFriendRequestMsg struct {
RequestID int32
}
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 ¶
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
FileType string
FileSize uint64
FileName string
FileData []byte
Timestamp time.Time // Changed from uint64 to time.Time
}
ChatMessage represents a message in the chat.
type ChatModel ¶
type ChatModel struct {
// contains filtered or unexported fields
}
func NewChatModel ¶
NewChatModel initializes a new ChatModel.
func (ChatModel) OpenFileMenu ¶ added in v1.0.5
func (*ChatModel) SetActiveUser ¶
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) View ¶
func (m ChatPanelModel) View() string
View function renders the Main Menu UI
type ClearStatusMessageMsg ¶
type ClearStatusMessageMsg struct{}
type DeclineFriendRequestMsg ¶
type DeclineFriendRequestMsg struct {
RequestID int32
}
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) View ¶
func (m DummyModel) View() string
type FileMenuModel ¶ added in v1.0.5
type FileMenuModel struct {
// contains filtered or unexported fields
}
FileMenuModel displays a table of file messages.
func NewFileMenuModel ¶ added in v1.0.5
func NewFileMenuModel(rpcClient *app.RpcClient, files []ChatMessage, terminalWidth int, terminalHeight int, originalServerMessages []ChatMessage, originalActiveUser int32, originalActiveUsername string, originalSelectedIdx int) FileMenuModel
NewFileMenuModel creates a new FileMenuModel. The 'files' slice should include all ChatMessage entries with non-text FileType.
func (FileMenuModel) Init ¶ added in v1.0.5
func (m FileMenuModel) Init() tea.Cmd
Init is part of the tea.Model interface.
func (FileMenuModel) View ¶ added in v1.0.5
func (m FileMenuModel) View() string
View renders the file menu.
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)
type FriendListMsg ¶
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, originalSelectedIdx int, originalServerMessages []ChatMessage) FriendManagementModel
func (FriendManagementModel) Init ¶
func (m FriendManagementModel) Init() tea.Cmd
func (FriendManagementModel) View ¶
func (m FriendManagementModel) View() string
type FriendSelectedMsg ¶
type IncomingFriendRequestsMsg ¶
type IncomingFriendRequestsMsg struct {
Requests []*friends.FriendRequest // Actual FriendRequest type from proto
Err error
}
type OpenFileMenuMsg ¶ added in v1.0.5
type OpenFileMenuMsg struct {
OriginalServerMessages []ChatMessage
OriginalActiveUser int32
OriginalActiveUsername string
}
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
FileType string
FileSize uint64
FileName string
FileData []byte
Timestamp time.Time
}
Define a custom message type for received messages.
type RemoveFriendMsg ¶
type RemoveFriendMsg struct {
FriendID int32
}
type RemoveFriendResultMsg ¶
type SendFriendRequestMsg ¶
type SendFriendRequestMsg struct {
RecipientUsername string
}
Action Messages (sent from child models to parent model to request an action)
type SendFriendRequestResultMsg ¶
Result Messages (returned by commands after action execution)