+
Connect your communities
- {guilds.length >= 1 ? (
-
- It will be possible to connect more communities soon.
-
- }
- arrow
- placement="right"
- >
-
- Discord
-
-
-
-
- ) : (
-
connectNewGuild()}
- >
- Discord
-
-
-
-
Connect
+
+ {isAllTwitterPropertiesNull ? (
+
+
handleAuthorizeTwitter()}
+ >
+ Twitter
+
+
+
-
- )}
+ ) : (
+ <>>
+ )}
+
+ {guilds.length >= 1 ? (
+
+ It will be possible to connect more communities soon.
+
+ }
+ arrow
+ placement="right"
+ >
+
+ Discord
+
+
+
+
+ ) : (
+
connectNewGuild()}
+ >
+ Discord
+
+
+
+ )}
+
+
>
diff --git a/src/components/pages/settings/ConnectedCommunitiesList.tsx b/src/components/pages/settings/ConnectedCommunitiesList.tsx
index ab22c9f7..f1972bb2 100644
--- a/src/components/pages/settings/ConnectedCommunitiesList.tsx
+++ b/src/components/pages/settings/ConnectedCommunitiesList.tsx
@@ -8,12 +8,13 @@ import { Paper } from '@mui/material';
import useAppStore from '../../../store/useStore';
import { DISCONNECT_TYPE } from '../../../store/types/ISetting';
import { StorageService } from '../../../services/StorageService';
-import { IUser } from '../../../utils/types';
+import { ITwitter, IUser } from '../../../utils/types';
import {
setAmplitudeUserIdFromToken,
trackAmplitudeEvent,
} from '../../../helpers/amplitudeHelper';
+import ConnectedTwitter from './ConnectedTwitter';
export default function ConnectedCommunitiesList({ guilds }: any) {
const { disconnecGuildById, getGuilds } = useAppStore();
@@ -22,6 +23,7 @@ export default function ConnectedCommunitiesList({ guilds }: any) {
const toggleModal = (e: boolean) => {
setOpen(e);
};
+ let user: IUser | undefined = StorageService.readLocalStorage
('user');
const notify = () => {
toast('The integration has been disconnected succesfully.', {
position: 'top-center',
@@ -42,9 +44,6 @@ export default function ConnectedCommunitiesList({ guilds }: any) {
notify();
getGuilds();
- let user: IUser | undefined =
- StorageService.readLocalStorage('user');
-
setAmplitudeUserIdFromToken();
trackAmplitudeEvent({
@@ -61,6 +60,15 @@ export default function ConnectedCommunitiesList({ guilds }: any) {
});
};
+ function isAllTwitterPropertiesNull(twitter: ITwitter): boolean {
+ return (
+ twitter.twitterConnectedAt === null &&
+ twitter.twitterId === null &&
+ twitter.twitterProfileImageUrl === null &&
+ twitter.twitterUsername === null
+ );
+ }
+
return (
<>
{guilds && guilds.length > 0 ? (
@@ -82,6 +90,13 @@ export default function ConnectedCommunitiesList({ guilds }: any) {
))
: ''}
+ {user?.twitter && !isAllTwitterPropertiesNull(user.twitter) ? (
+