Feature: base for the tag/search page

This commit is contained in:
VnPower 2023-06-02 19:57:55 +07:00
parent e11c03c853
commit ca51f7eb97
Signed by: vnpower
GPG key ID: 881DE3DEB966106C
5 changed files with 67 additions and 0 deletions

View file

@ -27,6 +27,8 @@ const (
ArtworkRelatedURL = "https://www.pixiv.net/ajax/illust/%s/recommend/init?limit=%d"
ArtworkNewestURL = "https://www.pixiv.net/ajax/illust/new?limit=200&type=%s&r18=%s&lastId=%s"
ArtworkRankingURL = "https://www.pixiv.net/ranking.php?format=json&mode=%s&content=%s&p=%s"
SearchMetadataURL = "https://www.pixiv.net/ajax/search/tags/%s"
SearchContentURL = "https://www.pixiv.net/ajax/search/artworks/%s?order=%s&mode=%s&p=%s&type=%s"
UserInformationURL = "https://www.pixiv.net/ajax/user/%s?full=1"
UserArtworksURL = "https://www.pixiv.net/ajax/user/%s/profile/all"
UserArtworksFullURL = "https://www.pixiv.net/ajax/user/%s/profile/illusts?work_category=illustManga&is_first_page=0&lang=en%s"

View file

@ -292,6 +292,21 @@ body {
border-radius: 50%;
}
.tag-header {
display: flex;
}
.tag-header .tag-thumbnail {
width: 120px;
height: 120px;
border-radius: 5px;
margin-right: 20px;
object-fit: cover;
object-position: center center;
}
.tag-header .tag-details .main-tag {
font-size: 1.2rem;
}
.switcher {
border-radius: 10px;
}

View file

@ -342,6 +342,26 @@ body {
}
}
.tag-header {
display: flex;
.tag-thumbnail {
width: 120px;
height: 120px;
border-radius: 5px;
margin-right: 20px;
object-fit: cover;
object-position: center center;
}
.tag-details {
.main-tag {
font-size: 1.2rem;
}
}
}
.switcher {
border-radius: 10px;

23
template/tag.html Normal file
View file

@ -0,0 +1,23 @@
{{ template "header.html" }}
<div class="container">
<div class="tag-header">
<img
class="tag-thumbnail"
src="https://px2.rainchan.win/c/384x280_80_a2_g2/img-master/img/2022/12/22/00/00/21/103791396_p0_master1200.jpg"
alt="No image"
/>
<div class="tag-details">
<b class="main-tag">#something</b>
<span class="translated-tag">Translated</span>
<br />
<br />
<span><b>69420</b> works</span>
<p class="tag-description">something is an English word for something</p>
</div>
</div>
<!-- Switchers here -->
</div>
{{ template "footer.html" }}

View file

@ -109,6 +109,12 @@ func newestArtworksPage(c *gin.Context) {
c.HTML(http.StatusOK, "list.html", gin.H{"Title": "Newest works from all users", "Items": works})
}
func tag_page(c *gin.Context) {
_ = c.Param("name")
c.HTML(http.StatusOK, "tag.html", gin.H{})
}
func NewPixivClient(timeout int) *models.PixivClient {
transport := &http.Transport{Proxy: http.ProxyFromEnvironment}
client := &http.Client{
@ -135,4 +141,5 @@ func SetupRoutes(r *gin.Engine) {
r.GET("users/:id", user_page)
r.GET("newest", newestArtworksPage)
r.GET("ranking", ranking_page)
r.GET("tags/:name", tag_page)
}