Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.2.0 #161

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,54 @@
"private": true,
"main": "src/index.js",
"dependencies": {
"@headlessui/react": "^1.7.10",
"@heroicons/react": "^2.0.15",
"@near-wallet-selector/core": "^8.1.4",
"@near-wallet-selector/here-wallet": "^8.1.4",
"@near-wallet-selector/ledger": "^8.1.4",
"@near-wallet-selector/math-wallet": "^8.1.4",
"@near-wallet-selector/meteor-wallet": "^8.1.4",
"@near-wallet-selector/modal-ui": "^8.1.4",
"@near-wallet-selector/my-near-wallet": "^8.1.4",
"@near-wallet-selector/near-wallet": "^8.1.4",
"@near-wallet-selector/nightly": "^8.1.4",
"@near-wallet-selector/nightly-connect": "^8.1.4",
"@near-wallet-selector/sender": "^8.1.4",
"@near-wallet-selector/wallet-connect": "^8.1.4",
"@headlessui/react": "^1.7.16",
"@heroicons/react": "^2.0.18",
"@near-wallet-selector/core": "^8.2.1",
"@near-wallet-selector/here-wallet": "^8.2.1",
"@near-wallet-selector/ledger": "^8.2.1",
"@near-wallet-selector/math-wallet": "^8.2.1",
"@near-wallet-selector/meteor-wallet": "^8.2.1",
"@near-wallet-selector/modal-ui": "^8.2.1",
"@near-wallet-selector/my-near-wallet": "^8.2.1",
"@near-wallet-selector/near-wallet": "^8.2.1",
"@near-wallet-selector/nightly": "^8.2.1",
"@near-wallet-selector/nightly-connect": "^8.2.1",
"@near-wallet-selector/sender": "^8.2.1",
"@near-wallet-selector/wallet-connect": "^8.2.1",
"@reduxjs/toolkit": "^1.9.5",
"@rollbar/react": "^0.11.1",
"@supabase/supabase-js": "^2.7.0",
"@testing-library/jest-dom": "^5.16.2",
"@rollbar/react": "^0.11.2",
"@supabase/supabase-js": "^2.31.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^13.5.0",
"@usedapp/core": "^1.2.2",
"@web3-onboard/coinbase": "^2.2.0",
"@web3-onboard/injected-wallets": "^2.6.2",
"@web3-onboard/react": "^2.6.1",
"@web3-onboard/walletconnect": "^2.2.2",
"axios": "^1.3.4",
"ethers": "^5.6.4",
"@testing-library/user-event": "^14.4.3",
"@usedapp/core": "^1.2.10",
"@web3-onboard/coinbase": "^2.2.5",
"@web3-onboard/injected-wallets": "^2.10.3",
"@web3-onboard/react": "^2.8.10",
"@web3-onboard/walletconnect": "^2.4.3",
"axios": "^1.4.0",
"ethers": "^6.6.7",
"jsonp": "^0.2.1",
"moment": "^2.29.4",
"near-api-js": "^2.0.4",
"react": "^18.1.0",
"near-api-js": "^2.1.4",
"react": "^18.2.0",
"react-confetti": "^6.1.0",
"react-dom": "^18.1.0",
"react-dom": "^18.2.0",
"react-ga": "^3.3.1",
"react-google-recaptcha-v3": "^1.10.1",
"react-native": "^0.71.0",
"react-native-web": "^0.18.10",
"react-redux": "^8.0.7",
"react-native": "^0.72.3",
"react-native-web": "^0.19.7",
"react-redux": "^8.1.2",
"react-router-dom": "^6.14.2",
"react-scripts": "5.0.0",
"react-scripts": "5.0.1",
"react-spinners-kit": "^1.9.1",
"react-toastify": "^9.1.1",
"recharts": "^2.6.2",
"regenerator-runtime": "^0.13.9",
"rollbar": "^2.26.1",
"styled-components": "^5.3.9",
"web-vitals": "^2.1.4",
"yup": "^0.32.11"
"react-toastify": "^9.1.3",
"recharts": "^2.7.2",
"regenerator-runtime": "^0.13.11",
"rollbar": "^2.26.2",
"styled-components": "^6.0.5",
"web-vitals": "^3.4.0",
"yup": "^1.2.0"
},
"scripts": {
"start": "react-app-rewired start",
Expand Down Expand Up @@ -80,29 +80,29 @@
]
},
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"assert": "^2.0.0",
"babel-jest": "^29.5.0",
"babel-jest": "^29.6.2",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"https-browserify": "^1.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"os-browserify": "^0.3.0",
"prettier": "^2.8.7",
"prettier": "^3.0.0",
"process": "^0.11.10",
"react-app-rewired": "^2.2.1",
"react-test-renderer": "^18.2.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.0"
"url": "^0.11.1"
},
"peerDependencies": {
"ethers": "5.*"
Expand Down
17 changes: 16 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'regenerator-runtime/runtime';
import React from 'react';
import React, { useEffect } from 'react';
import { ToastContainer } from 'react-toastify';

Check warning on line 3 in src/App.js

View workflow job for this annotation

GitHub Actions / Lint and Format code

'ToastContainer' is defined but never used. Allowed unused vars must match /_/u

Check warning on line 3 in src/App.js

View workflow job for this annotation

GitHub Actions / Lint and Format code

'ToastContainer' is defined but never used. Allowed unused vars must match /_/u
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import IndexPage from './pages/index';
import ScoreboardPage from './pages/Scoreboard';
Expand All @@ -10,6 +10,9 @@
import CustomHeader from './components/common/Header';
import CustomFooter from './components/common/Footer';
import ActivatePage from './pages/Activate';
import { wallet } from '.';
import { useDispatch } from 'react-redux';
import { updateUserLogin } from './redux/reducer/commonReducer';

const Wrapper = ({ children }) => {
return (
Expand All @@ -23,6 +26,18 @@
};

export function App() {
const dispatch = useDispatch();
useEffect(() => {
wallet
.startUp()
.then((value) => {
dispatch(updateUserLogin(value));
})
.catch(() => {
dispatch(updateUserLogin(false));
});
});

return (
<>
<Router>
Expand Down
31 changes: 16 additions & 15 deletions src/components/common/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';

Check warning on line 1 in src/components/common/Header.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

'useEffect' is defined but never used. Allowed unused vars must match /_/u

Check warning on line 1 in src/components/common/Header.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

'useEffect' is defined but never used. Allowed unused vars must match /_/u
import { Dialog } from '@headlessui/react';
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';
import { CheckCircleIcon } from '@heroicons/react/24/solid';
Expand All @@ -25,32 +25,33 @@
const { isUserLogin, isAdmin, activePageIndex } = useSelector(
(state) => state[ReducerNames.COMMON]
);
const [admin] = useAdmin();

Check warning on line 28 in src/components/common/Header.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

'admin' is assigned a value but never used. Allowed unused vars must match /_/u

Check warning on line 28 in src/components/common/Header.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

'admin' is assigned a value but never used. Allowed unused vars must match /_/u

useEffect(() => {
wallet
.startUp()
.then((value) => {
dispatch(updateUserLogin(value));
})
.catch(() => {
dispatch(updateUserLogin(false));
});
});

const signOut = () => {
if (isUserLogin) {
wallet.signOut();
dispatch(removeAllTokens());
} else {
wallet.signIn();
wallet
.signIn()
.then((value) => {
dispatch(updateUserLogin(value));
})
.catch(() => {
dispatch(updateUserLogin(false));
});
}
};

const HomeMenu = ({ isDialog = false }) => {
const isActive = (currentPage) =>
window.location.href.indexOf(currentPage) !== -1 ? 'text-gradient' : '';

const commonFuction = () => {
window.scrollTo(0, 0);
setMobileMenuOpen(false);
};

return (
<div
className={
Expand All @@ -64,7 +65,7 @@
onClick={() => {
dispatch(setActivePageIndex(null));
navigate('/');
setMobileMenuOpen(false);
commonFuction();
}}
className={
!isActive(URLs.SCOREBOARD) &&
Expand All @@ -80,7 +81,7 @@
<div
onClick={() => {
navigate(URLs.SBTs);
setMobileMenuOpen(false);
commonFuction();
}}
className={isActive(URLs.SBTs)}
>
Expand All @@ -89,7 +90,7 @@
<div
onClick={() => {
navigate(URLs.ACTIVATE);
setMobileMenuOpen(false);
commonFuction();
}}
className={isActive(URLs.ACTIVATE)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ProgressTracker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

const getRegisteredPercentage = useCallback(
() => (humansRegistered / ProgressMeterMax) * 100,
[humansRegistered]

Check warning on line 38 in src/components/common/ProgressTracker.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

React Hook useCallback has a missing dependency: 'ProgressMeterMax'. Either include it or remove the dependency array

Check warning on line 38 in src/components/common/ProgressTracker.jsx

View workflow job for this annotation

GitHub Actions / Lint and Format code

React Hook useCallback has a missing dependency: 'ProgressMeterMax'. Either include it or remove the dependency array
);

// to make sure the the right corner is not clipped much with increasing width
Expand Down Expand Up @@ -81,7 +81,7 @@
{ReadableNumber} Humans on NEAR
</p>
<button
className="bg-yellow-300 rounded-2xl py-1.5 px-2 text-sm"
className="bg-yellow-300 rounded-lg py-1.5 px-2 text-sm"
onClick={() =>
window.open(
'https://pages.near.org/blog/ndc-v1-governance-elections-faq/',
Expand Down
Binary file modified src/images/CommunityFund.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const root = ReactDOM.createRoot(document.getElementById('root'));

// Setup on page load
window.onload = async () => {
const isSignedIn = await wallet.startUp();

root.render(
<RollbarProvider config={rollbarConfig}>
<ErrorBoundary
Expand All @@ -36,11 +34,7 @@ window.onload = async () => {
}
>
<ReduxProvider store={store}>
<App
isSignedIn={isSignedIn}
contractId={CONTRACT_ADDRESS}
wallet={wallet}
/>
<App />
</ReduxProvider>
</ErrorBoundary>
</RollbarProvider>
Expand Down
1 change: 0 additions & 1 deletion src/pages/Scoreboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const ScoreboardPage = () => {
}, []);

React.useEffect(() => {
window.scrollTo(0, 0);
fetchCommunities();
}, [fetchCommunities]);

Expand Down
6 changes: 2 additions & 4 deletions src/pages/auth/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import TokensGrid from '../../components/common/TokensGrid';
import { setActivePageIndex } from '../../redux/reducer/commonReducer';

const Home = () => {
const { fvToken, kycToken, ogToken, regenToken, vibeToken } = useSelector(
(state) => state[ReducerNames.SBT]
);
const { isUserHuman } = useSelector((state) => state[ReducerNames.SBT]);
const { activePageIndex } = useSelector(
(state) => state[ReducerNames.COMMON]
);
Expand Down Expand Up @@ -143,7 +141,7 @@ const Home = () => {
My I-AM-HUMAN Soul Bound Tokens
</h1>
<div className="flex flex-col gap-32">
{!fvToken && !kycToken && !ogToken && !regenToken && !vibeToken ? (
{!isUserHuman ? (
<div>
<div
style={{ backgroundImage: `url(${BgImage})` }}
Expand Down
20 changes: 14 additions & 6 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { updateTrackerStatus } from '../redux/reducer/tracker';
const URL = window.location;

const IndexPage = () => {
const { fvToken, kycToken, ogToken } = useSelector(
const { fvToken, ogToken, isUserHuman } = useSelector(
(state) => state[ReducerNames.SBT]
);
const { isUserLogin, isAdmin, activePageIndex } = useSelector(
Expand Down Expand Up @@ -249,7 +249,7 @@ const IndexPage = () => {
{typeof activePageIndex !== 'number' ? (
<>
<div className="flex flex-col gap-y-16 md:gap-y-32">
<div className="flex flex-wrap gap-10">
<div className="flex flex-wrap">
<div className="flex-1 min-w-[300px]">
<h1 className="font-bold text-5xl">
Get your Proof of Personhood with
Expand Down Expand Up @@ -290,29 +290,37 @@ const IndexPage = () => {
})}
</div>
</div>
<div className="flex md:justify-start flex-wrap gap-x-10 gap-y-5">
<div className="flex md:justify-start flex-wrap gap-x-5 gap-y-5">
{/* show get started only if no tokens are minted by user */}
{!kycToken && !fvToken && !ogToken && (
{!isUserHuman && (
<button
onClick={() => getStarted()}
className="rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-5 md:px-10 py-3 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700"
>
Get Started
</button>
)}
{(kycToken || fvToken || ogToken) && (
{isUserHuman && (
<button
onClick={() =>
window.open(
'https://t.me/+fcNhYGxK891lMjMx',
'_blank'
)
}
className="rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-5 md:px-10 py-3 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700"
className="rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-4 py-3 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700"
>
Join the NDC Community
</button>
)}
{isUserHuman && !fvToken && (
<button
onClick={() => dispatch(setActivePageIndex(1))}
className="rounded-md border border-transparent bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-4 py-3 text-base font-medium text-white shadow-sm hover:from-purple-700 hover:to-indigo-700"
>
Get Your FV Token
</button>
)}
<button
onClick={() =>
window.open(
Expand Down
7 changes: 7 additions & 0 deletions src/redux/reducer/sbtsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const sbtReducer = createSlice({
error: null,
tokenRemoveSuccess: false,
continueLoop: false, // for transfer and burn
isUserHuman: false, // true if user has any SBT Token
},
reducers: {
updateTokens: (state, action) => {
Expand All @@ -76,6 +77,12 @@ export const sbtReducer = createSlice({
default:
break;
}
state.isUserHuman =
state.fvToken ||
state.kycToken ||
state.ogToken ||
state.vibeToken ||
state.regenToken;
},
handleErrorMessage: (state, action) => {
state.error = action.payload;
Expand Down
Loading
Loading