diff --git a/src/context/AppContext.js b/src/context/AppContext.js index c424d32..007b711 100644 --- a/src/context/AppContext.js +++ b/src/context/AppContext.js @@ -10,6 +10,7 @@ const events = new EventManager(); const defaultContext = { walletAddress: undefined, deployer : false, + isGateWay: false, walletError: undefined, identity: undefined, profile: undefined, @@ -32,7 +33,7 @@ export const ProvideAppContext = ({ childrenĀ }) => { const [, setLocation] = useLocation(); const [profile, setUserProfile] = useState(); const [deployer, setDeployer] = useState(false); - const [processing, setProcessing] = useState(false); + const [processing, setProcessing] = useState(point.isGateway() || false); useEffect(() => { (async () => { @@ -70,6 +71,7 @@ export const ProvideAppContext = ({ childrenĀ }) => { const context = { walletAddress, deployer, + isGateway : point.isGateway(), walletError, identity, profile, diff --git a/src/pages/home/Home.jsx b/src/pages/home/Home.jsx index e108102..4958b12 100644 --- a/src/pages/home/Home.jsx +++ b/src/pages/home/Home.jsx @@ -6,8 +6,10 @@ import { useAppContext } from '../../context/AppContext'; import { makeStyles } from '@material-ui/core/styles'; import { Backdrop, + Button, CircularProgress, Snackbar, + SnackbarContent, Container } from '@material-ui/core'; @@ -41,7 +43,7 @@ const useStyles = makeStyles((theme) => ({ const Home = () => { const [loading, setLoading] = useState(false); const [alert, setAlert] = useState(""); - const { walletAddress } = useAppContext(); + const { walletAddress, isGateway } = useAppContext(); const styles = useStyles(); @@ -54,6 +56,16 @@ const Home = () => { return (
+ { + !loading && + + Download + }/> + + } { walletAddress? diff --git a/src/pages/post/Post.jsx b/src/pages/post/Post.jsx index 31cdaad..0421c86 100644 --- a/src/pages/post/Post.jsx +++ b/src/pages/post/Post.jsx @@ -8,7 +8,10 @@ import PostManager from '../../services/PostManager'; import CircularProgress from '@material-ui/core/CircularProgress'; import Backdrop from '@material-ui/core/Backdrop'; +import Button from '@material-ui/core/Button'; import Snackbar from '@material-ui/core/Snackbar'; +import SnackbarContent from '@material-ui/core/SnackbarContent'; + import MuiAlert from '@material-ui/lab/Alert'; import CircularProgressWithIcon from "../../components/generic/CircularProgressWithIcon"; @@ -46,7 +49,7 @@ const Post = () => { const [alert, setAlert] = useState(""); const [post, setPost] = useState(); - const { walletAddress, events } = useAppContext(); + const { walletAddress, isGateway, events } = useAppContext(); const styles = useStyles(); @@ -143,6 +146,16 @@ const Post = () => { return (
{ walletAddress && } + { + !loading && + + Download + }/> + + } { walletAddress? diff --git a/src/pages/profile/Profile.jsx b/src/pages/profile/Profile.jsx index d790e44..0891f6b 100644 --- a/src/pages/profile/Profile.jsx +++ b/src/pages/profile/Profile.jsx @@ -8,7 +8,10 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import CircularProgressWithIcon from "../../components/generic/CircularProgressWithIcon"; import Backdrop from '@material-ui/core/Backdrop'; +import Button from '@material-ui/core/Button'; import Snackbar from '@material-ui/core/Snackbar'; +import SnackbarContent from '@material-ui/core/SnackbarContent'; + import MuiAlert from '@material-ui/lab/Alert'; import Box from '@material-ui/core/Box'; @@ -41,7 +44,7 @@ const Profile = () => { const [identity, setIdentity] = useState(undefined); const [address, setAddress] = useState(undefined); - const { walletAddress } = useAppContext(); + const { walletAddress, isGateway } = useAppContext(); const styles = useStyles(); @@ -98,6 +101,16 @@ const Profile = () => { } props={{color : "inherit"}} /> } + { + !loading && + + Download + }/> + + } {walletAddress && <> { (address && identity)? <> diff --git a/src/services/PointSDK.js b/src/services/PointSDK.js index 1695645..ae77981 100644 --- a/src/services/PointSDK.js +++ b/src/services/PointSDK.js @@ -46,6 +46,11 @@ class PointSDK { return data; } + static isGateway() { + const point = PointSDK._getPoint(); + return point.isGateway; + } + /************** WALLET FUNCTIONS **************/ static getWalletAddress = async () => PointSDK._callSDKFunction('wallet', 'address'); // OK