diff --git a/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx b/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx
index 4a59d7be..387b4aea 100644
--- a/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx
+++ b/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx
@@ -96,8 +96,6 @@ function TcCommunityPlatforms() {
};
useEffect(() => {
- console.log({ activeTab });
-
fetchPlatformsByType();
}, [activeTab]);
diff --git a/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx b/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx
index b4ee3b46..9f258b55 100644
--- a/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx
+++ b/src/components/communitySettings/communityPlatforms/TcDiscourse.tsx
@@ -1,4 +1,12 @@
-import { CircularProgress, FormControl, Paper, TextField } from '@mui/material';
+import {
+ Alert,
+ AlertTitle,
+ CircularProgress,
+ FormControl,
+ Paper,
+ TextField,
+ Typography,
+} from '@mui/material';
import moment from 'moment';
import React, { useState } from 'react';
import { AiOutlineClose } from 'react-icons/ai';
@@ -50,12 +58,10 @@ function TcDiscourse({
name: 'discourse',
metadata: {
id: url.replaceAll('https://', '').replaceAll('http://', ''),
- period: community?.platforms.filter(
- (platform) => platform.name === 'discourse'
- )[0]?.metadata?.period,
- analyzerStartedAt: community?.platforms.filter(
- (platform) => platform.name === 'discourse'
- )[0]?.metadata?.analyzerStartedAt,
+ period: new Date(
+ new Date().setDate(new Date().getDate() - 90)
+ ).toISOString(),
+ analyzerStartedAt: new Date().toISOString(),
resources: [],
},
});
@@ -213,21 +219,31 @@ function TcDiscourse({
>
) : (
-
-
-
+ <>
+
+ Analyzing Your Community Data
+
+ We're currently analyzing 90 days of your community's data.
+ This process may take up to 6 hours. Once the analysis is
+ complete, you will receive a message on Discord.
+
+
+
+
+
+ >
)}
{!activePlatform && (
diff --git a/src/components/layouts/Sidebar.tsx b/src/components/layouts/Sidebar.tsx
index 4bb290e8..e868f5b8 100644
--- a/src/components/layouts/Sidebar.tsx
+++ b/src/components/layouts/Sidebar.tsx
@@ -4,6 +4,7 @@ type items = {
name: string;
path: string;
icon: any;
+ isVisible?: boolean;
};
import { faHeartPulse, faUserGroup } from '@fortawesome/free-solid-svg-icons';
@@ -24,7 +25,8 @@ import useAppStore from '../../store/useStore';
const Sidebar = () => {
const router = useRouter();
const currentRoute = router.pathname;
- const { community } = useToken();
+ const { community, selectedPlatform } = useToken();
+ const [isDiscourse, setIsDiscourse] = useState(false);
const userPermissions = useAppStore(
(state) => state.userRolePermissions || []
@@ -46,6 +48,18 @@ const Sidebar = () => {
}
}, [community]);
+ useEffect(() => {
+ const discoursePlatformId = community?.platforms?.find((platform) => {
+ return platform.name === 'discourse' && platform.disconnectedAt === null;
+ })?.id;
+
+ if (discoursePlatformId && selectedPlatform) {
+ setIsDiscourse(selectedPlatform === discoursePlatformId);
+ } else {
+ setIsDiscourse(false);
+ }
+ }, [community, selectedPlatform]);
+
let menuItems: items[] = [
{
name: 'Community Insights',
@@ -95,6 +109,10 @@ const Sidebar = () => {
);
}
+ if (isDiscourse) {
+ menuItems = menuItems.filter((item) => item.name !== 'Smart Announcements');
+ }
+
const menuItem = menuItems.map((el) => (
diff --git a/src/pages/community-settings/violation-detection/index.tsx b/src/pages/community-settings/violation-detection/index.tsx
index 03a07d0f..09070bdb 100644
--- a/src/pages/community-settings/violation-detection/index.tsx
+++ b/src/pages/community-settings/violation-detection/index.tsx
@@ -68,8 +68,9 @@ function Index() {
setViolationModules(results);
if (results.length > 0) {
+ if (results[0]?.options?.platforms.length === 0) return;
setEmails(
- results[0].options.platforms[0].metadata.selectedEmails || []
+ results[0]?.options?.platforms[0]?.metadata?.selectedEmails || []
);
const hasActiveModerators =