Skip to content

Commit

Permalink
Fix reputation
Browse files Browse the repository at this point in the history
  • Loading branch information
cyri113 committed Feb 19, 2025
1 parent 7459c13 commit 8e2fa2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import UpvoteButton from "@/components/UpvoteButton";
import { useToken } from "@/context/TokenContext";
import { ICommunityPlatfromProps } from "@/utils/interfaces"

const ALLOW_LIST = [
'discord',
'telegram',
// 'twitter',
// 'github',
// 'linkedin',
// 'instagram',
// 'youtube',
]

interface IReputationItemProps {
platform: ICommunityPlatfromProps
}
Expand Down Expand Up @@ -37,7 +47,8 @@ function DisabledCard({ platform }: IReputationItemProps) {
)
}

function ReputationItem({ platform }: IReputationItemProps) {
function ActiveCard({ platform }: IReputationItemProps) {

const { data, loading, error } = useApi<ICommunityPlatfromProps>(`/platforms/${platform.id}/reputation-score`);

if (loading) return <Loading />
Expand All @@ -54,4 +65,11 @@ function ReputationItem({ platform }: IReputationItemProps) {
)
}

function ReputationItem({ platform }: IReputationItemProps) {

if (!ALLOW_LIST.includes(platform.name)) return <DisabledCard platform={platform} />;

return <ActiveCard platform={platform} />
}

export default ReputationItem;
3 changes: 1 addition & 2 deletions src/pages/reputation-score/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Loading from "@/components/global/Loading";
import SEO from "@/components/global/SEO";
import ReputationItem from "@/components/reputation/ReputationItem";

import { useToken } from "@/context/TokenContext";
import { defaultLayout } from "@/layouts/defaultLayout";
import { withRoles } from "@/utils/withRoles";

import ReputationItem from "./ReputationItem";

function ReputationScore() {

const { community } = useToken()
Expand Down
1 change: 0 additions & 1 deletion src/pages/reputation-score/score.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import TcBoxContainer from '@/components/shared/TcBox/TcBoxContainer';
import useAppStore from '@/store/useStore';

import { useSnackbar } from '@/context/SnackbarContext';
import { withRoles } from '@/utils/withRoles';

const ScorePage = () => {
const { showMessage } = useSnackbar();
Expand Down

0 comments on commit 8e2fa2e

Please sign in to comment.