fix scrooling users issue and added some fixes

This commit is contained in:
shinya 2025-08-19 13:57:21 +02:00
parent 345fab6a32
commit 64503b7281
6 changed files with 36 additions and 31 deletions

BIN
configs/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,26 +1,25 @@
{
"messages" :
[
{
"id": "1",
"sender": "Bob",
"receiver": "Filip",
"content": "SGVsbG8gQm9iLCBob3cgYXJlIHlvdT8K",
"timestamp": "2023-10-01T10:00:00Z"
},
{
"id": "2",
"sender": "Filip",
"receiver": "Bob",
"content": "SGkgQWxpY2UhIEknbSBkb2luZyB3ZWxsLCB0aGFua3MuIEhvdyBhYm91dCB5b3U/Cg==",
"timestamp": "2023-10-01T10:05:00Z"
},
{
"id": "3",
"sender": "Bob",
"receiver": "FIlip",
"content": "SSdtIGdyZWF0LCB0aGFua3MgZm9yIGFza2luZwo=",
"timestamp": "2023-10-01T10:06:00Z"
}
]
}
"messages": [
{
"id": "1",
"sender": "Bob",
"receiver": "Filip",
"content": "QWhvaiBGw61sbywgZGxvdWhvIGpzbWUgc2UgbmV2aWTEm2xpIPCfmJoK",
"timestamp": "2024-07-10T11:07:00Z"
},
{
"id": "2",
"sender": "Filip",
"receiver": "Bob",
"content": "xIxhdWt5eXksIG1vaGxpIGJ5Y2hvbSB6YXNlIG7Em2tkeSB1ZMSbbGF0IHNyYXoK",
"timestamp": "2024-07-10T11:18:00Z"
},
{
"id": "3",
"sender": "Bob",
"receiver": "Filip",
"content": "VG8gYnljaG9tIG1vaGxpLCB2eWhvdnVqZSB0aSB0ZW5obGUgdMO9ZGVuIHZlIHN0xZllZHU/Cg==",
"timestamp": "2024-10-01T11:23:00Z"
}
]
}

5
examples/config.json Normal file
View File

@ -0,0 +1,5 @@
{
"app_name": "WhspBrd",
"version": "0.1.0",
"username": "${USERNAME}"
}

View File

@ -1,4 +1,4 @@
package config
package main
import (
"embed"

View File

@ -19,6 +19,7 @@ func layout(g *gocui.Gui) error {
return err
}
if err := layoutChat(g, maxX, maxY); err != nil {
//updateChatView(g.Views()[1])
return err
}
if err := layoutInput(g, maxX, maxY); err != nil {

View File

@ -6,9 +6,7 @@ import (
"github.com/jroimartin/gocui"
)
var selectedUserIdx int
//!FIX: First selected contact don't work only second selected is working ok
var selectedUserIdx int = 0
// LAYOUT
func layoutSidebar(g *gocui.Gui, maxY int) error {
@ -60,8 +58,9 @@ func nextContact(g *gocui.Gui, v *gocui.View) error {
return nil
}
selectedUserIdx = (selectedUserIdx + 1) % len(users)
err := updateUsersView(g)
updateChatView(g.Views()[1])
return updateUsersView(g)
return err
}
func prevContact(g *gocui.Gui, v *gocui.View) error {
@ -69,6 +68,7 @@ func prevContact(g *gocui.Gui, v *gocui.View) error {
return nil
}
selectedUserIdx = (selectedUserIdx - 1 + len(users)) % len(users)
err := updateUsersView(g)
updateChatView(g.Views()[1])
return updateUsersView(g)
return err
}