Skip to content

Commit

Permalink
Merge pull request #2747 from GreenAsJade/zoom_in_cm_stats_graph
Browse files Browse the repository at this point in the history
Display only 120 days of CM voting graph
  • Loading branch information
anoek authored Jul 8, 2024
2 parents 095bf2b + 3a8aea7 commit d54edb8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"@types/sanitize-html": "^1.22.0",
"array-move": "^2.2.1",
"d3": "^7.6.1",
"date-fns": "^3.6.0",
"eventemitter3": "^5.0.0",
"howler": "^2.2.1",
"jquery": "^3.6.0",
Expand Down
15 changes: 13 additions & 2 deletions src/views/ReportsCenter/ReportsCenterCMInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/

import React, { useEffect } from "react";
import { format, subDays, startOfWeek as startOfWeekDateFns } from "date-fns";

import { get } from "requests";

import * as data from "data";

import { ResponsiveLine } from "@nivo/line";
Expand Down Expand Up @@ -188,7 +191,11 @@ const CMVoteActivityGraph = ({ vote_data }: VoteActivityGraphProps) => {
xFormat="time:%Y-%m-%d"
xScale={{
type: "time",
min: "2023-12-31",
min: format(
startOfWeekDateFns(subDays(new Date(), 120), { weekStartsOn: 1 }),

"yyyy-MM-dd",
),
format: "%Y-%m-%d",
useUTC: false,
precision: "day",
Expand Down Expand Up @@ -224,7 +231,11 @@ const CMVoteActivityGraph = ({ vote_data }: VoteActivityGraphProps) => {
xFormat="time:%Y-%m-%d"
xScale={{
type: "time",
min: "2023-12-31",
min: format(
startOfWeekDateFns(subDays(new Date(), 120), { weekStartsOn: 1 }),

"yyyy-MM-dd",
),
format: "%Y-%m-%d",
useUTC: false,
precision: "day",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4262,6 +4262,11 @@ data-view-byte-offset@^1.0.0:
es-errors "^1.3.0"
is-data-view "^1.0.1"

date-fns@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf"
integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==

debounce@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5"
Expand Down

0 comments on commit d54edb8

Please sign in to comment.