mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-04-14 04:33:20 -04:00
fix no announcement breaking, also add warning announcements
This commit is contained in:
parent
d706c68499
commit
0bc508d463
@ -185,5 +185,9 @@ func (p *PbClient) GetAnnouncement() *Announcement {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(response.Items) < 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &response.Items[0]
|
||||
}
|
||||
|
@ -1,22 +1,29 @@
|
||||
<div class="flex justify-center items-center mt-4 w-full">
|
||||
<a target="_blank" href="{{.Announcement.Link}}"
|
||||
class="flex justify-center items-center p-2 mx-auto space-x-2 max-w-sm rounded-lg border border-lime-900 bg-black/30">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-lime-600" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<line x1="12" y1="8" x2="12.01" y2="8" />
|
||||
<polyline points="11 12 12 12 12 16 13 16" />
|
||||
</svg>
|
||||
{{if .Announcement}}
|
||||
<div class="flex justify-center items-center mt-4 w-full">
|
||||
<a target="_blank" href="{{.Announcement.Link}}"
|
||||
class="flex justify-center items-center p-2 mx-auto space-x-2 max-w-sm rounded-lg border {{if .Announcement.Warning}}border-yellow-900{{else}} border-lime-900{{end}} bg-black/30">
|
||||
{{if .Announcement.Warning}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="text-yellow-600 size-5" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z" stroke-width="0" fill="currentColor" />
|
||||
</svg>
|
||||
{{else}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="text-lime-600 size-5" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<line x1="12" y1="8" x2="12.01" y2="8" />
|
||||
<polyline points="11 12 12 12 12 16 13 16" />
|
||||
</svg>
|
||||
{{end}}
|
||||
|
||||
{{if .Announcement}}
|
||||
<div class="flex flex-col justify-center items-center text-center">
|
||||
<span class="font-bold">{{.Announcement.Title}}</span>
|
||||
<span class="text-xs lowercase">{{.Announcement.Body}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center items-center text-center">
|
||||
<span class="font-bold">{{.Announcement.Title}}</span>
|
||||
<span class="text-xs lowercase">{{.Announcement.Body}}</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
|
||||
<main class="py-4 text-lime-500">
|
||||
|
@ -70,6 +70,8 @@ func (s *Server) handleIndex(c iris.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
announcement := database.Pb.GetAnnouncement()
|
||||
|
||||
c.ViewLayout("main")
|
||||
data := iris.Map{
|
||||
"Title": "Home",
|
||||
@ -82,7 +84,7 @@ func (s *Server) handleIndex(c iris.Context) {
|
||||
"Cash": cash,
|
||||
"Fiat": fiat,
|
||||
},
|
||||
"Announcement": *database.Pb.GetAnnouncement(),
|
||||
"Announcement": announcement,
|
||||
"Current": "index",
|
||||
"Services": services,
|
||||
"RandomPitch": nokycPf[rand.Intn(len(nokycPf))],
|
||||
|
Loading…
x
Reference in New Issue
Block a user