Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icons for Views and Replies, and Last Activity date #13

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions common/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,29 @@
display: flex;
justify-content: space-between;
align-items: center;
.number,
.d-icon,
.activity a {
font-weight: bold;
font-size: var(--font-down-1-rem);
}
.right-aligned {
margin-left: auto;
display: flex;
justify-content: space-between;
align-items: center;
.item {
flex-grow: 0;
flex-shrink: 1;
margin-left: 20px; /* Adjust as necessary for spacing */
&.topic-card__likes:first-child:last-child {
color: var(--love);
.d-icon {
color: var(--love);
}
}
}
}
}
&__publish-date {
font-size: var(--font-down-1-rem);
Expand All @@ -169,20 +192,15 @@
-webkit-box-orient: vertical;
max-height: 3.3em;
}
&__likes {
display: flex;
align-items: center;
gap: 0.25em;
&-number {
color: var(--love);
font-weight: bold;
font-size: var(--font-down-1-rem);
}

.d-icon {
color: var(--love);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've regressed on the color for the heart icon, can we restore that? Or does it look poorly if its color is different from the other icons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was on purpose, it indeed looks really stupid if it's the only colored icon. Sorry for not mentioning that explicitly.
I wasn't sure how to deal with this, remove it by default seemed the best idea.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, for what is worth I agree with the removal of the red color. Initially Topic Cards had only one icon, and having it red was ok. But in Topic List Thumbnails none of the icons deviates from gray, which makes sense, and this PR follows that consistency.

For what is worth, this is how the four icons looks like, and it looks very good imho:

image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the delay here, folks, I was out on vacation.

I found a way to add the like icon color but only when it is displayed on its own. Goal here was to keep existing behaviour intact.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a brilliant solution!! 👍

}
}
}
}
}

// remove fixed with and heat color from activity column
.topic-list .age,
.topic-list .activity {
width: inherit;
a {
color: inherit;
}
}
48 changes: 39 additions & 9 deletions javascripts/discourse/templates/topic-metadata.hbr
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
<div class="topic-card__metadata">
<span class="topic-card__publish-date">
{{theme-i18n "published"}}
{{format-date view.topic.createdAt format="medium-with-ago"}}
</span>

<span class="topic-card__likes">
<span class="topic-card__likes-number">{{view.topic.like_count}}</span>
{{d-icon "heart"}}
</span>
{{#if (theme-setting 'show_publish_date')}}
<span class="topic-card__publish-date">
{{theme-i18n "published"}}
{{format-date view.topic.createdAt format="medium-with-ago"}}
</span>
{{/if}}

<div class="right-aligned">
{{#if (theme-setting 'show_views')}}
<span class="topic-card__views item">
{{d-icon "eye"}}
<span class="number">
{{view.topic.views}}
</span>
</span>
{{/if}}

{{#if (theme-setting 'show_likes')}}
<span class="topic-card__likes item">
{{d-icon "heart"}}
<span class="number">
{{view.topic.like_count}}
</span>
</span>
{{/if}}

{{#if (theme-setting 'show_reply_count')}}
<span class="topic-card__reply_count item">
{{d-icon "comment"}}
<span class="number">
{{view.topic.replyCount}}
</span>
</span>
{{/if}}

{{#if (theme-setting 'show_activity')}}
{{raw "list/activity-column" topic=view.topic class="topic-card-data-activity item" tagName="div"}}
{{/if}}
</div>
</div>
21 changes: 20 additions & 1 deletion settings.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
show_likes:
type: bool
default: true
description: Show likes on topic card
show_views:
type: bool
default: false
description: Show views on topic card
show_reply_count:
type: bool
default: false
description: Show reply count on topic card
show_activity:
type: bool
default: false
description: Show activity on topic card
show_publish_date:
type: bool
default: true
description: Show publish date on topic card
set_card_max_height:
type: bool
default: true
description: "Set max height for the topic cards. If unset, the cards will grow to the height of the image rendering."

card_max_height:
type: integer
default: 275
Expand Down