@@ -13,19 +13,20 @@ import (
13
13
)
14
14
15
15
const (
16
- YellowButtonCss = "font-bold bg-amber-600 p-2 rounded mx-1"
17
- ErrorDivCss = "flex flex-row fixed bottom-4 left-4 bg-red-500 p-4 text-xl rounded-lg"
18
- CenteringDivCss = "flex flex-row min-h-screen justify-center items-center"
19
- WindowDivCss = "p-4 text-center text-xl shadow-lg bg-zinc-800 rounded-lg mx-10"
20
- InviCss = "fixed invisible"
21
- RootContainerCss = "shadow-lg bg-zinc-800 rounded-lg p-6 min-h-72 relative"
22
- LoadingCss = "flex flex-row justify-center items-center"
23
- RemoveButtonCss = "font-bold bg-red-500 p-2 rounded hover:bg-red-700 m-1"
24
- LogoutButtonCss = "font-bold bg-orange-600 p-2 rounded mx-1 hover:bg-orange-800"
25
- UpdateButtonCss = "bg-green-600 hover:bg-green-800 text-xl p-2 rounded bottom-4 right-4 fixed"
26
- InstallButtonCss = "bg-green-600 hover:bg-green-800 p-2 rounded m-2"
27
- BurgerMenuButtonCss = "text-xl fixed top-4 right-4"
28
- RootButtonsCss = "flex flex-col absolute top-12 right-4"
16
+ YellowButtonCss = "font-bold bg-amber-600 p-2 rounded mx-1"
17
+ ErrorDivCss = "flex flex-row fixed bottom-4 left-4 bg-red-500 p-4 text-xl rounded-lg"
18
+ CenteringDivCss = "flex flex-row min-h-screen justify-center items-center"
19
+ WindowDivCss = "p-4 text-center text-xl shadow-lg bg-zinc-800 rounded-lg mx-10"
20
+ InviCss = "fixed invisible"
21
+ RootContainerCss = "shadow-lg bg-zinc-800 rounded-lg p-6 min-h-72 relative"
22
+ LoadingCss = "flex flex-row justify-center items-center"
23
+ RemoveButtonCss = "font-bold bg-red-500 p-2 rounded hover:bg-red-700 m-1"
24
+ LogoutButtonCss = "font-bold bg-orange-600 p-2 rounded mx-1 hover:bg-orange-800"
25
+ UpdateButtonCss = "bg-green-600 hover:bg-green-800 text-xl p-2 rounded bottom-4 right-4 fixed"
26
+ InstallButtonCss = "bg-green-600 hover:bg-green-800 p-2 rounded m-2"
27
+ BurgerMenuButtonCss = "text-xl fixed top-4 right-4"
28
+ RootButtonsCss = "flex flex-col absolute top-12 right-4"
29
+ LoadFlushesButtonCss = YellowButtonCss + " hover:bg-amber-800 align-middle"
29
30
)
30
31
31
32
type ErrorContainer struct {
@@ -100,7 +101,6 @@ func (b *RootContainer) OnMount(ctx app.Context) {
100
101
if ! creds .LoggedIn {
101
102
log .Println ("Not logged in at root..." )
102
103
} else {
103
- Hide ("update-button" )
104
104
app .Window ().GetElementByID ("root-container" ).Set ("className" , RootContainerCss )
105
105
app .Window ().GetElementByID ("about-container" ).Set ("className" , "invisible fixed" )
106
106
ShowLoading ("flushes-loading" )
@@ -111,6 +111,9 @@ func (b *RootContainer) OnMount(ctx app.Context) {
111
111
ctx .Dispatch (func (ctx app.Context ) {
112
112
if ! more {
113
113
Hide ("update-button" )
114
+ } else {
115
+ log .Println ("*** Showing update button..." )
116
+ app .Window ().GetElementByID ("update-button" ).Set ("className" , LoadFlushesButtonCss )
114
117
}
115
118
if err != nil {
116
119
ShowErrorDiv (ctx , err , 2 )
@@ -183,17 +186,19 @@ type buttonUpdate struct {
183
186
184
187
func (b * buttonUpdate ) Render () app.UI {
185
188
return app .Button ().Text ("Load More" ).OnClick (b .onClick ).Class (
186
- YellowButtonCss + " hover:bg-amber-800 align-middle" ).ID ("update-button" )
189
+ LoadFlushesButtonCss ).ID ("update-button" )
187
190
}
188
191
func (b * buttonUpdate ) onClick (ctx app.Context , e app.Event ) {
189
192
ShowLoading ("flushes-loading-update" )
190
- Hide ("update-button" )
191
193
ctx .Async (func () {
192
194
result , more := GetFlushesFromOID (ctx )
193
195
log .Println ("more-data: " , more )
194
196
ctx .Dispatch (func (ctx app.Context ) {
195
197
if ! more {
196
198
Hide ("update-button" )
199
+ } else {
200
+ log .Println ("*** Showing update button..." )
201
+ app .Window ().GetElementByID ("update-button" ).Set ("className" , LoadFlushesButtonCss )
197
202
}
198
203
defer Hide ("flushes-loading-update" )
199
204
if result == nil {
0 commit comments