feat: instagram, only english labels

This commit is contained in:
Nevo David 2025-07-30 23:04:42 +07:00
parent 3127dd1b6f
commit 66ac549521
4 changed files with 55 additions and 10 deletions

2
.npmrc
View File

@ -2,4 +2,4 @@ ignore-workspace-root-check=true
node-linker=hoisted
restrict-manifest-changes=true
sync-injected-deps-after-scripts[]=build
inject-workspace-packages=true
inject-workspace-packages=true

View File

@ -42,10 +42,8 @@ const nextConfig = {
];
},
};
export default !!process.env.SENTRY_ORG
? withSentryConfig(nextConfig, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
})
: nextConfig;
export default withSentryConfig(nextConfig, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
});

View File

@ -2,13 +2,18 @@
import * as Sentry from '@sentry/nextjs';
import NextError from 'next/error';
import { useEffect } from 'react';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export default function GlobalError({
error,
}: {
error: Error & { digest?: string };
}) {
const { sentryDsn } = useVariables();
useEffect(() => {
if (!sentryDsn) {
return;
}
Sentry.captureException(error);
}, [error]);
return (

View File

@ -615,6 +615,48 @@ export class InstagramProvider
return arr;
}
private setTitle(name: string) {
switch (name) {
case "likes": {
return 'Likes';
}
case "followers": {
return 'Followers';
}
case "reach": {
return 'Reach';
}
case "follower_count": {
return 'Follower Count';
}
case "views": {
return 'Views';
}
case "comments": {
return 'Comments';
}
case "shares": {
return 'Shares';
}
case "saves": {
return 'Saves';
}
case "replies": {
return 'Replies';
}
}
return "";
}
async analytics(
id: string,
accessToken: string,
@ -639,7 +681,7 @@ export class InstagramProvider
analytics.push(
...(data?.map((d: any) => ({
label: d.title,
label: this.setTitle(d.name),
percentageChange: 5,
data: d.values.map((v: any) => ({
total: v.value,
@ -650,7 +692,7 @@ export class InstagramProvider
analytics.push(
...data2.map((d: any) => ({
label: d.title,
label: this.setTitle(d.name),
percentageChange: 5,
data: [
{