b72a3c1e95
This is the second iteration on the topic card design, in which we bring
back the OP and change the layout.
**Changes**:
* Show OP avatar
* Remove activity avatar and replace by reply icon
* Remove activity icon background
* Move category tag to top left
* Replace long activity copy ("…replied at…") with dot separator
* Change date formatting to `tiny`
* Adjust bulk select styling to new layout + align checkbox to top on
mobile VS keep centred on desktop
* Why: On desktop, the avatar is taking 2 lines (usually) and aligning
the checkbox vertically looks nice. Exception for excerpts, but since
that's only available for pinned topics atm that's a low occurrence. On
mobile, the topic card is 3 lines, with a smaller avatar, which makes
the checkbox "float" around a bit when centred. Hence aligning it to the
top, which for solid avatars aligns nicely too.
* CSS refactor: grid, breakpoints
Messages/bookmarks have not been changed.
| Description | Visual |
|--------|--------|
| Large topic list | |
| Large bulk edit | 
|
| Medium topic list | 
|
| Medium bulk edit | 
|
| Small topic list | 
|
| Small bulk edit | 
|
| Messages page (remains unchanged) | 
|
| Bookmark page (remains unchanged) | 
|
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import concatClass from "discourse/helpers/concat-class";
|
|
import icon from "discourse/helpers/d-icon";
|
|
import formatDate from "discourse/helpers/format-date";
|
|
|
|
export default class TopicActivityColumn extends Component {
|
|
get topicUser() {
|
|
if (
|
|
moment(this.args.topic.bumped_at).isAfter(this.args.topic.last_posted_at)
|
|
) {
|
|
return {
|
|
user: undefined,
|
|
username: undefined,
|
|
activityText: "user_updated",
|
|
class: "--updated",
|
|
};
|
|
}
|
|
|
|
if (this.args.topic.posts_count > 1) {
|
|
return {
|
|
user: this.args.topic.lastPosterUser,
|
|
username: this.args.topic.last_poster_username,
|
|
activityText: "user_replied",
|
|
class: "--replied",
|
|
};
|
|
} else if (this.args.topic.posts_count === 1) {
|
|
return {
|
|
user: this.args.topic.firstPosterUser,
|
|
username: this.args.topic.last_poster_username,
|
|
class: "--created",
|
|
};
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
<template>
|
|
<span class={{concatClass "topic-activity" this.topicUser.class}}>
|
|
<div class="topic-activity__type">
|
|
{{#if this.topicUser.user}}
|
|
{{icon "reply"}}
|
|
{{else}}
|
|
{{icon "pencil"}}
|
|
{{/if}}
|
|
</div>
|
|
|
|
{{#if this.topicUser.username}}
|
|
<span
|
|
class="topic-activity__username"
|
|
>{{this.topicUser.username}}</span>
|
|
<span class="dot-separator"></span>
|
|
{{/if}}
|
|
|
|
<div class="topic-activity__time">
|
|
{{formatDate @topic.bumpedAt leaveAgo="true" format="tiny"}}
|
|
</div>
|
|
</span>
|
|
</template>
|
|
}
|