Skip to content

Commit

Permalink
add inprogress field to twitter connected account for status
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Oct 2, 2023
1 parent 7af2d52 commit 345aed8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/components/pages/settings/ConnectCommunities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export default function ConnectCommunities() {
user &&
user.twitter &&
Object.values(user.twitter).every((value) => value == null);
console.log({ isAllTwitterPropertiesNull });

return (
<>
Expand Down
8 changes: 7 additions & 1 deletion src/components/pages/settings/ConnectedTwitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useAppStore from '../../../store/useStore';
import { BsTwitter } from 'react-icons/bs';
import moment from 'moment';
import { StorageService } from '../../../services/StorageService';
import clsx from 'clsx';

interface IConnectedTwitter {
twitter?: ITwitter;
Expand Down Expand Up @@ -37,7 +38,12 @@ function ConnectedTwitter({ twitter }: IConnectedTwitter) {
<div>
<div className="font-sm flex justify-center items-center text-center">
<p className="pr-1">Twitter</p>
<span className="md:h-3 md:w-3 rounded-full bg-success" />
<span
className={clsx(
'md:h-3 md:w-3 rounded-full',
twitter?.twitterIsInProgress ? 'bg-success' : 'bg-warning-500'
)}
/>
</div>
<BsTwitter size={30} className="mx-auto mt-2 mb-3" />
</div>
Expand Down
1 change: 1 addition & 0 deletions src/pages/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function Settings(): JSX.Element {
fetchEmail();
const intervalId = setInterval(() => {
getGuilds();
getUserInfo();
}, 5000);

// Clean up the interval when the component unmounts
Expand Down
7 changes: 2 additions & 5 deletions src/store/slices/settingSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ const createSettingSlice: StateCreator<ISetting> = (set, get) => ({
},
getUserInfo: async () => {
try {
set(() => ({ isLoading: true }));
const { data } = await axiosInstance.get('/users/@me');
set({ userInfo: data, isLoading: false });
set({ userInfo: data });
return data;
} catch (error) {
set(() => ({ isLoading: false }));
}
} catch (error) {}
},
getGuildInfoByDiscord: async (guildId) => {
try {
Expand Down
1 change: 1 addition & 0 deletions src/store/types/ISetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IUserInfo {
twitterId: string;
twitterProfileImageUrl: string;
twitterUsername: string;
twitterIsInProgress: boolean;
id: string;
}

Expand Down
1 change: 1 addition & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ITwitter {
twitterProfileImageUrl: string;
twitterUsername: string;
lastUpdatedMetrics: string;
twitterIsInProgress: boolean;
}

export type IUser = {
Expand Down

0 comments on commit 345aed8

Please sign in to comment.