Skip to content

Commit

Permalink
Integrated NDC Contributor, GWG Core Contributor, NDC Champion SBTs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 authored Aug 21, 2023
1 parent 9d9e827 commit e39f63b
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 5 deletions.
40 changes: 38 additions & 2 deletions src/components/common/TokensGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ import { ImageSrc, ReducerNames } from '../../utils/constants';
import { Item, TokenDetails, ValidTokenComponent } from './TokenDetails';

const TokensGrid = () => {
const { fvToken, kycToken, ogToken, vibeToken, regenToken, kudosToken } =
useSelector((state) => state[ReducerNames.SBT]);
const {
fvToken,
kycToken,
ogToken,
vibeToken,
regenToken,
kudosToken,
ndcContributor,
ndcChampion,
gwgCoreContributor,
} = useSelector((state) => state[ReducerNames.SBT]);

return (
<div className="flex flex-col gap-y-10 flex-wrap gap-5">
Expand Down Expand Up @@ -62,6 +71,33 @@ const TokensGrid = () => {
<TokenDetails data={kudosToken} />
</Item>
)}
{gwgCoreContributor && (
<Item imageSrc={ImageSrc.GWGCoreContributorSBT}>
<ValidTokenComponent />
<h2 className="font-bold text-3xl my-1 mb-5">
My GWG Core Contributor Soul Bound Token
</h2>
<TokenDetails data={gwgCoreContributor} />
</Item>
)}
{ndcChampion && (
<Item imageSrc={ImageSrc.NDCChampion}>
<ValidTokenComponent />
<h2 className="font-bold text-3xl my-1 mb-5">
My NDC Champion Soul Bound Token
</h2>
<TokenDetails data={ndcChampion} />
</Item>
)}
{ndcContributor && (
<Item imageSrc={ImageSrc.NDCContributor}>
<ValidTokenComponent />
<h2 className="font-bold text-3xl my-1 mb-5">
My NDC Contributor Soul Bound Token
</h2>
<TokenDetails data={ndcContributor} />
</Item>
)}
</div>
);
};
Expand Down
5 changes: 3 additions & 2 deletions src/pages/CommunitySBT.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ const CommunitySBTPage = () => {
title="Mod"
description="This SBT is your gateway to moderator greatness within the NEAR Digital Collective. Unleash its power of curation and influence."
/>
<ImageTextBlock
{/* don't need it for now */}
{/* <ImageTextBlock
imageSrc={ImageSrc.GWGContributorSBT}
title="GWG Contributor"
description="This SBT shows off your important contribution to the NDC Governance Working Group. Prepare to wield its power and shape the destiny of governance like never before."
/>
/> */}
<ImageTextBlock
imageSrc={ImageSrc.JuggernautSBT}
title="Juggernaut"
Expand Down
19 changes: 19 additions & 0 deletions src/pages/auth/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ const Home = () => {
if (token.metadata.class === 1) {
dispatch(updateTokens({ type: TokenTypes.OG, value: token }));
}
// 2 = NDC_Contributor, 3 = GWG__Core_Contributor, 4 = NDC_Champion
if (token.metadata.class === 2) {
dispatch(
updateTokens({ type: TokenTypes.NDC_Contributor, value: token })
);
}
if (token.metadata.class === 3) {
dispatch(
updateTokens({
type: TokenTypes.GWG__Core_Contributor,
value: token,
})
);
}
if (token.metadata.class === 4) {
dispatch(
updateTokens({ type: TokenTypes.NDC_Champion, value: token })
);
}
}
}
} catch (error) {
Expand Down
20 changes: 19 additions & 1 deletion src/redux/reducer/sbtsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const sbtReducer = createSlice({
continueLoop: false, // for transfer and burn
isUserHuman: false, // true if user has any SBT Token
kudosToken: null,
ndcContributor: null,
ndcChampion: null,
gwgCoreContributor: null,
},
reducers: {
updateTokens: (state, action) => {
Expand All @@ -78,6 +81,15 @@ export const sbtReducer = createSlice({
case TokenTypes.KUDOS:
state.kudosToken = value;
break;
case TokenTypes.GWG__Core_Contributor:
state.gwgCoreContributor = value;
break;
case TokenTypes.NDC_Champion:
state.ndcChampion = value;
break;
case TokenTypes.NDC_Contributor:
state.ndcContributor = value;
break;
default:
break;
}
Expand All @@ -87,7 +99,10 @@ export const sbtReducer = createSlice({
state.ogToken ||
state.vibeToken ||
state.regenToken ||
state.kudosToken;
state.kudosToken ||
state.ndcChampion ||
state.ndcContributor ||
state.gwgCoreContributor;
},
handleErrorMessage: (state, action) => {
state.error = action.payload;
Expand All @@ -100,6 +115,9 @@ export const sbtReducer = createSlice({
state.vibeToken = null;
state.regenToken = null;
state.kudosToken = null;
state.gwgCoreContributor = null;
state.ndcChampion = null;
state.ndcContributor = null;
},
updateTokenRemoveStatus: (state, action) => {
state.tokenRemoveSuccess = !state.tokenRemoveSuccess;
Expand Down
3 changes: 3 additions & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const TokenTypes = {
VIBE: 'Vibe',
REGEN: 'Regen',
KUDOS: 'Kudos',
NDC_Champion: 'NDC Champion',
NDC_Contributor: 'NDC Contributor',
GWG__Core_Contributor: 'GWG Core Contributor',
};

export const ReducerNames = {
Expand Down

0 comments on commit e39f63b

Please sign in to comment.