Merge branch 'dev' into jajaja

# Conflicts:
#	package.json
#	yarn.lock
This commit is contained in:
Mike Cao 2025-03-31 23:31:09 -05:00
commit c71e9b5707
11 changed files with 126 additions and 30 deletions

View file

@ -7,7 +7,7 @@ const formats = {
millisecond: 'T',
second: 'pp',
minute: 'p',
hour: 'h:mm aaa - PP',
hour: 'p - PP',
day: 'PPPP',
week: 'PPPP',
month: 'LLLL yyyy',

View file

@ -60,19 +60,24 @@ export function ReferrersTable({ allowFilter, ...props }: ReferrersTableProps) {
);
};
const getDomain = (x: string) => {
for (const { domain, match } of GROUPED_DOMAINS) {
if (Array.isArray(match) ? match.some(str => x.includes(str)) : x.includes(match)) {
return domain;
}
}
return '_other';
};
const groupedFilter = (data: any[]) => {
const groups = { _other: 0 };
for (const { x, y } of data) {
for (const { domain, match } of GROUPED_DOMAINS) {
if (Array.isArray(match) ? match.some(str => x.includes(str)) : x.includes(match)) {
if (!groups[domain]) {
groups[domain] = 0;
}
groups[domain] += +y;
}
const domain = getDomain(x);
if (!groups[domain]) {
groups[domain] = 0;
}
groups._other += +y;
groups[domain] += +y;
}
return Object.keys(groups)