From 970bdb71410026262ff4f2fe12dfd323a4319851 Mon Sep 17 00:00:00 2001 From: Mehdi Torabi <46302001+mehdi-torabiv@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:54:35 +0300 Subject: [PATCH 1/2] Fix/platform ordering (#366) * update platform ordering * update hivemind ordering --------- Co-authored-by: Cyrille <1618640+cyri113@users.noreply.github.com> --- .../HivemindSettings/TcHivemindSettings.tsx | 92 +++++++++---------- .../TcCommunityPlatformIcon.tsx | 3 + .../TcCommunityPlatforms.tsx | 16 ++-- src/utils/enums.ts | 6 +- 4 files changed, 59 insertions(+), 58 deletions(-) diff --git a/src/components/communitySettings/HivemindSettings/TcHivemindSettings.tsx b/src/components/communitySettings/HivemindSettings/TcHivemindSettings.tsx index 6ad038df..9add16af 100644 --- a/src/components/communitySettings/HivemindSettings/TcHivemindSettings.tsx +++ b/src/components/communitySettings/HivemindSettings/TcHivemindSettings.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-case-declarations */ import React, { useEffect, useState } from 'react'; import { Box, CircularProgress, Paper, Tab, Tabs } from '@mui/material'; import clsx from 'clsx'; @@ -52,6 +53,18 @@ function a11yProps(index: number) { }; } +const PLATFORM_ORDER = [ + IntegrationPlatform.Discord, + IntegrationPlatform.Github, + IntegrationPlatform.Notion, + IntegrationPlatform.MediaWiki, + IntegrationPlatform.Discourse, + IntegrationPlatform.Telegram, + IntegrationPlatform.X, + IntegrationPlatform.Snapshot, + IntegrationPlatform.GDrive, +]; + function HivemindSettings() { const { retrievePlatforms, retrieveModules, patchModule } = useAppStore(); const [loading, setLoading] = useState(false); @@ -113,22 +126,6 @@ function HivemindSettings() { case 1: setIsActivePlatformLoading(true); const { results: googleResults } = await retrievePlatforms({ - name: 'google', - community: communityId, - }); - const gdriveHivemindModule = hivemindModules.results.find( - (hivemindModule: IModuleProps) => - hivemindModule.community === communityId - ); - - setHivemindModule(gdriveHivemindModule); - setPlatforms(googleResults); - setIsActivePlatformLoading(false); - break; - - case 2: - setIsActivePlatformLoading(true); - const { results: githubResults } = await retrievePlatforms({ name: 'github', community: communityId, }); @@ -138,28 +135,27 @@ function HivemindSettings() { ); setHivemindModule(githubHivemindModule); - setPlatforms(githubResults); + setPlatforms(googleResults); setIsActivePlatformLoading(false); break; - case 3: + case 2: setIsActivePlatformLoading(true); - const { results: notionResults } = await retrievePlatforms({ + const { results: githubResults } = await retrievePlatforms({ name: 'notion', community: communityId, }); - const notionHivemindModule = hivemindModules.results.find( (hivemindModule: IModuleProps) => hivemindModule.community === communityId ); setHivemindModule(notionHivemindModule); - setPlatforms(notionResults); + setPlatforms(githubResults); setIsActivePlatformLoading(false); break; - case 4: + case 3: setIsActivePlatformLoading(true); const { results: mediaWikiResults } = await retrievePlatforms({ name: 'mediaWiki', @@ -174,6 +170,8 @@ function HivemindSettings() { setHivemindModule(mediaWikiHivemindModule); setPlatforms(mediaWikiResults); setIsActivePlatformLoading(false); + break; + default: break; } @@ -341,14 +339,14 @@ function HivemindSettings() { return ( <> -
+
setActivePlatform(newValue)} > - {Object.keys(IntegrationPlatform).map((platform, index) => ( + {PLATFORM_ORDER.map((platform, index) => ( - {platform === 'GDrive' && ( + {platform === IntegrationPlatform.GDrive && (
-
+
{platforms && platforms.length > 0 ? ( - {platforms && platforms.length > 0 && ( - platform.name === 'google' - )?.metadata || { driveIds: [], folderIds: [], fileIds: [] } - } - handlePatchHivemindGoogle={(payload) => - handlePatchModule('google', payload) - } - isLoading={loading} - /> - )} - - )} - {activePlatform === 2 && ( - {platforms && platforms.length > 0 && ( )} - {activePlatform === 3 && ( - + {activePlatform === 2 && ( + {platforms && platforms.length > 0 && ( )} - {activePlatform === 4 && ( - + {activePlatform === 3 && ( + {platforms && platforms.length > 0 && ( )} + {activePlatform === 4 && ( + + {platforms && platforms.length > 0 && ( + platform.name === 'google' + )?.metadata || { driveIds: [], folderIds: [], fileIds: [] } + } + handlePatchHivemindGoogle={(payload) => + handlePatchModule('google', payload) + } + isLoading={loading} + /> + )} + + )} ); diff --git a/src/components/communitySettings/communityPlatforms/TcCommunityPlatformIcon.tsx b/src/components/communitySettings/communityPlatforms/TcCommunityPlatformIcon.tsx index 78db5fa2..1e555683 100644 --- a/src/components/communitySettings/communityPlatforms/TcCommunityPlatformIcon.tsx +++ b/src/components/communitySettings/communityPlatforms/TcCommunityPlatformIcon.tsx @@ -7,6 +7,7 @@ import { FaGoogleDrive } from 'react-icons/fa'; import { FaWikipediaW } from 'react-icons/fa'; import { FaGoogle } from 'react-icons/fa'; import { FaTelegram, FaTwitter } from 'react-icons/fa6'; +import { FaSquareXTwitter } from "react-icons/fa6"; import { RiNotionFill } from 'react-icons/ri'; interface TcCommunityPlatformIconProps { @@ -24,6 +25,8 @@ function TcCommunityPlatformIcon({ return ; case 'Twitter': return ; + case 'X': + return ; case 'Discourse': return ; case 'Telegram': diff --git a/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx b/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx index 7ce0adc1..62785344 100644 --- a/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx +++ b/src/components/communitySettings/communityPlatforms/TcCommunityPlatforms.tsx @@ -69,11 +69,11 @@ function TcCommunityPlatforms() { const fetchPlatformsByType = async () => { const platformNames = [ 'discord', - 'google', 'github', + 'discourse', 'notion', 'mediaWiki', - 'discourse', + 'google', ]; const platformName = platformNames[activeTab]; @@ -180,7 +180,7 @@ function TcCommunityPlatforms() { return (
-
+
@@ -246,7 +246,7 @@ function TcCommunityPlatforms() { )} {activeTab === 1 && ( - - -
-
+
-
+
Date: Thu, 12 Dec 2024 18:03:29 +0300 Subject: [PATCH 2/2] remove safari-club (#367) Co-authored-by: Cyrille <1618640+cyri113@users.noreply.github.com> --- src/components/global/SafaryClubScript.tsx | 21 --------------------- src/pages/_app.tsx | 2 -- 2 files changed, 23 deletions(-) delete mode 100644 src/components/global/SafaryClubScript.tsx diff --git a/src/components/global/SafaryClubScript.tsx b/src/components/global/SafaryClubScript.tsx deleted file mode 100644 index fba0c863..00000000 --- a/src/components/global/SafaryClubScript.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { useEffect } from 'react'; - -const SafaryClubScript = () => { - useEffect(() => { - if (process.env.NODE_ENV === 'production') { - const script = document.createElement('script'); - script.src = 'https://tag.safary.club/stag.js?id=prd_3F8QxipEOt'; - script.async = true; - document.head.appendChild(script); - - // Cleanup on component unmount - return () => { - document.head.removeChild(script); - }; - } - }, []); - - return null; -}; - -export default SafaryClubScript; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 02bbb449..7d1495b7 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -29,7 +29,6 @@ import 'react-toastify/dist/ReactToastify.css'; import { wagmiConfig } from '@/rainbowKitConfig'; import AmplitudeAnalytics from '../components/global/AmplitudeAnalytics'; -import SafaryClubScript from '../components/global/SafaryClubScript'; import { conf } from '../configs'; import { ChannelProvider } from '../context/ChannelContext'; import { TokenProvider } from '../context/TokenContext'; @@ -56,7 +55,6 @@ export default function App({ Component, pageProps }: ComponentWithPageLayout) { return ( <> -