Files
d9f9e0c461 UX: New visualizations for new reports (#34)
This adds some new visualizations and styles and reports and cleans up
some existing styles and class names.

Daily activity rhythm 

<img width="1588" height="412" alt="image"
src="https://github.com/user-attachments/assets/0c7980e4-7bb6-4e08-9957-24c3c5718572"
/>


Helping new members

<img width="1456" height="310" alt="image"
src="https://github.com/user-attachments/assets/096a13da-ab63-45d4-9b68-53a01df62a78"
/>

Chat activity 

<img width="1442" height="926" alt="image"
src="https://github.com/user-attachments/assets/07ce2cab-1963-4918-a9ff-805c251a1377"
/>

Assigns 

<img width="1388" height="844" alt="image"
src="https://github.com/user-attachments/assets/ee49c6ee-2da6-4bfa-b500-715ed7ceb13a"
/>

AI usage 

<img width="1442" height="1254" alt="image"
src="https://github.com/user-attachments/assets/b382bffb-010d-4072-9144-cb7e6a8680e3"
/>

Invitations 

<img width="1486" height="1346" alt="image"
src="https://github.com/user-attachments/assets/020f68a9-69d2-46ed-9f38-b0d5e98d02de"
/>

Writing analysis

<img width="917" height="409" alt="image"
src="https://github.com/user-attachments/assets/1147427c-513f-4737-8f28-99bfc6f4aff9"
/>

---------

Co-authored-by: awesomerobot <[email protected]>
Co-authored-by: Martin Brennan <[email protected]>
2025-12-02 09:41:30 -05:00

151 lines
4.1 KiB
Plaintext

import Component from "@glimmer/component";
import { action } from "@ember/object";
import concatClass from "discourse/helpers/concat-class";
import { i18n } from "discourse-i18n";
const ROWS = 7;
const COLS = 53;
export default class ActivityCalendar extends Component {
get rowsArray() {
const data = this.args.report.data;
let rowsArray = [];
for (let r = 0; r < ROWS; r++) {
let rowData = [];
for (let c = 0; c < COLS; c++) {
const index = c * ROWS + r;
rowData.push(data[index] ? data[index] : "");
}
rowsArray.push(rowData);
}
return rowsArray;
}
@action
getAbbreviatedMonth(monthIndex) {
return moment().month(monthIndex).format("MMM");
}
@action
computeCellTitle(cell) {
if (!cell || !cell.date) {
return "";
}
const date = moment(cell.date).format("LL");
if (cell.visited && cell.post_count === 0) {
return i18n(
"discourse_rewind.reports.activity_calendar.cell_title.visited_no_posts",
{ date }
);
} else if (cell.post_count > 0) {
return i18n(
"discourse_rewind.reports.activity_calendar.cell_title.visited_with_posts",
{ date, count: cell.post_count }
);
}
return i18n(
"discourse_rewind.reports.activity_calendar.cell_title.no_activity",
{ date }
);
}
@action
computeClass(count) {
if (!count) {
return "--empty";
} else if (count < 10) {
return "--low";
} else if (count < 20) {
return "--medium";
} else {
return "--high";
}
}
<template>
<div class="rewind-report-page --activity-calendar">
<h2 class="rewind-report-title">{{i18n
"discourse_rewind.reports.activity_calendar.title"
}}</h2>
<div class="rewind-card">
<table class="rewind-calendar">
<thead>
<tr>
<td
colspan="5"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 0}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 1}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 2}}</td>
<td
colspan="5"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 3}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 4}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 5}}</td>
<td
colspan="5"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 6}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 7}}</td>
<td
colspan="5"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 8}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 9}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 10}}</td>
<td
colspan="4"
class="activity-header-cell"
>{{this.getAbbreviatedMonth 11}}</td>
</tr>
</thead>
<tbody>
{{#each this.rowsArray as |row|}}
<tr>
{{#each row as |cell|}}
<td
data-date={{cell.date}}
title={{this.computeCellTitle cell}}
class={{concatClass
"rewind-calendar-cell"
(this.computeClass cell.post_count)
}}
></td>
{{/each}}
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</template>
}