Skip to content

Commit

Permalink
FEATURE: Activity indicators for cards
Browse files Browse the repository at this point in the history
This commit adds a show_activity_indicators setting,
if set to true then a CSS class will be applied to
cards where the bumped_at date is:

* > 7 days
* > 20 days

This will style cards which will make it easier to
scan the board and see which cards may be languishing.
  • Loading branch information
martin-brennan committed Oct 4, 2024
1 parent 9a70845 commit ad939dc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ html:has(body.kanban-active) {
background-color: var(--tertiary-low);
}

&.card-no-recent-activity {
background-color: var(--highlight-bg);
}

&.card-stale {
background-color: var(--quaternary-low);
}

.card-row {
display: flex;
align-items: baseline;
Expand Down
17 changes: 17 additions & 0 deletions javascripts/discourse/components/kanban/card.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,29 @@ export default class KanbanCard extends Component {
poster.extras?.includes("latest")
);
}

get cardActivityCssClass() {
if (!settings.show_activity_indicators) {
return "";
}

const bumpedAt = moment(this.args.topic.bumpedAt);
if (bumpedAt < moment().add(-20, "days")) {
return "card-stale";
}
if (bumpedAt < moment().add(-7, "days")) {
return "card-no-recent-activity";
}
return "";
}

<template>
<a
class={{concatClass
"topic-card"
(if this.topic.unseen "topic-unseen")
(if this.dragging "dragging")
this.cardActivityCssClass
}}
draggable="true"
href={{@topic.lastUnreadUrl}}
Expand Down
4 changes: 4 additions & 0 deletions settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ show_topic_thumbnail:
default: false
description:
en: Display the topic thumbnail at the bottom of the card
show_activity_indicators:
default: false
description:
en: Display an indicator of a card's activity. If the topic has been bumped more than 7 days agoor more than 20 days ago a different CSS class will be applied.

0 comments on commit ad939dc

Please sign in to comment.