diff --git a/configs/icon.png b/configs/icon.png new file mode 100644 index 0000000..d9df920 Binary files /dev/null and b/configs/icon.png differ diff --git a/configs/servers/default/users/bob/messages.json b/configs/servers/default/users/bob/messages.json index 11fcbd6..da818a1 100644 --- a/configs/servers/default/users/bob/messages.json +++ b/configs/servers/default/users/bob/messages.json @@ -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" - } - ] -} \ No newline at end of file + "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" + } + ] +} diff --git a/examples/config.json b/examples/config.json new file mode 100644 index 0000000..0e0d20f --- /dev/null +++ b/examples/config.json @@ -0,0 +1,5 @@ +{ + "app_name": "WhspBrd", + "version": "0.1.0", + "username": "${USERNAME}" +} diff --git a/internal/config/configuration.go b/examples/configuration.go similarity index 93% rename from internal/config/configuration.go rename to examples/configuration.go index 8791e14..d6d2a4a 100644 --- a/internal/config/configuration.go +++ b/examples/configuration.go @@ -1,4 +1,4 @@ -package config +package main import ( "embed" diff --git a/internal/tui/layout.go b/internal/tui/layout.go index cf36fc4..a3ca9ff 100644 --- a/internal/tui/layout.go +++ b/internal/tui/layout.go @@ -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 { diff --git a/internal/tui/sidebar.go b/internal/tui/sidebar.go index 042a69f..d8e9205 100644 --- a/internal/tui/sidebar.go +++ b/internal/tui/sidebar.go @@ -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 }