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

Fixed UI + Route #759

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
42 changes: 31 additions & 11 deletions dapp/assets/images/fuse_logo_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions dapp/src/actions/owner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createRequestTypes, requestAction } from './utils'

export const OWNERSHIP = createRequestTypes('OWNERSHIP')
export const isOwner = (accountAddress, communityAddress) => requestAction(OWNERSHIP, { accountAddress, communityAddress })
export const setDefault = () => requestAction('DEFAULT')
2 changes: 1 addition & 1 deletion dapp/src/components/common/NavBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const NavBar = ({
<div style={{ minWidth: '130px' }} className={classNames('drop', { 'drop--show': isHelpOpen })}>
<ul className='drop__options'>
<li className='drop__options__item'><a href='https://fuse.io' target='_blank' rel='noopener noreferrer'>Website</a></li>
<li className='drop__options__item'><a href='https://docs.fuse.io/the-fuse-studio/faq' target='_blank' rel='noopener noreferrer'>FAQ</a></li>
<li className='drop__options__item'><a href='https://docs.fuse.io/consumer-tutorials/getting-started' target='_blank' rel='noopener noreferrer'>FAQ</a></li>
<li className='drop__options__item'><a href='https://github.com/fuseio' target='_blank'>Github</a></li>
<li className='drop__options__item'><a href='mailto:[email protected]'>Contact us</a></li>
</ul>
Expand Down
35 changes: 26 additions & 9 deletions dapp/src/components/common/ProfileDropDown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ProfileDropDown = ({
}
} else {
const desired = networkType === 'ropsten' ? 'main' : 'ropsten'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove desired if it's not used

loadSwitchModal(desired)
loadSwitchModal('fuse')
}
} else if (providerInfo.type === 'web') {
if (foreignNetwork) {
Expand Down Expand Up @@ -94,16 +94,33 @@ const ProfileDropDown = ({
</CopyToClipboard>
</div>
<div className='cell small-24 profile__account__disconnect grid-x align-middle align-center'>
<span>Connected to {providerInfo.check && providerInfo.check.substring && providerInfo.check.substring(2)}&nbsp;</span>
<span onClick={disconnectWallet} className='disconnect'>(Disconnect)</span>
<span>Connected to
{providerInfo.check &&
providerInfo.check.substring &&
providerInfo.check.substring(2)}
&nbsp;
</span>
<span onClick={disconnectWallet} className="disconnect">
Disconnect
</span>
</div>
</div>
<div className='profile__communities grid-y'>
<p className='profile__switch' onClick={switchNetwork}>
<FontAwesome name='exchange-alt' />
<span>Switch to {capitalize(convertNetworkName((foreignNetwork === networkType ? 'fuse' : foreignNetwork) || (networkType === 'ropsten' ? 'main' : 'ropsten')))} network</span>
</p>
</div>
{networkType === "fuse" ? ("") : (
<div className="profile__communities grid-y">
<p className="profile__switch" onClick={switchNetwork}>
<FontAwesome name="exchange-alt" />
<span>
Switch to{" "}
{capitalize(
convertNetworkName(
foreignNetwork === networkType ? "fuse" : "fuse"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant

)
)}{" "}
network
</span>
</p>
</div>
)}
<NativeBalance />
</div>
)
Expand Down
1 change: 0 additions & 1 deletion dapp/src/components/common/modals/LoginModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default ({ hideModal, handleConnect }) => {
render={renderButton}
onSuccess={handleLogin}
cookiePolicy='single_host_origin'
isSignedIn
/>
</Modal>
)
Expand Down
23 changes: 23 additions & 0 deletions dapp/src/components/dashboard/modals/SwitchAccountModal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import React from "react";
import Modal from "components/common/Modal";

const SwitchAccountsModal = ({ communityCreator, hideModal, hasCloseBtn = true }) => {
<Modal
className="generic-modal"
onClose={hideModal}
hasCloseBtn={hasCloseBtn}
>
<div className="generic-modal__container">
<div className="generic-modal__title">You are on wrong Metamask account</div>
<div className="generic-modal__text">
Can't perform an economy action! Please switch your Metamask account to: <b>{communityCreator}</b>
</div>
<button className="generic-modal__button" onClick={hideModal}>
Close
</button>
</div>
</Modal>;
};

export default SwitchAccountsModal;
28 changes: 26 additions & 2 deletions dapp/src/components/dashboard/pages/Plugins/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import FiatOnRamp from 'images/fiat-on-ramp.png'
import FiatOnRampBig from 'images/fiat-on-ramp-big.png'
import WalletBannerLink from 'images/wallet_banner_link.png'
import WalletBannerLinkBig from 'images/wallet_banner_link_big.png'
import { useEffect } from 'react'
import { setDefault, isOwner } from 'actions/owner'

const generalPlugins = ([
{
Expand Down Expand Up @@ -98,8 +100,13 @@ const PluginList = ({ pluginList, pluginTile, plugins, showInfoModal, addPlugin,
const Plugins = ({
loadModal,
addCommunityPlugin,
community
community,
address,
isAdmin,
isOwner,
communityCreator
}) => {
const dispatch = useDispatch()
const { address: communityAddress } = useParams()
const { plugins } = community
const showInfoModal = (key, props) => {
Expand Down Expand Up @@ -140,6 +147,18 @@ const Plugins = ({
return plugin
}

useEffect(()=>{
dispatch(isOwner(communityAddress, address))
if(isOwner && !isAdmin){
loadModal(SWITCH_ACCOUNT_MODAL), {
...props,
}
}
return () =>{
dispatch(setDefault)
}
}, [dispatch])

return (
community ? <div className='plugins'>
<h2 className='plugins__title'>Plugins</h2>
Expand All @@ -163,4 +182,9 @@ const mapDispatchToProps = {
addCommunityPlugin
}

export default connect(null, mapDispatchToProps)(Plugins)
const mapStateToProps = (state) => ({
address: getAccountAddress(state)

})

export default connect(mapStateToProps, mapDispatchToProps)(Plugins)
2 changes: 1 addition & 1 deletion dapp/src/components/home/components/Faq/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default () => {
<div className='faq__wrapper cell large-auto'>
<div className='grid-x align-justify align-middle faq__title'>
<h3 className='faq__title'>FAQ</h3>
<a href='https://docs.fuse.io/the-fuse-studio/faq' target='_blank' rel='noopener noreferrer' className='faq__action'>
<a href='https://docs.fuse.io/consumer-tutorials/getting-started' target='_blank' rel='noopener noreferrer' className='faq__action'>
Learn more&nbsp;<img src={arrow} alt='arrow' />
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/wizard/components/CurrencySymbol.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CurrencySymbol = () => {
minLength='2'
disabled={!communityType}
onChange={(event) => {
setFieldValue('communitySymbol', event.target.value)
setFieldValue('', event.target.value)
}}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/wizard/components/CurrencyType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const CustomToken = () => {
fetchCustomToken(e)
}}
type='text'
placeholder={`Enter ethereum token address`}
placeholder={`Enter a Fuse token address`}
classes={{
root: 'customToken__field'
}}
Expand Down
2 changes: 1 addition & 1 deletion dapp/src/components/wizard/container/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class Wizard extends React.Component {
<div className='issuance__wrapper'>
<div className='issuance__header grid-x align-justify'>
<div className='issuance__header__logo align-self-middle grid-x align-middle'>
<Logo showHomePage={() => push('/')} isGradientLogo />
<Logo showHomePage={() => push('/')} />
</div>
<div className='issuance__header__indicators grid-x cell align-center' ref={stepIndicator => (this.stepIndicator = stepIndicator)}>
<div className='grid-y cell auto'>
Expand Down
Loading