diff --git a/layout/sidebar/sidebar.pixy b/layout/sidebar/sidebar.pixy index 7a99b56d..ec6ef49f 100644 --- a/layout/sidebar/sidebar.pixy +++ b/layout/sidebar/sidebar.pixy @@ -31,6 +31,8 @@ component Sidebar(user *arn.User) SidebarButton("Forum", "/forum", "comment") SidebarButton("Explore", "/explore", "th") SidebarButton("Calendar", "/calendar", "calendar") + if arn.IsDevelopment() + SidebarButton("AMVs", "/amvs", "video-camera") SidebarButton("Soundtracks", "/soundtracks", "headphones") SidebarButton("Quotes", "/quotes", "quote-left") SidebarButton("Companies", "/companies", "building") diff --git a/pages/amv/amv.go b/pages/amv/amv.go new file mode 100644 index 00000000..d6394779 --- /dev/null +++ b/pages/amv/amv.go @@ -0,0 +1,8 @@ +package amv + +import "github.com/aerogo/aero" + +// Get a single AMV. +func Get(ctx *aero.Context) string { + return ctx.HTML("Coming soon™.") +} diff --git a/pages/amv/amv.pixy b/pages/amv/amv.pixy new file mode 100644 index 00000000..0ad63fa8 --- /dev/null +++ b/pages/amv/amv.pixy @@ -0,0 +1,2 @@ +component AMV(amv *arn.AMV, user *arn.User) + h1= amv.Title.ByUser(user) \ No newline at end of file diff --git a/pages/amvs/amvs.go b/pages/amvs/amvs.go index f90db340..d5a813b7 100644 --- a/pages/amvs/amvs.go +++ b/pages/amvs/amvs.go @@ -2,9 +2,20 @@ package amvs import ( "github.com/aerogo/aero" + "github.com/animenotifier/notify.moe/components" + "github.com/animenotifier/notify.moe/utils" ) -// Get AMVs. -func Get(ctx *aero.Context) string { - return ctx.HTML("Coming soon™.") +// Latest AMVs. +func Latest(ctx *aero.Context) string { + user := utils.GetUser(ctx) + + return ctx.HTML(components.AMVs(nil, -1, "", user)) +} + +// Best AMVs. +func Best(ctx *aero.Context) string { + user := utils.GetUser(ctx) + + return ctx.HTML(components.AMVs(nil, -1, "", user)) } diff --git a/pages/amvs/amvs.pixy b/pages/amvs/amvs.pixy new file mode 100644 index 00000000..c2d400bb --- /dev/null +++ b/pages/amvs/amvs.pixy @@ -0,0 +1,32 @@ +component AMVs(amvs []*arn.AMV, nextIndex int, tag string, user *arn.User) + h1.page-title AMVs + + AMVsTabs(tag) + + .corner-buttons + if user != nil + if user.DraftIndex().AMVID == "" + button.action(data-action="newObject", data-trigger="click", data-type="amv") + Icon("plus") + span Add AMV + else + a.button(href="/amv/" + user.DraftIndex().AMVID + "/edit") + Icon("pencil") + span Edit draft + + #load-more-target.amvs + AMVsScrollable(amvs, user) + + if nextIndex != -1 + .buttons + LoadMore(nextIndex) + +component AMVsScrollable(amvs []*arn.AMV, user *arn.User) + each amv in amvs + AMV(amv, user) + +component AMVsTabs(tag string) + .tab-groups + .tabs + Tab("Latest", "video-camera", "/amvs") + Tab("Best", "heart", "/amvs/best") \ No newline at end of file diff --git a/pages/index.go b/pages/index.go index 4eb308d5..df1aebd6 100644 --- a/pages/index.go +++ b/pages/index.go @@ -9,6 +9,8 @@ import ( "github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/layout" "github.com/animenotifier/notify.moe/pages/admin" + "github.com/animenotifier/notify.moe/pages/amv" + "github.com/animenotifier/notify.moe/pages/amvs" "github.com/animenotifier/notify.moe/pages/anime" "github.com/animenotifier/notify.moe/pages/animeimport" "github.com/animenotifier/notify.moe/pages/animelist" @@ -139,6 +141,11 @@ func Configure(app *aero.Application) { l.Page("/character/:id/edit", character.Edit) l.Page("/character/:id/history", character.History) + // AMVs + l.Page("/amvs", amvs.Latest) + l.Page("/amvs/best", amvs.Best) + l.Page("/amv/:id", amv.Get) + // Quotes l.Page("/quote/:id", quote.Get) l.Page("/quote/:id/edit", quote.Edit)