+ To confirm that you want to delete the community, please type{' '}
+ {community?.name} in the field below:
+ >
+ }
/>
platform.disconnectedAt === null
+ )?.id;
const [loading, setLoading] = useState(false);
diff --git a/src/components/pages/pageIndex/ActiveMemberComposition.tsx b/src/components/pages/pageIndex/ActiveMemberComposition.tsx
index 02fd7d64..f93a00a0 100644
--- a/src/components/pages/pageIndex/ActiveMemberComposition.tsx
+++ b/src/components/pages/pageIndex/ActiveMemberComposition.tsx
@@ -18,7 +18,9 @@ const ActiveMemberComposition = () => {
let endDate: moment.Moment = moment().subtract(1, 'day');
let startDate: moment.Moment = moment(endDate).subtract(7, 'days');
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
if (platformId) {
fetchActiveMembers(platformId, startDate, endDate);
diff --git a/src/components/pages/pageIndex/HeatmapChart.tsx b/src/components/pages/pageIndex/HeatmapChart.tsx
index a371f2e4..55a15eca 100644
--- a/src/components/pages/pageIndex/HeatmapChart.tsx
+++ b/src/components/pages/pageIndex/HeatmapChart.tsx
@@ -16,8 +16,6 @@ import { useToken } from '../../../context/TokenContext';
import { defaultHeatmapChartOptions } from '../../../lib/data/heatmap';
import { ChannelContext } from '../../../context/ChannelContext';
import { extractTrueSubChannelIds } from '../../../helpers/helper';
-import { StorageService } from '../../../services/StorageService';
-import { IDiscordModifiedCommunity } from '../../../utils/interfaces';
import Loading from '../../global/Loading';
if (typeof Highcharts === 'object') {
@@ -52,7 +50,9 @@ const HeatmapChart = () => {
const { community } = useToken();
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
const fetchData = async () => {
setLoading(true);
@@ -149,11 +149,6 @@ const HeatmapChart = () => {
const fetchPlatformChannels = async () => {
try {
- const community =
- StorageService.readLocalStorage('community');
-
- const platformId = community?.platforms[0]?.id;
-
if (platformId) {
const data = await retrievePlatformById(platformId);
const { metadata } = data;
diff --git a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx
index c830e788..695ed30f 100644
--- a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx
+++ b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.tsx
@@ -56,7 +56,10 @@ export default function ActiveMemberBreakdown() {
totalPages: 0,
totalResults: 0,
});
- const platformId = community?.platforms[0]?.id;
+
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
const handlePageChange = (selectedPage: number) => {
setPage(selectedPage);
diff --git a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx
index e34bab2d..74004a86 100644
--- a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx
+++ b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx
@@ -68,7 +68,9 @@ export default function DisengagedMembersCompositionBreakdown() {
totalResults: 0,
});
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
const handlePageChange = (selectedPage: number) => {
setPage(selectedPage);
diff --git a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx
index 57c1c62a..e3044964 100644
--- a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx
+++ b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx
@@ -56,7 +56,9 @@ export default function OnboardingMembersBreakdown() {
totalResults: 0,
});
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
const handlePageChange = (selectedPage: number) => {
setPage(selectedPage);
diff --git a/src/pages/community-health.tsx b/src/pages/community-health.tsx
index 6cc408ac..c4451da3 100644
--- a/src/pages/community-health.tsx
+++ b/src/pages/community-health.tsx
@@ -21,7 +21,9 @@ function CommunityHealth() {
useState(null);
useEffect(() => {
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
if (platformId) {
Promise.all([
diff --git a/src/pages/membersInteraction.tsx b/src/pages/membersInteraction.tsx
index 335b7c3a..f296ba19 100644
--- a/src/pages/membersInteraction.tsx
+++ b/src/pages/membersInteraction.tsx
@@ -102,7 +102,9 @@ export default function membersInteraction() {
const { getMemberInteraction, isLoading } = useAppStore();
useEffect(() => {
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
if (platformId) {
getMemberInteraction(platformId).then((apiResponse: any[]) => {
diff --git a/src/pages/statistics.tsx b/src/pages/statistics.tsx
index 7abcd6a5..45378585 100644
--- a/src/pages/statistics.tsx
+++ b/src/pages/statistics.tsx
@@ -22,7 +22,9 @@ import Image from 'next/image';
const Statistics = () => {
const { community } = useToken();
- const platformId = community?.platforms[0]?.id;
+ const platformId = community?.platforms.find(
+ (platform) => platform.disconnectedAt === null
+ )?.id;
const [loading, setLoading] = useState(true);
const [activeMemberDate, setActiveMemberDate] = useState(1);