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

FEATURE: Activity indicators for cards #61

Merged
merged 3 commits into from
Oct 9, 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
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 {
border-left: 5px solid var(--danger-low);
}

&.card-stale {
border-left: 5px solid var(--danger-medium);
}

.card-row {
display: flex;
align-items: baseline;
Expand Down
18 changes: 18 additions & 0 deletions javascripts/discourse/components/kanban/card.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,30 @@ 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 ago or more than 20 days ago a different style will be applied.