Skip to content

Commit

Permalink
Merge pull request #208 from near-ndc/develop
Browse files Browse the repository at this point in the history
Update footer (#207)
  • Loading branch information
Megha-Dev-19 authored Sep 6, 2023
2 parents 4e78b94 + 51c16e6 commit 39dc6de
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/components/common/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const navigation = [
name: 'I-AM-HUMAN Docs',
href: 'https://i-am-human.gitbook.io/i-am-human-docs/',
},
{
name: 'Product Feedback',
href: 'https://near-digital-collective.canny.io/bugs-and-feature-requests',
},
{
name: 'Bug Report',
href: 'https://github.com/near-ndc/i-am-human-dapp/issues',
},
{
name: 'Privacy Policy',
href: 'https://bafkreihetkp3rm5m2rbvfmadnsa3mzvcwcd3puvkabzli62y2gj5fearzy.ipfs.nftstorage.link/',
},
],
},
{
Expand Down
10 changes: 10 additions & 0 deletions src/components/common/TokensGrid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TokensGrid = () => {
ndcChampion,
gwgCoreContributor,
modToken,
iVotedToken,
} = useSelector((state) => state[ReducerNames.SBT]);

return (
Expand Down Expand Up @@ -108,6 +109,15 @@ const TokensGrid = () => {
<TokenDetails data={modToken} />
</Item>
)}
{iVotedToken && (
<Item imageSrc={ImageSrc.IVotedSBT}>
<ValidTokenComponent />
<h2 className="font-bold text-3xl my-1 mb-5">
My I Voted Soul Bound Token
</h2>
<TokenDetails data={iVotedToken} />
</Item>
)}
</div>
);
};
Expand Down
26 changes: 26 additions & 0 deletions src/pages/auth/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const Home = () => {
vibe_issuer_contract,
kudos_issuer_contract,
mods_issuer,
election_contract,
} = getConfig();
useEffect(() => {
// fetching only when logged in (without steps) state active
Expand All @@ -41,6 +42,7 @@ const Home = () => {
fetchVibeToken();
fetchKudosToken();
fetchModsToken();
fetchIVotedToken();
}
}, [activePageIndex]);

Expand Down Expand Up @@ -114,6 +116,30 @@ const Home = () => {
}
};

const fetchIVotedToken = async () => {
try {
const data = await wallet.viewMethod({
contractId: app_contract,
method: 'sbt_tokens_by_owner',
args: {
account: wallet.accountId,
issuer: election_contract,
},
});

if (data?.[0]?.[1]) {
for (const token of data[0][1]) {
// if class = 1 => I voted token
if (token.metadata.class === 1) {
dispatch(updateTokens({ type: TokenTypes.I_VOTED, value: token }));
}
}
}
} catch (error) {
toast.error('An error occured while fetching I Voted SBT details');
}
};

const fetchModsToken = async () => {
try {
const data = await wallet.viewMethod({
Expand Down
8 changes: 7 additions & 1 deletion src/redux/reducer/sbtsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const sbtReducer = createSlice({
ndcChampion: null,
gwgCoreContributor: null,
modToken: null,
iVotedToken: null,
},
reducers: {
updateTokens: (state, action) => {
Expand Down Expand Up @@ -94,6 +95,9 @@ export const sbtReducer = createSlice({
case TokenTypes.MOD:
state.modToken = value;
break;
case TokenTypes.I_VOTED:
state.iVotedToken = value;
break;
default:
break;
}
Expand All @@ -107,7 +111,8 @@ export const sbtReducer = createSlice({
state.ndcChampion ||
state.ndcContributor ||
state.gwgCoreContributor ||
state.modToken;
state.modToken ||
state.iVotedToken;
},
handleErrorMessage: (state, action) => {
state.error = action.payload;
Expand All @@ -124,6 +129,7 @@ export const sbtReducer = createSlice({
state.ndcChampion = null;
state.ndcContributor = null;
state.modToken = null;
state.iVotedToken = null;
},
updateTokenRemoveStatus: (state, action) => {
state.tokenRemoveSuccess = !state.tokenRemoveSuccess;
Expand Down
6 changes: 2 additions & 4 deletions src/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ export function getConfig() {
regen_issuer_contract: 'issuer.regens.near',
vibe_issuer_contract: 'issuer.proofofvibes.near',
mods_issuer: 'gwg.sputnik-dao.near',
election_contract: 'elections.ndc-gwg.near',
};
switch (environment) {
case 'prod':
return {
network_id: 'mainnet',
app_contract: 'registry.i-am-human.near',
og_contract: 'community.i-am-human.near',
// gooddollar_contract: 'gooddollar-v1.i-am-human.near',
// fractal_contract: 'fractal-1.i-am-human.testnet',
fractal_contract: 'fractal.i-am-human.near',
new_sbt_contract: 'sbt1.i-am-human.testnet',
api_link: 'https://api-ophc7vkxsq-uc.a.run.app',
Expand All @@ -29,9 +28,8 @@ export function getConfig() {
network_id: 'testnet',
app_contract: 'registry-1.i-am-human.testnet',
og_contract: 'community-v1.i-am-human.testnet',
// gooddollar_contract: 'gooddollar-v1.i-am-human.testnet',
// fractal_contract: 'fractal-1.i-am-human.testnet', // for DEV ENV
fractal_contract: 'i-am-human-staging.testnet', // REMOVE AFTER TESTING
fractal_contract: 'i-am-human-staging.testnet',
new_sbt_contract: 'sbt1.i-am-human.testnet',
api_link: 'https://dev-ophc7vkxsq-uc.a.run.app',
fractal_api: 'https://staging.justfortestinc.site',
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const TokenTypes = {
NDC_Contributor: 'NDC Contributor',
GWG__Core_Contributor: 'GWG Core Contributor',
MOD: 'Mod',
I_VOTED: 'I Voted',
};

export const ReducerNames = {
Expand Down

0 comments on commit 39dc6de

Please sign in to comment.