-
Notifications
You must be signed in to change notification settings - Fork 80
[WIP] Signal Scheme Alchemy Integration #1504
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
Closed
Closed
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
968d7f6
Merge pull request #1468 from daostack/dev
jellegerbrandy c2af3da
Merge branch 'master' into release_20200303
dkent600 3019382
Merge pull request #1475 from daostack/release_20200303
dkent600 2a8580d
migrating latest signal features commits
mrrobot16 e44df7e
Added DAO Header component in this branch
mrrobot16 8436d1f
Getting signal data and displaying it in the UI
mrrobot16 ee3ac8a
add action to save ipfs data
shekhar-shubhendu 774ed7c
update signal scheme url
shekhar-shubhendu 12c1b58
update Signals.json
shekhar-shubhendu 867e99e
update logic to save/update/delete signals data
shekhar-shubhendu f67a8c8
linting and small fixes. remove hardcoded address
shekhar-shubhendu 25a18c5
in history, open proposal in new tab on ctrl-click (#1474)
dkent600 243108e
show DAO total rep in sidebar (#1473)
dkent600 59cef63
In create proposal form tab directly from title to description
tibetsprague 8984873
Lint fix
tibetsprague 805a2b3
Require NETWORK env var on Heroku and default to rinkeby
tibetsprague 67bed9a
Close modals by pressing ESC
tibetsprague dd12533
Fix styling of submit button on profile page when submitting
tibetsprague ad3e324
Make sure tooltip on redemptions button doesn't cover the button
tibetsprague dc8e759
Create ModalPopup component to bundle common modal stuff
tibetsprague e57fb22
Fix paths
tibetsprague 09c5527
Enforce required permissions when adding/editing known Schemes
tibetsprague 9d7afae
migrating latest signal features commits
mrrobot16 10c3f3c
Added DAO Header component in this branch
mrrobot16 49ec178
Getting signal data and displaying it in the UI
mrrobot16 a3c0ba7
add action to save ipfs data
shekhar-shubhendu 77cf7df
update signal scheme url
shekhar-shubhendu 26617c9
update Signals.json
shekhar-shubhendu 23a99a7
update logic to save/update/delete signals data
shekhar-shubhendu 1c955f3
linting and small fixes. remove hardcoded address
shekhar-shubhendu 5249869
fix css
shekhar-shubhendu 50476e0
update css, use var in tsx instead
shekhar-shubhendu 400590b
Merge branch 'dev' into feat/signal-scheme
mrrobot16 6e9a3e9
eslint fixes
mrrobot16 8b511b7
Added responsive to this branch
mrrobot16 6f618ac
Latest responsive code
mrrobot16 f13ca00
Added dynamic holdings
mrrobot16 a65f320
deleted unneeded css code
mrrobot16 33bb933
Background image fix -back in history
mrrobot16 0f73aaf
Background image fix -back in history
mrrobot16 33869a8
Merge branch 'feat/signal-scheme' of https://github.com/apeunit/alche…
mrrobot16 6727857
Revert "Background image fix -back in history"
mrrobot16 8763f66
eslint fixes
mrrobot16 88645d8
Added subgraph endpoints json
mrrobot16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
.headerWrap { | ||
background: white; | ||
margin: 8rem 2.5% 0 0; | ||
padding: 25px; | ||
padding-top: 94px; | ||
position: relative; | ||
border-radius: 20px 20px 0 0; | ||
z-index: 9999999999; | ||
} | ||
|
||
.reputationHolders { | ||
display: block; | ||
position: absolute; | ||
font-size: 10px; | ||
font-weight: normal; | ||
color: $gray-1; | ||
white-space: nowrap; | ||
} | ||
|
||
.daoName { | ||
font-size: 24px; | ||
color: #689bd6; | ||
} | ||
|
||
.daoInfo { | ||
margin-left: 100px; | ||
top: 15px; | ||
position: absolute; | ||
} | ||
|
||
.daoDescription { | ||
font-family: $body-font; | ||
color: $black; | ||
font-weight: 500; | ||
font-size: 13px; | ||
width: 75%; | ||
} | ||
|
||
.circularSquare { | ||
border-radius: 50%; | ||
border-color: white; | ||
border-style: solid | ||
} | ||
|
||
.daoImg { | ||
top: -40px !important; | ||
left: 5px !important; | ||
position: absolute; | ||
} | ||
|
||
.daoHeadingGroup { | ||
.header { | ||
margin: unset; | ||
} | ||
p { | ||
margin-top: unset; | ||
} | ||
} | ||
|
||
|
||
.holdings { | ||
padding: 15px; | ||
border: 1px solid #dbd7d7; | ||
border-radius: 7px; | ||
float: right; | ||
position: relative; | ||
top: -75px; | ||
} | ||
|
||
.holdings .holdingsAmount { | ||
margin-top: 5px; | ||
color: #565a5d; | ||
font-size: 12px | ||
} | ||
|
||
.holdings .holdingsAmount .holdingsName { | ||
float: right; | ||
margin-left: 25px; | ||
} | ||
|
||
.holdingsNumber { | ||
margin-right: 10px; | ||
} | ||
|
||
.holdingsList { | ||
list-style: none; | ||
padding-inline-start: 0px; | ||
} | ||
|
||
@media only screen and (max-width: 650px) { | ||
.daoImg { | ||
top: -75px; | ||
left: 75px; | ||
position: absolute; | ||
} | ||
} | ||
|
||
@media only screen and (max-width: 768px) { | ||
.holdings { | ||
top: unset; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import * as React from "react"; | ||
import { IDAOState, Scheme, Token } from "@daostack/client"; | ||
import { getArc } from "arc"; | ||
import { first } from "rxjs/operators"; | ||
|
||
import { formatTokens, supportedTokens, fromWei, baseTokenName, ethErrorHandler, genName } from "lib/util"; | ||
import withSubscription, { ISubscriptionProps } from "components/Shared/withSubscription"; | ||
import AccountImage from "components/Account/AccountImage"; | ||
|
||
import BN = require("bn.js"); | ||
import * as css from "./DaoHeader.scss"; | ||
|
||
const styles = { | ||
circularSquare: { | ||
borderRadius: "50%", | ||
borderColor: "white", | ||
borderStyle: "solid", | ||
}, | ||
}; | ||
|
||
interface ISignal { | ||
id: string; | ||
data: any | string; | ||
} | ||
|
||
interface IExternalProps { | ||
daoState: IDAOState | any; | ||
signal?: ISignal | any; | ||
} | ||
|
||
type IProps = IExternalProps & ISubscriptionProps<[Scheme[], ISignal, IDAOState | any]>; | ||
|
||
class DaoHeaderComponent extends React.Component<IProps, any> { | ||
|
||
render() { | ||
const { daoState, signal } = this.props; | ||
const { name, memberCount, address, reputationTotalSupply } = daoState; | ||
const data = { | ||
daoImg: "/assets/images/generic-user-avatar.png", | ||
reputationHolders: memberCount, | ||
description: ` | ||
${name} is an independent, global community of people working together to build and promote Decentralized Autonomous Organizations (DAOs). | ||
It’s the perfect place to get involved with DAOstack. | ||
`, | ||
}; | ||
|
||
const SupportedTokens = (): any => { | ||
const tokensSupported = (tokenAddress: any) => { | ||
return <SubscribedTokenBalance tokenAddress={tokenAddress} dao={daoState} key={"token_" + tokenAddress} />; | ||
}; | ||
return Object.keys(supportedTokens()).map(tokensSupported); | ||
}; | ||
|
||
const REP = fromWei(reputationTotalSupply).toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 2 }); | ||
|
||
return ( | ||
<div className={css.headerWrap}> | ||
<div className={css.daoImg}> | ||
{/* Logo will go here instead of AccountImage this is just a placeholder */} | ||
<AccountImage | ||
accountAddress={address} | ||
width={106} | ||
style={styles.circularSquare} | ||
/> | ||
</div> | ||
<div className={css.daoInfo}> | ||
<b className={css.daoName}> | ||
{ signal.name ? signal.name : name } | ||
</b> | ||
<b className={css.reputationHolders}> | ||
{ data.reputationHolders } Reputation Holders | ||
</b> | ||
</div> | ||
|
||
<div className={css.holdings}> | ||
<span>Holdings</span> | ||
<ul className={css.holdingsList}> | ||
<li className={css.holdingsAmount}> | ||
<span>{ REP } REP</span> | ||
</li> | ||
<SubscribedEthBalance dao={daoState} /> | ||
<SupportedTokens /> | ||
</ul> | ||
</div> | ||
|
||
<div className={css.daoHeadingGroup}> | ||
<div className="header"> | ||
This is the { name } Header | ||
</div> | ||
<p className={css.daoDescription}> | ||
{ data.description } | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
/***** DAO ETH Balance *****/ | ||
interface IEthProps extends ISubscriptionProps<BN|null> { | ||
dao: IDAOState; | ||
} | ||
|
||
const ETHBalance = (props: IEthProps) => { | ||
const { data } = props; | ||
return <li key="ETH" className={css.holdingsAmount}><span>{formatTokens(data)} {baseTokenName()}</span></li>; | ||
}; | ||
|
||
const SubscribedEthBalance = withSubscription({ | ||
wrappedComponent: ETHBalance, | ||
loadingComponent: <li key="ETH">... {baseTokenName()}</li>, | ||
errorComponent: null, | ||
checkForUpdate: (oldProps: IEthProps, newProps: IEthProps) => { | ||
return oldProps.dao.address !== newProps.dao.address; | ||
}, | ||
createObservable: (props: IEthProps) => { | ||
const arc = getArc(); | ||
return arc.dao(props.dao.address).ethBalance().pipe(ethErrorHandler()); | ||
}, | ||
}); | ||
|
||
/***** Token Balance *****/ | ||
interface ITokenProps extends ISubscriptionProps<any> { | ||
dao: IDAOState; | ||
tokenAddress: string; | ||
} | ||
|
||
const TokenBalance = (props: ITokenProps) => { | ||
const { data, error, isLoading, tokenAddress } = props; | ||
|
||
const tokenData = supportedTokens()[tokenAddress]; | ||
if (isLoading || error || ((data === null || isNaN(data) || data.isZero()) && tokenData.symbol !== genName())) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<li key={tokenAddress} className={css.holdingsAmount}> | ||
<span>{formatTokens(data, tokenData["symbol"], tokenData["decimals"])}</span> | ||
</li> | ||
); | ||
}; | ||
|
||
const SubscribedTokenBalance = withSubscription({ | ||
wrappedComponent: TokenBalance, | ||
checkForUpdate: (oldProps: ITokenProps, newProps: ITokenProps) => { | ||
return oldProps.dao.address !== newProps.dao.address || oldProps.tokenAddress !== newProps.tokenAddress; | ||
}, | ||
createObservable: async (props: ITokenProps) => { | ||
// General cache priming for the DAO we do here | ||
// prime the cache: get all members fo this DAO - | ||
const daoState = props.dao; | ||
|
||
await daoState.dao.members({ first: 1000, skip: 0 }).pipe(first()).toPromise(); | ||
|
||
const arc = getArc(); | ||
const token = new Token(props.tokenAddress, arc); | ||
return token.balanceOf(daoState.address).pipe(ethErrorHandler()); | ||
}, | ||
}); | ||
|
||
const DaoHeader = withSubscription({ | ||
wrappedComponent: DaoHeaderComponent, | ||
checkForUpdate: [], | ||
createObservable: (props: IExternalProps) => { | ||
const dao = props.daoState.dao; | ||
return dao.schemes({}, { fetchAllData: true, subscribe: true }); | ||
mrrobot16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}); | ||
|
||
export default DaoHeader; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.