File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,4 @@ docker run -v $(pwd)/migrations:/migrations --network host migrate/migrate -path
7878## TODO
7979
8080- [ ] lint go/docker
81- - [ ] css
8281- [ ] some interactivity with htmx
83- - [ ] deploy
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ func (d *DataController) GetAndSaveIssues() {
9191
9292 if d .matrixClient != nil {
9393 for i := 0 ; i < len (news ); i ++ {
94- log .Info ("Notify an issue " , news [i ].Url )
94+ log .Info ("Notify an issue " + news [i ].Url )
9595 d .matrixClient .Notify (& news [i ])
9696 }
9797 }
Original file line number Diff line number Diff line change 77 "html/template"
88 "net/http"
99 "os"
10+ "time"
1011
1112 "github.com/charmbracelet/log"
1213)
@@ -47,7 +48,9 @@ func main() {
4748
4849func startServer (controller * internal.DataController ) {
4950
50- tmpl := template .Must (template .ParseFS (templates , "templates/index.html" ))
51+ tmpl := template .Must (template .New ("index.html" ).Funcs (template.FuncMap {
52+ "date" : formatDate ,
53+ }).ParseFS (templates , "templates/index.html" ))
5154
5255 http .HandleFunc ("/" , func (w http.ResponseWriter , r * http.Request ) {
5356
@@ -65,3 +68,7 @@ func startServer(controller *internal.DataController) {
6568 log .Info ("Server listening on port 1983" )
6669 http .ListenAndServe (":1983" , nil )
6770}
71+
72+ func formatDate (t time.Time ) string {
73+ return t .Format ("2006-01-02 15:04:05" )
74+ }
Original file line number Diff line number Diff line change 22< html >
33 < head >
44 < title > Help the stars</ title >
5+ < meta charset ="utf-8 " />
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
7+ < meta name ="color-scheme " content ="light dark " />
8+ {{/* < script src ="https://unpkg.com/htmx.org@1.7.0/dist/htmx.min.js "> </ script > */}}
9+ < link
10+ rel ="stylesheet "
11+ href ="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css "
12+ />
513 </ head >
6- < script src =" https://unpkg.com/htmx.org@1.7.0/dist/htmx.min.js " > </ script >
14+
715 < body >
8- < h1 > Help the stars</ h1 >
9- < h3 >
10- {{if .CurrentlyUpdating}}
11- Currently updating..
12- {{else}}
13- Last update: {{ .LastUpdate }}
14- {{end}}
15- </ h3 >
16+ < main class ="container ">
17+ < h1 > Help the stars</ h1 >
18+ < p >
19+ {{if .CurrentlyUpdating}} Currently updating... {{else}} Last update: {{
20+ .LastUpdate | date }} {{end}}
21+ </ p >
1622
17- {{ range .Issues }}
18- < h2 > {{ .Title }}</ h2 >
19- < a href ="{{ .Url }} "> {{ .CreationDate }}</ a >
20- < h3 > {{ .RepoOwner }} - {{ .StargazersCount }}⭐</ h3 >
21- < p > {{ printf "%.100s" .IssueDescription }}...</ p >
22- < p > < i > {{ .RepoDescription }}</ i > </ p >
23- {{ end }}
23+ {{ range .Issues }}
24+ < article >
25+ < header > {{ .Title }}</ header >
26+ < p > {{ .RepoDescription }}</ p >
27+ {{ .RepoOwner }} - {{ .StargazersCount }}⭐
28+ < p >
29+ < pre > {{ printf "%.200s" .IssueDescription }}...</ pre >
30+ </ p >
31+ < footer > < small > < a href ="{{ .Url }} "> {{ .Url }}</ a > </ small > </ footer >
32+ </ article >
33+ {{ end }}
34+ </ main >
2435 </ body >
2536</ html >
You can’t perform that action at this time.
0 commit comments