{{- extends "layout/default" }} {{- import "blocks/pagination" }} {{- import "blocks/underlinenavUser" }} {{- import "blocks/underlinenav" }} {{- block body() }}

Home

Illustrations

Manga

Novels

Bookmarks

{{- if .User.BackgroundImage }}
{{ .User.Name }} profile background image User avatar
{{- end }}
{{- if !.User.BackgroundImage }} User avatar {{- end }}

{{ .User.Name }}

{{ .User.Following }} Following | {{ .User.MyPixiv }} MyPixiv

{{- include "fragments/followButtons" .User }}

{{ .User.Following }} Following | {{ .User.MyPixiv }} MyPixiv

{{- if .User.Webpage }} {{- end }} {{- range index, item := .User.Social }} {{- if index == "pawoo" }} {{- else }} {{- end }} {{- end }}
{* NOTE: this button definitely needs to be in a different place *}

{{ raw: parsePixivRedirect(.User.Comment) }}

{* Using an empty fragment identifier so that htmx preserves the page position *} {{- baseURL := "/users/" + .User.ID + "/" }} {{- paths := slice("" + "#", "illustrations" + "#", "manga" + "#", "novels" + "#", "bookmarks" + "#") }} {{- names := slice("Home", "Illustrations", "Manga", "Novels", "Bookmarks") }} {{- categoryCounts := slice(1, .User.Categories.illustrations.WorkCount, .User.Categories.manga.WorkCount, .User.Categories.novels.WorkCount, .User.Categories.bookmarks.WorkCount) }} {{- yield UnderlineNavUser(baseURL=baseURL, paths=paths, names=names, categoryCounts=categoryCounts, activeState=.Category.Value + "#") }} {* NOTE: these filters technically work but are disabled due to issues with pagination and work counts {{- Mode := isset(Queries.mode) ? Queries.mode : "all" }} {{- url := replaceQuery(.Queries, "mode", "") }} {{- path := slice("all", "safe") }} {{- name := slice("All", "Safe")}} {{- yield UnderlineNav(baseURL=url, paths=path, names=name, activeState=Mode)}}

All

Safe

*}

{{- if .Category.Value == "" || .Category.Value == "artworks" }} {*

Works{{ .User.WorkCounts.All }}

*} {* Initialize a flag to track the first rendered group *} {{- isFirstGroup := true }} {{ if len(.User.Categories.illustrations.IllustWorks) != 0 }} {{- if not isFirstGroup }}
{{- end }}

Illustrations{{ .User.Categories.illustrations.WorkCount }}

{{- range .User.Categories.illustrations.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- include "fragments/small-tn" .User.Categories.illustrations.IllustWorks }}
{* TODO: use a better check than this *} {{ if len(.User.Categories.illustrations.IllustWorks) > 29 }} {{- end }} {* After rendering Illustrations, set isFirstGroup to false *} {{- isFirstGroup = false }} {{- end }} {{ if len(.User.Categories.manga.IllustWorks) != 0 }} {{- if not isFirstGroup }}
{{- end }}

Manga{{ .User.Categories.manga.WorkCount }}

{{- range .User.Categories.manga.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- if len(.User.Categories.manga.MangaSeries) != 0 }}
{{- range .User.Categories.manga.MangaSeries }} {{- include "fragments/mangaseries-tn" . }} {{- end }}
{{- end }}
{{- include "fragments/small-tn" .User.Categories.manga.IllustWorks }}
{{ if len(.User.Categories.manga.IllustWorks) > 29 }} {{- end }} {{- isFirstGroup = false }} {{- end }} {{ if len(.User.Categories.novels.NovelWorks) != 0 }} {{- if not isFirstGroup }}
{{- end }}

Novels{{ .User.Categories.novels.WorkCount }}

{{- range .User.Categories.novels.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- if len(.User.Categories.novels.NovelSeries) != 0 }}
{{- range .User.Categories.novels.NovelSeries }} {{- include "fragments/novelseries-tn" . }} {{- end }}
{{- end }}
{{- range .User.Categories.novels.NovelWorks }}
{{- include "fragments/novel-tn" . }}

{{- end }}
{{ if len(.User.Categories.novels.NovelWorks) > 29 }} {{- end }} {{- isFirstGroup = false }} {{- end }} {{- end }} {{- if .Category.Value == "illustrations" }}

Illustrations{{ .User.Categories.illustrations.WorkCount }}

{{- range .User.Categories.illustrations.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- include "fragments/small-tn" .User.Categories.illustrations.IllustWorks }}
{{- end }} {{- if .Category.Value == "manga" }}

Manga{{ .User.Categories.manga.WorkCount }}

{{- combinedUrl := "/artworks-multi/" + joinArtworkIds(.User.Categories.manga.IllustWorks) }}
{{- range .User.Categories.manga.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- if len(.User.Categories.manga.MangaSeries) != 0 }}
{{- range .User.Categories.manga.MangaSeries }} {{- include "fragments/mangaseries-tn" . }} {{- end }}
{{- end }}
{{- include "fragments/small-tn" .User.Categories.manga.IllustWorks }}
{{- end }} {{- if .Category.Value == "novels" }}

Novels{{ .User.Categories.novels.WorkCount}}

{{- range .User.Categories.novels.FrequentTags }}
#{{ .Name }} {{- if .TranslatedName }} ({{ .TranslatedName }}) {{- end }}
{{- end }}
{{- range .User.Categories.novels.NovelWorks }}
{{- include "fragments/novel-tn" . }}

{{- end }}
{{- end }} {{- if .Category.Value == "bookmarks" }}

Bookmarks{{ .User.Categories.bookmarks.WorkCount }}

{* NOTE: using .User.Artworks since there's no need to create a separate bookmarks slice; the category handles it *}
{{- include "fragments/small-tn" .User.Categories.bookmarks.IllustWorks }}
{{- end }}
{* TODO: figure out how to 'paginate' the home tab correctly; htmx for swapping in categories? *} {{- if .Category.Value == "illustrations" || .Category.Value == "manga" || .Category.Value == "novels" || .Category.Value == "bookmarks" }} {{- url := "/users/" + .User.ID + "/" + .Category.Value + "?page="}} {{- paginationData := createPaginator(url, "#checkpoint", .Page, .Category.PageLimit, 1, 5) }} {{- yield pagination(data=paginationData) }} {{- end }}
{{- end }}