Changed design

This commit is contained in:
David Alasow 2018-12-03 20:18:28 +01:00
parent 453cb96ab8
commit 8c9355ffbb
3 changed files with 50 additions and 6 deletions

View File

@ -60,12 +60,12 @@ type meikanAPIIDs struct {
func main() {
r := router.New()
r.Renderer = NewRenderer()
r.ErrorHandler = errorHandler
r.GET(`/static/*asset`, getStatic)
r.GET(`/`, home)
r.GET(`/compare`, compare)
err := r.Start(`:8070`)
check(err)
r.ErrorHandler = errorHandler
}
func check(e error) {
@ -80,13 +80,11 @@ func home(c *router.Context) error {
func compare(c *router.Context) error {
user := c.QueryParam(`name`)
fmt.Println(user)
//https://api.jikan.moe/v3/user/nekomata1037/animelist/all
//https://api.meikan.moe/v1/ids/anime
jikanList := jikanAPIGetUserAnimelist(user)
var list meikanList
list.User = user
anime := list.Anime
fmt.Println("Getting IDs")
IDs := meikanAPIGetIDs()
for i := 0; i < len(jikanList.Anime); i++ {
@ -113,7 +111,7 @@ func compare(c *router.Context) error {
case 2:
temp.Anime.State = "Finished"
}
anime = append(anime, temp)
list.Anime = append(list.Anime, temp)
}
return c.Render(200, `list`, list)

View File

@ -1,3 +1,31 @@
body {
color: black;
background: #FFF;
color: #333;
}
a {
text-decoration: none;
color: #7331e8;
}
a:visited {
color: #7331e8;
}
a:hover {
color: #a06cfc;
}
#list {
margin: auto;
border-collapse:collapse;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
#list tr:nth-child(odd) {
background: #F5F5F5;
}
h1 {
text-align: center;
}

View File

@ -1,3 +1,21 @@
{{ define "body" }}
<h1>List for {{.List.User}}</h1>
<h1 id="title">List for {{.Content.User}}</h1>
<table id="list">
<tr>
<th width="30">ID</th>
<th width="60">Title</th>
<th width="30" align="center">Score</th>
<th width="30" align="center">Type</th>
<th width="30" align="center">Progress</th>
</tr>
{{range .Content.Anime}}
<tr>
<td align="center">{{.Anime.ID}}</td>
<td><a href="https://api.meikan.moe/v1/anime/{{.Anime.ID}}">{{.Anime.Title}}</a></td>
<td align="center">{{.Rating}}</td>
<td align="center">{{.Anime.Type}}</td>
<td align="center">{{.Episode}}/{{.Anime.Episodes}}</td>
</tr>
{{end}}
</table>
{{ end }}