Skip to content

Commit 08cbb27

Browse files
author
Piotr Gulbinowicz
committed
add github button, minor style changes
1 parent 912c5a1 commit 08cbb27

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

pwa/flush/components.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const (
2626
UpdateButtonCss = "bg-green-600 hover:bg-green-800 text-xl p-2 rounded bottom-4 right-4 fixed"
2727
InstallButtonCss = "bg-green-600 hover:bg-green-800 p-2 rounded m-2"
2828
BurgerMenuButtonCss = "text-xl fixed top-4 right-4"
29-
RootButtonsCss = "flex flex-col absolute top-12 right-4"
29+
RootButtonsCss = "flex flex-col fixed top-12 right-4"
3030
LoadFlushesButtonCss = YellowButtonCss + " hover:bg-amber-800 align-middle mt-8"
3131
)
3232

@@ -159,9 +159,9 @@ func (b *RootContainer) Render() app.UI {
159159
Location: "new",
160160
AdditionalCss: "hover:bg-amber-800 m-1",
161161
},
162+
&GithubButton{},
162163
&InstallButton{},
163164
).ID("root-buttons-container").Class(InviCss),
164-
app.P().Text("Tracked flushes:").Class("py-2"),
165165
&LoadingWidget{id: "flushes-loading"},
166166
b.Stats,
167167
b.GetList(),
@@ -531,8 +531,8 @@ func (a *AboutContainer) Render() app.UI {
531531
app.Img().Src("/web/paper.png").Class("inline").Width(100).Height(100),
532532
),
533533
app.Br(),
534-
app.P().Text("Application for tracking toilet flushes."),
535-
app.P().Text("You can use it to save them, rate them, check your toilet stats."),
534+
app.P().Text("Application for tracking time on toilet."),
535+
app.P().Text("You can use it to save it, rate it, check your toilet stats."),
536536
app.P().
537537
Text("The app will show you statistics like total time spent, average time spent, % times with phone used etc."),
538538
app.Br(),
@@ -552,7 +552,7 @@ func (a *AboutContainer) Render() app.UI {
552552

553553
func FlushTable(flushes []Flush) app.UI {
554554
if len(flushes) == 0 {
555-
return app.Div().Body(app.P().Text("No flushes yet."))
555+
return app.Div().Body(app.P().Text("No entries yet."))
556556
}
557557
divs := []app.UI{}
558558
for _, flush := range flushes {
@@ -572,7 +572,7 @@ func FlushTable(flushes []Flush) app.UI {
572572
&ConfirmRemoveFlushButton{ID: flush.ID},
573573
&CancelRemoveFlushButton{ID: flush.ID},
574574
).Class("max-w-1/6 remove-flush-buttonz-div"),
575-
).Class("flex flex-col p-4 border-1 shadow-lg rounded-lg shadow-amber-800").ID("div-"+flush.ID),
575+
).Class("flex flex-col p-4 border-1 shadow rounded-lg shadow-white/10").ID("div-"+flush.ID),
576576
)
577577
}
578578
return app.Div().Body(divs...)
@@ -1030,11 +1030,11 @@ func StatsDiv(ctx app.Context) (app.UI, error) {
10301030
app.P().Text("Total 🧻 -> "+strconv.Itoa(stats.FlushCount)),
10311031
app.P().
10321032
Text("Total ⏱️ -> "+strconv.Itoa(stats.TotalTime)+" min ("+strconv.Itoa(stats.MeanTime)+" min average)"),
1033-
app.P().Text("Average ⭐ -> "+strconv.Itoa(stats.MeanRating)),
1033+
app.P().Text("Average ⭐ -> "+strconv.Itoa(stats.MeanRating)+"/10"),
10341034
app.P().
10351035
Text("Times with 📱 -> "+strconv.Itoa(stats.PhoneUsedCount)+" ("+strconv.Itoa(stats.PercentPhoneUsed)+"%)"),
10361036
).
1037-
Class("flex flex-col p-4 border-1 shadow-lg rounded-lg font-bold shadow-amber-800"),
1037+
Class("flex flex-col p-4 border-1 shadow-lg rounded-lg font-bold shadow-white/20"),
10381038
nil
10391039
}
10401040

@@ -1304,3 +1304,19 @@ func (b *SubmitEditedFlushButton) onClick(ctx app.Context, e app.Event) {
13041304
})
13051305
})
13061306
}
1307+
1308+
type GithubButton struct {
1309+
app.Compo
1310+
}
1311+
1312+
func (b *GithubButton) Render() app.UI {
1313+
return app.Div().
1314+
OnClick(b.onClick).Body(
1315+
app.P().Text("GitHub"),
1316+
app.Img().Src("/web/github-mark-white.png").Class("w-6 h-6 ml-2"),
1317+
).
1318+
Class(YellowButtonCss + " hover:bg-amber-800 flex justify-center")
1319+
}
1320+
func (b *GithubButton) onClick(ctx app.Context, e app.Event) {
1321+
app.Window().Call("open", "https://github.com/pgulb/flush-log")
1322+
}

pwa/web/github-mark-white.png

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)