From 1268aa8ba6a76edb03a79a6b20bff2fdf53f7bd3 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 6 Dec 2016 12:36:31 +0900 Subject: [PATCH] Some improvements --- main.go | 9 +- mixins/Navigation.pixy | 1 + mixins/Postable.pixy | 6 +- pages/anime/anime.scarlet | 1 - pages/dashboard/dashboard.go | 6 +- pages/dashboard/dashboard.pixy | 25 ++-- pages/dashboard/dashboard.scarlet | 10 +- pages/forum/forum.go | 5 +- pages/forum/forum.pixy | 2 + pages/forum/forum.scarlet | 2 + pages/forum/forum.styl | 44 ------- pages/profile/profile.styl | 183 ------------------------------ pages/test.pixy | 2 - pages/threads/threads.go | 4 +- pages/threads/threads.scarlet | 2 +- pages/users/users.go | 11 ++ pages/users/users.pixy | 2 + styles/forms.scarlet | 20 ++-- styles/forum.scarlet | 6 +- styles/grid.scarlet | 2 - styles/include/mixins.scarlet | 2 +- 21 files changed, 72 insertions(+), 273 deletions(-) create mode 100644 pages/forum/forum.scarlet delete mode 100644 pages/forum/forum.styl delete mode 100644 pages/profile/profile.styl delete mode 100644 pages/test.pixy create mode 100644 pages/users/users.go create mode 100644 pages/users/users.pixy diff --git a/main.go b/main.go index 9ac7089e..57311946 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,7 @@ import ( "github.com/animenotifier/notify.moe/pages/profile" "github.com/animenotifier/notify.moe/pages/search" "github.com/animenotifier/notify.moe/pages/threads" + "github.com/animenotifier/notify.moe/pages/users" ) var app = aero.New() @@ -25,8 +26,7 @@ func main() { app.SetStyle(components.CSS()) // HTTPS - app.Security.Certificate, _ = ioutil.ReadFile("security/fullchain.pem") - app.Security.Key, _ = ioutil.ReadFile("security/privkey.pem") + app.Security.Load("security/fullchain.pem", "security/privkey.pem") // Layout app.Layout = func(ctx *aero.Context, content string) string { @@ -45,10 +45,7 @@ func main() { app.Ajax("/posts/:id", posts.Get) app.Ajax("/user/:nick", profile.Get) app.Ajax("/airing", airing.Get) - - app.Ajax("/test", func(ctx *aero.Context) string { - return ctx.HTML(components.Test("Hello World")) - }) + app.Ajax("/users", users.Get) // Scripts scripts, _ := ioutil.ReadFile("temp/scripts.js") diff --git a/mixins/Navigation.pixy b/mixins/Navigation.pixy index 9f1b3e98..935a9fa1 100644 --- a/mixins/Navigation.pixy +++ b/mixins/Navigation.pixy @@ -5,6 +5,7 @@ component Navigation NavigationButton("Forum", "/forum", "comment") NavigationButton("Genres", "/genres", "tags") NavigationButton("Airing", "/airing", "rss") + NavigationButton("Users", "/users", "globe") component NavigationButton(name string, target string, icon string) a.navigation-link.ajax(href=target) diff --git a/mixins/Postable.pixy b/mixins/Postable.pixy index 2f8ce6b3..8de32983 100644 --- a/mixins/Postable.pixy +++ b/mixins/Postable.pixy @@ -34,9 +34,9 @@ component Postable(post arn.Postable, viewUser *arn.User, highlightAuthorID stri //- a.post-tool.post-edit(onclick=`$.edit("${post.ID}")`, title="Edit") //- i.fa.fa-pencil.fa-fw - //- if post.Type() != "Thread" - a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink") - Icon("link") + if post.Type() != "Thread" + a.post-tool.post-permalink.ajax(href=post.Link(), title="Permalink") + Icon("link") //- if type === "Messages" && user && (user.ID === post.authorId || user.ID === post.recipientId) //- a.post-tool.post-delete(onclick=`if(confirm("Do you really want to delete this ${typeSingular.toLowerCase()} from ${post.author.nick}?")) $.delete${typeSingular}("${post.ID}")`, title="Delete") diff --git a/pages/anime/anime.scarlet b/pages/anime/anime.scarlet index ed8f3e8f..e84dfeba 100644 --- a/pages/anime/anime.scarlet +++ b/pages/anime/anime.scarlet @@ -63,5 +63,4 @@ border-radius 3px object-fit cover default-transition - scale-up shadow-up \ No newline at end of file diff --git a/pages/dashboard/dashboard.go b/pages/dashboard/dashboard.go index 9b5b2bcb..edef16f9 100644 --- a/pages/dashboard/dashboard.go +++ b/pages/dashboard/dashboard.go @@ -1,14 +1,12 @@ package dashboard import ( - "sort" - "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" ) -const maxPosts = 6 +const maxPosts = 5 // Get ... func Get(ctx *aero.Context) string { @@ -18,7 +16,7 @@ func Get(ctx *aero.Context) string { return ctx.Error(500, "Error fetching posts", err) } - sort.Sort(sort.Reverse(posts)) + arn.SortPostsLatestFirst(posts) if len(posts) > maxPosts { posts = posts[:maxPosts] diff --git a/pages/dashboard/dashboard.pixy b/pages/dashboard/dashboard.pixy index 116f1ff5..65955baf 100644 --- a/pages/dashboard/dashboard.pixy +++ b/pages/dashboard/dashboard.pixy @@ -1,10 +1,21 @@ component Dashboard(posts []*arn.Post) h2 Dash - .dashboard-widget - each post in posts - a.dashboard-event.ajax(href=post.Link()) - .dashboard-event-author - AvatarNoLink(post.Author()) - .dashboard-event-text - span= post.Thread().Title \ No newline at end of file + .dashboard + .dashboard-widget + h3 Airing + + for i := 1; i <= 5; i++ + a.dashboard-event + .dashboard-event-text + span ... + + .dashboard-widget + h3 Forums + + each post in posts + a.dashboard-event.ajax(href=post.Link()) + //- .dashboard-event-author + //- AvatarNoLink(post.Author()) + .dashboard-event-text + span= post.Thread().Title \ No newline at end of file diff --git a/pages/dashboard/dashboard.scarlet b/pages/dashboard/dashboard.scarlet index e98ea0c5..f5f83a63 100644 --- a/pages/dashboard/dashboard.scarlet +++ b/pages/dashboard/dashboard.scarlet @@ -1,12 +1,18 @@ +.dashboard + horizontal-wrap + justify-content space-around + .dashboard-widget vertical align-items center + width 100% + max-width 600px .dashboard-event vertical-wrap ui-element margin-bottom 1rem - padding 0.75rem + padding 0.75rem 1rem width 100% max-width 700px @@ -17,6 +23,6 @@ .dashboard-event-text horizontal - justify-content center + justify-content flex-start align-items center width 100% \ No newline at end of file diff --git a/pages/forum/forum.go b/pages/forum/forum.go index ed9523e8..45c2c059 100644 --- a/pages/forum/forum.go +++ b/pages/forum/forum.go @@ -1,8 +1,6 @@ package forum import ( - "sort" - "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" @@ -14,8 +12,7 @@ const threadsPerPage = 20 func Get(ctx *aero.Context) string { tag := ctx.Get("tag") threads, _ := arn.GetThreadsByTag(tag) - - sort.Sort(threads) + arn.SortThreads(threads) if len(threads) > threadsPerPage { threads = threads[:threadsPerPage] diff --git a/pages/forum/forum.pixy b/pages/forum/forum.pixy index a78bcc2e..8d40256d 100644 --- a/pages/forum/forum.pixy +++ b/pages/forum/forum.pixy @@ -4,6 +4,8 @@ component Forum(tag string, threads []*arn.Thread) each thread in threads ThreadLink(thread) + + button#load-more-threads Load more component ThreadLink(thread *arn.Thread) .thread-link(data-sticky=thread.Sticky) diff --git a/pages/forum/forum.scarlet b/pages/forum/forum.scarlet new file mode 100644 index 00000000..2a0cbeb8 --- /dev/null +++ b/pages/forum/forum.scarlet @@ -0,0 +1,2 @@ +#load-more-threads + margin-top 1rem \ No newline at end of file diff --git a/pages/forum/forum.styl b/pages/forum/forum.styl deleted file mode 100644 index 995cd58b..00000000 --- a/pages/forum/forum.styl +++ /dev/null @@ -1,44 +0,0 @@ -.forum-header - text-align left - -.forum-tags - text-align left - margin-bottom 1.5rem - -.thread-link - display flex - flex-flow row - width 100% - -.thread-reply-count -.thread-icons - opacity 0.5 - text-align right - position relative - -.thread-reply-count - font-size 0.8rem - flex 1 - margin 0 1rem - -.thread-icons - flex 0 - -.thread-content-container - display flex - align-items center - width 100% - -.thread-content - display flex - align-items center - justify-content flex-start - text-align left - min-height 80% - a - color rgb(32, 32, 32) !important - &:hover - color linkHoverColor !important - -// .thread-icon -// font-size 0.9em \ No newline at end of file diff --git a/pages/profile/profile.styl b/pages/profile/profile.styl deleted file mode 100644 index 2d32ee0f..00000000 --- a/pages/profile/profile.styl +++ /dev/null @@ -1,183 +0,0 @@ -profileBootDuration = 2s - -.profile - position relative - left content-padding * -1 - top content-padding * -1 - min-width calc(100% + 3rem) - padding content-padding * 2 - - color white - text-shadow 0px 0px 2px rgb(0, 0, 0, 0.5) - - default-transition - animation-name appear - animation-duration transition-speed - - overflow hidden - - // &:hover - // .profile-cover - // filter brightness(28%) - -@keyframes appear - 0% - transform rotateX(90deg) - filter opacity(0) saturate(0) blur(10px) - 100% - transform rotateX(0) - filter opacity(1) saturate(1) blur(0) - -.profile-cover - position absolute - left 0 - top 0 - width 100% - height 100% - z-index -1 - background-size cover - overflow hidden - - default-transition - animation cover-animation profileBootDuration - animation-fill-mode forwards - -@keyframes cover-animation - 0% - filter brightness(500%) blur(5px) - 100% - filter brightness(35%) blur(0) - -.profile-image - border-radius 3px - width 320px !important - height 320px !important - // padding content-padding - object-fit cover - -#anime-list-container - flex 1.5 - -// rotate-y() -// transform-origin 0% 0% -// animation rotate-y-animation profileBootDuration -// animation-fill-mode forwards - -// @keyframes rotate-y-animation -// 0% -// opacity 0 -// transform rotateY(90deg) -// 100% -// opacity 1 -// transform rotateY(0deg) - -.image-container - float left - width auto - // padding content-padding - -.intro-container - float left - width auto - display flex - flex-flow column - align-items center - padding content-padding - padding-top 0 - padding-left content-padding * 2 - max-width 900px - // rotate-y() - -.user-actions - float right - display flex - flex-flow row - justify-content center - -.user-action - max-width 250px - -#nick - text-align left - margin-top 0 - margin-bottom 0 - -.profile-field - margin-bottom 0.2em - -.location - // ... - -.role - opacity 0.6 - -.list-provider-username - margin-top 0 - margin-bottom 0 - font-size 0.9em - -.main - // ... - -.alternative - opacity 0.4 - -.report-bug-hint - // - -.loading-message - margin 0 auto - text-align center - opacity 0.4 - -#embedded-footer - position fixed - bottom 4em - right calc(16px + 1em) - text-align right - z-index 1 - font-size 0.9em - display flex - flex-flow row - - .user - display inline-block - width auto - height auto - margin-right 1em - -.embedded-footer-info - display flex - flex-flow column - -.embedded-footer-nick - text-align left - opacity 0.5 - -.embedded-footer-separator - opacity 0.2 - -@media only screen and (max-width: 900px) - .intro-container - margin 1em 0 - padding 0 - width 100% - text-align center !important - - #anime-list-container - .image-container - .user-actions - width 100% - - #nick - .profile-field - width 100% - text-align center - -@media only screen and (min-width: 900px) - #posts - margin-left 0.5em - -@media only screen and (max-width: 800px) - .airing-date-prefix - display none \ No newline at end of file diff --git a/pages/test.pixy b/pages/test.pixy deleted file mode 100644 index eff3ba4a..00000000 --- a/pages/test.pixy +++ /dev/null @@ -1,2 +0,0 @@ -component Test(msg string) - h1= msg \ No newline at end of file diff --git a/pages/threads/threads.go b/pages/threads/threads.go index 39623e9c..912e4612 100644 --- a/pages/threads/threads.go +++ b/pages/threads/threads.go @@ -1,8 +1,6 @@ package threads import ( - "sort" - "github.com/aerogo/aero" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" @@ -21,7 +19,7 @@ func Get(ctx *aero.Context) string { return post.ThreadID == thread.ID }) - sort.Sort(replies) + arn.SortPostsLatestLast(replies) if filterErr != nil { return ctx.Error(500, "Error fetching thread replies", err) diff --git a/pages/threads/threads.scarlet b/pages/threads/threads.scarlet index 521ad88d..36ef9eba 100644 --- a/pages/threads/threads.scarlet +++ b/pages/threads/threads.scarlet @@ -9,7 +9,7 @@ .post vertical - margin-bottom 1rem + margin-bottom 0.75rem > 600px .post diff --git a/pages/users/users.go b/pages/users/users.go new file mode 100644 index 00000000..0fa50741 --- /dev/null +++ b/pages/users/users.go @@ -0,0 +1,11 @@ +package users + +import ( + "github.com/aerogo/aero" + "github.com/animenotifier/notify.moe/components" +) + +// Get ... +func Get(ctx *aero.Context) string { + return ctx.HTML(components.Users()) +} diff --git a/pages/users/users.pixy b/pages/users/users.pixy new file mode 100644 index 00000000..cc4abc8d --- /dev/null +++ b/pages/users/users.pixy @@ -0,0 +1,2 @@ +component Users + h2 Users \ No newline at end of file diff --git a/styles/forms.scarlet b/styles/forms.scarlet index 60a7c37b..c864e926 100644 --- a/styles/forms.scarlet +++ b/styles/forms.scarlet @@ -18,13 +18,19 @@ input, textarea :disabled ui-disabled -// button, select -// ui-element -// box-shadow 0 0 2px white, 0 -2px 5px rgba(0, 0, 0, 0.08) inset -// :focus -// color rgb(0, 0, 0) -// box-shadow 0 0 6px alpha(mainColor, 20%) -// border 1px solid mainColor +button, select + ui-element + max-width 600px + padding 0.6rem 1rem + margin 0 auto + // box-shadow 0 0 2px white, 0 -2px 5px rgba(0, 0, 0, 0.08) inset + // :active + // background-color black + // color white + // :focus + // color rgb(0, 0, 0) + // // box-shadow 0 0 6px alpha(mainColor, 20%) + // border 1px solid main-color // input[type="submit"]:hover, // button:hover diff --git a/styles/forum.scarlet b/styles/forum.scarlet index c3ebd5dd..ed7f67c4 100644 --- a/styles/forum.scarlet +++ b/styles/forum.scarlet @@ -10,16 +10,16 @@ h1 font-size 1.5rem - line-height 2em + line-height 1.5em h2 font-size 1.3rem - line-height 2em + line-height 1.5em font-weight normal h3 font-size 1.1rem - line-height 2em + line-height 1.5em font-weight normal :hover diff --git a/styles/grid.scarlet b/styles/grid.scarlet index aecfcee9..a4152774 100644 --- a/styles/grid.scarlet +++ b/styles/grid.scarlet @@ -18,8 +18,6 @@ mixin grid-cell margin 0.5rem - scale-up - mixin grid-text vertical width 100% diff --git a/styles/include/mixins.scarlet b/styles/include/mixins.scarlet index c6956678..23d13898 100644 --- a/styles/include/mixins.scarlet +++ b/styles/include/mixins.scarlet @@ -25,7 +25,7 @@ mixin ui-element :hover border ui-hover-border background ui-hover-background - box-shadow outline-shadow-medium + // box-shadow outline-shadow-medium mixin ui-disabled background-color ui-disabled-color