Improved activity design

This commit is contained in:
Eduard Urbach 2019-06-07 12:38:03 +09:00
parent 6ec0efe93b
commit a0ee24e81e
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
4 changed files with 27 additions and 15 deletions

View File

@ -11,6 +11,7 @@
"mixins/sidebar", "mixins/sidebar",
"mixins/anime-grid", "mixins/anime-grid",
"mixins/feature-card", "mixins/feature-card",
"mixins/horizontal-line",
"mixins/comments", "mixins/comments",
"reset", "reset",
"base", "base",

View File

@ -31,11 +31,11 @@ component Activity(activity arn.Activity, user *arn.User)
Avatar(activity.Creator()) Avatar(activity.Creator())
.post-content .post-content
.activity-header .activity-header
.activity-parent .activity-creator
a(href=activity.Creator().Link())= activity.Creator().Nick
if activity.TypeName() == "ActivityCreate" if activity.TypeName() == "ActivityCreate"
ActivityCreateTitle(activity.(*arn.ActivityCreate), user) ActivityCreateMeta(activity.(*arn.ActivityCreate), user)
else if activity.TypeName() == "ActivityConsumeAnime"
ActivityConsumeAnimeTitle(activity.(*arn.ActivityConsumeAnime), user)
if user != nil if user != nil
//- button.activity-action.tip.action(data-action="like", data-trigger="click", aria-label="Like") //- button.activity-action.tip.action(data-action="like", data-trigger="click", aria-label="Like")
@ -50,22 +50,25 @@ component Activity(activity arn.Activity, user *arn.User)
RawIcon("trash") RawIcon("trash")
.activity-date.utc-date(data-date=activity.GetCreated()) .activity-date.utc-date(data-date=activity.GetCreated())
if activity.TypeName() == "ActivityCreate" if activity.TypeName() == "ActivityCreate"
ActivityCreateText(activity.(*arn.ActivityCreate), user) ActivityCreateText(activity.(*arn.ActivityCreate), user)
else if activity.TypeName() == "ActivityConsumeAnime" else if activity.TypeName() == "ActivityConsumeAnime"
ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user) ActivityConsumeAnimeText(activity.(*arn.ActivityConsumeAnime), user)
component ActivityConsumeAnimeTitle(activity *arn.ActivityConsumeAnime, user *arn.User)
a(href=activity.Anime().Link())= activity.Anime().TitleByUser(user)
component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn.User) component ActivityConsumeAnimeText(activity *arn.ActivityConsumeAnime, user *arn.User)
if activity.ToEpisode > activity.FromEpisode .activity-text-consume-anime
em.actvity-text-consume-anime= fmt.Sprintf("%s watched episodes %d - %d", activity.Creator().Nick, activity.FromEpisode, activity.ToEpisode) span watched
else a(href=activity.Anime().Link())= activity.Anime().TitleByUser(user)
em.actvity-text-consume-anime= fmt.Sprintf("%s watched episode %d", activity.Creator().Nick, activity.ToEpisode)
if activity.ToEpisode > activity.FromEpisode
span= fmt.Sprintf(" episodes %d - %d.", activity.FromEpisode, activity.ToEpisode)
else
span= fmt.Sprintf(" episode %d.", activity.ToEpisode)
component ActivityCreateMeta(activity *arn.ActivityCreate, user *arn.User)
span in
component ActivityCreateTitle(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post" if activity.ObjectType == "Post"
a(href=activity.Postable().Parent().Link())= activity.Postable().Parent().TitleByUser(user) a(href=activity.Postable().Parent().Link())= activity.Postable().Parent().TitleByUser(user)
else if activity.ObjectType == "Thread" else if activity.ObjectType == "Thread"
@ -77,4 +80,4 @@ component ActivityCreateText(activity *arn.ActivityCreate, user *arn.User)
if activity.ObjectType == "Post" || activity.ObjectType == "Thread" if activity.ObjectType == "Post" || activity.ObjectType == "Thread"
div!= activity.Postable().HTML() div!= activity.Postable().HTML()
else else
em.actvity-text-create= "new " + strings.ToLower(activity.ObjectType) em.activity-text-create= "new " + strings.ToLower(activity.ObjectType)

View File

@ -11,8 +11,9 @@
.activity-header .activity-header
horizontal horizontal
horizontal-line-bottom
.activity-parent .activity-creator
flex 1 flex 1
.activity-date .activity-date
@ -21,6 +22,9 @@
.actvity-text-create .actvity-text-create
opacity 0.8 opacity 0.8
.activity-text-consume-anime
// ...
.activity-action .activity-action
border none border none
background none background none

View File

@ -0,0 +1,4 @@
mixin horizontal-line-bottom
padding-bottom typography-margin
border-bottom 1px solid reverse-light-color
margin-bottom typography-margin