From caf5a4e24115f59953caf51d516c4c9bcf109031 Mon Sep 17 00:00:00 2001 From: zeke <30676292+ezekiiel@users.noreply.github.com> Date: Sat, 9 Apr 2022 12:02:33 -0700 Subject: [PATCH 1/4] Merge development into main! (#473) * Add utils package * newline at the end of tsconfig.json * remove debugging console.log * Crispier toasts (#442) * Increased duration toasts display on screen. * Display notifications above suspense loader. * Fixed vscode eslint fixing incorrect rules, and reformatted. * Display executed proposal TX hashes with link to Mintscan (#441) * Display executed proposal TX hash in sidebar. * Added link to executed proposal TX on mintscan. * Improved user messages about tx hash. * Made TX hash loadable in case the query takes some time. * Only add link to proposal tx hash if NEXT_PUBLIC_CHAIN_TXN_URL_PREFIX present. * Formatted. * Generalized copy to clipboard message. * Improve proposal template UX (#440) * Preview proposal message JSON when creating. Renamed messages to actions on proposal create page. * Recognize and display message templates on existing proposals. * Fixed spend cosmos msg detection. * Formatted. * PR fixes. * Fixed prettier lint error. * Update packages/utils/package.json Co-authored-by: Noah Saso * Add check for connected wallet (#452) * Show second by second countdown when unstaking. (#456) * Icons package (#428) * Init 'icons' package. * Add init assets to 'icons' package. * Use Wallet from @dao-dao/icons. * Added "Add Token" Button (#458) * Added "Add Token" Button * Use "addTokenCallback" in "StarButton" * Moved "Add Token" inside "DaoTreasury" * Fix formatting issue in Button.tsx. (#461) * Disable check for staked balance at proposal creation time. (#464) Currently there is an issue with querying past chain state from before the chain halted. This makes voting on proposals created before the chain halt not possible as that check requires those queries to work. This removes that check for now. Next week, once those proposals have cleared we can re enable it. * Allow voting abstain on proposals. (#454) * Use version number from package.json. (#455) * Migrate away from Daisy UI and bring design closer to spec. (#457) * WIP - migrate away from Daisy UI. * Use text sizes from spec in pages covered so far. Have mostly completed: - /starred - DAO homepage - staking modal - nav bar * Proposal view working and new proposal template selection modal. * WIP - proposal voting page. * Update ProposalDetails and allow voting. * Add proposal execute button. * Add loading state to button. * Update multisig page visuals. * Fix build errors. * Updated DAO create page. * DAO create page visual improvements. * Update Multisig create page. * Remove unused component files. * Checkpoint don't commit this Zeke. * Added weeks and days to seconds formatter. * Add Token image field and update most templates. * Prompt to stake if no voting power for voting. * Accent DAO / Multisig page with average color of logo (#460) * Use average color from DAO's logo as accent color. * Added colorization to multisig page. * Ran next formatter. * Fixed yarn lock URLs. * Failsafe and load page if client fails to connect when averaging color. * Address feedback from Sager. * Add label to DAO / Multisig name field (#470) * WIP - migrate away from Daisy UI. * Use text sizes from spec in pages covered so far. Have mostly completed: - /starred - DAO homepage - staking modal - nav bar * Proposal view working and new proposal template selection modal. * WIP - proposal voting page. * Update ProposalDetails and allow voting. * Add proposal execute button. * Add loading state to button. * Update multisig page visuals. * Fix build errors. * Updated DAO create page. * DAO create page visual improvements. * Update Multisig create page. * Remove unused component files. * Checkpoint don't commit this Zeke. * Added weeks and days to seconds formatter. * Add Token image field and update most templates. * Prompt to stake if no voting power for voting. * Address feedback from Sager. * Accent DAO / Multisig page with average color of logo (#460) * Use average color from DAO's logo as accent color. * Added colorization to multisig page. * Ran next formatter. * Fixed yarn lock URLs. * Failsafe and load page if client fails to connect when averaging color. * Add label to DAO / Multisig name field (#470) * Misc fixes. * Swap to a tooltip library that actually works. * Marketing token image & ensure sufficent contrast in accent color. * Prompt to configure keplr if installed but not configured. * Don't perform accent color check in useEffect. Pls vercel. * Final fixups from testing. * Feedback from elgorithm. * Correctly center background token images. Co-authored-by: Noah Saso Co-authored-by: Jake Hartnell Co-authored-by: Sagar Saija Co-authored-by: Noah Saso Co-authored-by: Jake Hartnell Co-authored-by: Joshua Van Deren Co-authored-by: ebaker <430383+ebaker@users.noreply.github.com> --- .vscode/settings.json | 5 +- apps/dapp/.env.development | 2 +- apps/dapp/.env.localhost | 2 +- apps/dapp/.env.mainnet | 3 +- apps/dapp/assets/icons/Abstain.svg | 3 + apps/dapp/assets/icons/Discord.svg | 2 +- apps/dapp/assets/icons/MemberCheck.svg | 4 +- apps/dapp/assets/icons/arrowUpRight.svg | 3 + apps/dapp/assets/icons/copy.svg | 5 + apps/dapp/assets/icons/github.svg | 2 +- apps/dapp/atoms/sidebar.ts | 7 - apps/dapp/components/Address.tsx | 61 - apps/dapp/components/BetaWarning.tsx | 73 +- apps/dapp/components/Breadcrumbs.tsx | 2 +- apps/dapp/components/ChainEnableModal.tsx | 42 +- apps/dapp/components/Claims.tsx | 38 +- apps/dapp/components/CodeIdSelect.tsx | 7 +- apps/dapp/components/ConnectWalletButton.tsx | 77 +- apps/dapp/components/ContractCard.tsx | 53 +- apps/dapp/components/ContractView.tsx | 136 +- apps/dapp/components/CopyToClipboard.tsx | 73 + apps/dapp/components/CosmosMessageDisplay.tsx | 9 +- apps/dapp/components/DaoContractInfo.tsx | 32 +- apps/dapp/components/DaoTreasury.tsx | 37 + apps/dapp/components/Execute.tsx | 103 + apps/dapp/components/FormCard.tsx | 11 + apps/dapp/components/GradientWrapper.tsx | 2 +- apps/dapp/components/HelpTooltip.tsx | 28 - apps/dapp/components/InstallKeplr.tsx | 45 +- apps/dapp/components/JunoLogo.tsx | 28 - apps/dapp/components/Layout.tsx | 12 +- apps/dapp/components/LinkCard.tsx | 19 - apps/dapp/components/Loader.tsx | 25 - apps/dapp/components/Logo.tsx | 11 +- apps/dapp/components/MarkdownPreview.tsx | 6 +- apps/dapp/components/MessageSelector.tsx | 39 - apps/dapp/components/Modal.tsx | 11 + apps/dapp/components/MultisigContractInfo.tsx | 22 +- apps/dapp/components/Nav.tsx | 42 +- apps/dapp/components/NoKeplrAccountModal.tsx | 28 + apps/dapp/components/Notifications.tsx | 1 + apps/dapp/components/Paginator.tsx | 8 +- apps/dapp/components/PlusMinusButton.tsx | 34 - apps/dapp/components/Progress.tsx | 19 + apps/dapp/components/ProposalDetails.tsx | 692 +++--- apps/dapp/components/ProposalDraftSidebar.tsx | 62 - apps/dapp/components/ProposalForm.tsx | 260 ++- apps/dapp/components/ProposalList.tsx | 10 +- .../ProposalStatus/ProposalStatus.tsx | 2 - apps/dapp/components/ProposalVoteStatus.tsx | 68 - apps/dapp/components/ProposalVotes.tsx | 82 - apps/dapp/components/Sidebar.tsx | 26 - apps/dapp/components/SidebarLayout.tsx | 4 +- apps/dapp/components/StakingModal.tsx | 252 +-- apps/dapp/components/TemplateSelector.tsx | 94 + apps/dapp/components/ThemeToggle.tsx | 17 +- .../TooltipsDisplay/TooltipsDisplay.tsx | 9 +- .../components/TooltipsDisplay/daoCreate.tsx | 20 +- .../TooltipsDisplay/multisigCreate.tsx | 10 +- apps/dapp/components/Vote.tsx | 100 + apps/dapp/components/icons/Abstain.tsx | 17 + apps/dapp/components/icons/ArrowUpRight.tsx | 24 + apps/dapp/components/icons/Copy.tsx | 22 + apps/dapp/components/icons/Dao.tsx | 3 +- apps/dapp/components/icons/Discord.tsx | 3 +- apps/dapp/components/icons/Github.tsx | 1 - apps/dapp/components/icons/MemberCheck.tsx | 1 - apps/dapp/components/icons/Pencil.tsx | 3 +- apps/dapp/components/icons/Twitter.tsx | 1 - apps/dapp/components/input/AddressInput.tsx | 27 +- .../dapp/components/input/CodeMirrorInput.tsx | 56 +- apps/dapp/components/input/ImageSelector.tsx | 119 + apps/dapp/components/input/InputLabel.tsx | 18 +- apps/dapp/components/input/NumberInput.tsx | 61 +- apps/dapp/components/input/SelectInput.tsx | 10 +- apps/dapp/components/input/TextAreaInput.tsx | 5 +- apps/dapp/components/input/TextInput.tsx | 11 +- apps/dapp/components/input/ToggleInput.tsx | 17 +- .../components/input/TokenAmountInput.tsx | 131 ++ apps/dapp/next.config.js | 6 +- apps/dapp/package.json | 8 +- apps/dapp/pages/_app.tsx | 27 +- apps/dapp/pages/_document.tsx | 2 +- .../pages/dao/[contractAddress]/index.tsx | 322 +-- .../proposals/[proposalId].tsx | 28 +- .../[contractAddress]/proposals/create.tsx | 55 +- apps/dapp/pages/dao/create.tsx | 854 +++---- apps/dapp/pages/dao/list.tsx | 50 +- apps/dapp/pages/index.tsx | 52 +- .../multisig/[contractAddress]/index.tsx | 194 +- .../proposals/[proposalId].tsx | 24 +- .../[contractAddress]/proposals/create.tsx | 33 +- apps/dapp/pages/multisig/create.tsx | 338 +-- apps/dapp/pages/multisig/list.tsx | 53 +- apps/dapp/pages/starred.tsx | 91 +- apps/dapp/selectors/cosm.ts | 12 +- apps/dapp/selectors/proposals.ts | 50 +- apps/dapp/styles/app.css | 7 - apps/dapp/templates/addToken.tsx | 117 +- apps/dapp/templates/changeMembers.tsx | 248 +- apps/dapp/templates/configUpdate.tsx | 297 ++- apps/dapp/templates/custom.tsx | 60 +- apps/dapp/templates/mint.tsx | 103 +- apps/dapp/templates/removeToken.tsx | 104 +- apps/dapp/templates/spend.tsx | 163 +- apps/dapp/templates/stake.tsx | 296 ++- apps/dapp/templates/templateList.tsx | 117 +- apps/dapp/tsconfig.json | 19 +- apps/dapp/util/colors.ts | 12 + apps/dapp/util/constants.ts | 1 + apps/dapp/util/conversion.ts | 33 +- apps/dapp/util/cosmos_msg.json | 206 +- apps/dapp/util/formValidation.ts | 11 +- apps/dapp/util/isValidAddress.ts | 47 - apps/dapp/util/messagehelpers.ts | 48 +- package.json | 5 +- packages/icons/assets/connect.svg | 5 + packages/icons/assets/wallet.svg | 3 + packages/icons/package.json | 15 + packages/icons/tsconfig.json | 4 + packages/ui/Button/Button.tsx | 135 +- packages/ui/globals.css | 130 +- packages/ui/package.json | 1 - packages/ui/tailwind.config.js | 64 +- packages/ui/theme.tsx | 20 +- packages/utils/index.tsx | 1 + packages/utils/isValidAddress.ts | 52 + packages/utils/package.json | 11 + packages/utils/tsconfig.json | 5 + yarn.lock | 1986 ++++++++++------- 130 files changed, 5638 insertions(+), 4297 deletions(-) create mode 100644 apps/dapp/assets/icons/Abstain.svg create mode 100644 apps/dapp/assets/icons/arrowUpRight.svg create mode 100644 apps/dapp/assets/icons/copy.svg delete mode 100644 apps/dapp/atoms/sidebar.ts delete mode 100644 apps/dapp/components/Address.tsx create mode 100644 apps/dapp/components/CopyToClipboard.tsx create mode 100644 apps/dapp/components/DaoTreasury.tsx create mode 100644 apps/dapp/components/Execute.tsx create mode 100644 apps/dapp/components/FormCard.tsx delete mode 100644 apps/dapp/components/HelpTooltip.tsx delete mode 100644 apps/dapp/components/JunoLogo.tsx delete mode 100644 apps/dapp/components/LinkCard.tsx delete mode 100644 apps/dapp/components/Loader.tsx delete mode 100644 apps/dapp/components/MessageSelector.tsx create mode 100644 apps/dapp/components/Modal.tsx create mode 100644 apps/dapp/components/NoKeplrAccountModal.tsx delete mode 100644 apps/dapp/components/PlusMinusButton.tsx create mode 100644 apps/dapp/components/Progress.tsx delete mode 100644 apps/dapp/components/ProposalDraftSidebar.tsx delete mode 100644 apps/dapp/components/ProposalVoteStatus.tsx delete mode 100644 apps/dapp/components/ProposalVotes.tsx delete mode 100644 apps/dapp/components/Sidebar.tsx create mode 100644 apps/dapp/components/TemplateSelector.tsx create mode 100644 apps/dapp/components/Vote.tsx create mode 100644 apps/dapp/components/icons/Abstain.tsx create mode 100644 apps/dapp/components/icons/ArrowUpRight.tsx create mode 100644 apps/dapp/components/icons/Copy.tsx create mode 100644 apps/dapp/components/input/ImageSelector.tsx create mode 100644 apps/dapp/components/input/TokenAmountInput.tsx create mode 100644 apps/dapp/util/colors.ts delete mode 100644 apps/dapp/util/isValidAddress.ts create mode 100644 packages/icons/assets/connect.svg create mode 100644 packages/icons/assets/wallet.svg create mode 100644 packages/icons/package.json create mode 100644 packages/icons/tsconfig.json create mode 100644 packages/utils/index.tsx create mode 100644 packages/utils/isValidAddress.ts create mode 100644 packages/utils/package.json create mode 100644 packages/utils/tsconfig.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 7fe9c2651..305bb69ec 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { "workbench.colorCustomizations": { "activityBar.background": "#38027e" - } + }, + "eslint.workingDirectories": [ + "./apps/dapp", + ], } diff --git a/apps/dapp/.env.development b/apps/dapp/.env.development index b62ae1dd1..409b4f181 100644 --- a/apps/dapp/.env.development +++ b/apps/dapp/.env.development @@ -12,7 +12,7 @@ NEXT_PUBLIC_SITE_DESCRIPTION=Create and deploy IBC-native interchain DAOs. NEXT_PUBLIC_SITE_URL=https://daodao.zone NEXT_PUBLIC_SITE_IMAGE="/social.jpg" NEXT_PUBLIC_SITE_ICON_URL="/yin_yang.png" -NEXT_PUBLIC_DAO_DAO_VERSION="0.3.0" +NEXT_PUBLIC_DAO_DAO_VERSION=$npm_package_version # The prefix added to keys for favorited DAOs in local storage. NEXT_PUBLIC_FAVORITES_NAMESPACE=19 NEXT_PUBLIC_GAS_PRICE=0.0025ujunox diff --git a/apps/dapp/.env.localhost b/apps/dapp/.env.localhost index d8ecf4b2b..37bb50286 100644 --- a/apps/dapp/.env.localhost +++ b/apps/dapp/.env.localhost @@ -12,7 +12,7 @@ NEXT_PUBLIC_SITE_DESCRIPTION=Create and deploy IBC-native interchain DAOs. NEXT_PUBLIC_SITE_URL=https://daodao.zone NEXT_PUBLIC_SITE_IMAGE="/social.jpg" NEXT_PUBLIC_SITE_ICON_URL="/yin_yang.png" -NEXT_PUBLIC_DAO_DAO_VERSION="0.3.0" +NEXT_PUBLIC_DAO_DAO_VERSION=$npm_package_version # The prefix added to keys for favorited DAOs in local storage. NEXT_PUBLIC_FAVORITES_NAMESPACE=2 NEXT_PUBLIC_GAS_PRICE=0.0025ujunox diff --git a/apps/dapp/.env.mainnet b/apps/dapp/.env.mainnet index d44a34669..487866be7 100644 --- a/apps/dapp/.env.mainnet +++ b/apps/dapp/.env.mainnet @@ -12,10 +12,11 @@ NEXT_PUBLIC_SITE_DESCRIPTION=Create and deploy IBC-native interchain DAOs. NEXT_PUBLIC_SITE_URL=https://daodao.zone NEXT_PUBLIC_SITE_IMAGE="/social.jpg" NEXT_PUBLIC_SITE_ICON_URL="/yin_yang.png" -NEXT_PUBLIC_DAO_DAO_VERSION="0.3.0" +NEXT_PUBLIC_DAO_DAO_VERSION=$npm_package_version # The prefix added to keys for favorited DAOs in local storage. NEXT_PUBLIC_FAVORITES_NAMESPACE=43 NEXT_PUBLIC_GAS_PRICE=0.0025ujuno +NEXT_PUBLIC_CHAIN_TXN_URL_PREFIX=https://mintscan.io/juno/txs/ # Contracts / Codes NEXT_PUBLIC_CW20_CODE_ID=37 diff --git a/apps/dapp/assets/icons/Abstain.svg b/apps/dapp/assets/icons/Abstain.svg new file mode 100644 index 000000000..5a2b1f7b6 --- /dev/null +++ b/apps/dapp/assets/icons/Abstain.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/dapp/assets/icons/Discord.svg b/apps/dapp/assets/icons/Discord.svg index adb32924b..ba63a0e3e 100644 --- a/apps/dapp/assets/icons/Discord.svg +++ b/apps/dapp/assets/icons/Discord.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/dapp/assets/icons/MemberCheck.svg b/apps/dapp/assets/icons/MemberCheck.svg index c252010bd..7749247e4 100644 --- a/apps/dapp/assets/icons/MemberCheck.svg +++ b/apps/dapp/assets/icons/MemberCheck.svg @@ -1,4 +1,4 @@ - - + + diff --git a/apps/dapp/assets/icons/arrowUpRight.svg b/apps/dapp/assets/icons/arrowUpRight.svg new file mode 100644 index 000000000..6332fc372 --- /dev/null +++ b/apps/dapp/assets/icons/arrowUpRight.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/dapp/assets/icons/copy.svg b/apps/dapp/assets/icons/copy.svg new file mode 100644 index 000000000..59e7dc3c1 --- /dev/null +++ b/apps/dapp/assets/icons/copy.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/dapp/assets/icons/github.svg b/apps/dapp/assets/icons/github.svg index 6812d33ed..9b2f5fef6 100644 --- a/apps/dapp/assets/icons/github.svg +++ b/apps/dapp/assets/icons/github.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/dapp/atoms/sidebar.ts b/apps/dapp/atoms/sidebar.ts deleted file mode 100644 index b04a8ad06..000000000 --- a/apps/dapp/atoms/sidebar.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { atom, atomFamily } from 'recoil' - -// The expanded state of the sidebar. -export const sidebarExpandedAtom = atom({ - key: 'sidebarExpandedAtom', - default: true, -}) diff --git a/apps/dapp/components/Address.tsx b/apps/dapp/components/Address.tsx deleted file mode 100644 index 168a987d9..000000000 --- a/apps/dapp/components/Address.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { PaperClipIcon } from '@heroicons/react/outline' -import toast from 'react-hot-toast' - -function concatAddressImpl( - address: string, - takeStart: number, - takeEnd: number -) { - const strLen = address.length - const first = address.substring(0, takeStart) - const last = address.substring(strLen - takeEnd, strLen) - return first + '...' + last -} - -function concatAddress(address: string) { - const takeN = 7 - return concatAddressImpl(address, takeN, takeN) -} - -export function Address({ address }: { address: string }) { - return ( - - ) -} - -export function AddressSmall({ address }: { address: string }) { - return ( - - ) -} - -export function AddressAccent({ address }: { address: string }) { - return ( - - ) -} diff --git a/apps/dapp/components/BetaWarning.tsx b/apps/dapp/components/BetaWarning.tsx index 319c776f5..b81e08c90 100644 --- a/apps/dapp/components/BetaWarning.tsx +++ b/apps/dapp/components/BetaWarning.tsx @@ -1,45 +1,46 @@ import { ChevronRightIcon, XIcon } from '@heroicons/react/outline' +import { Button } from '@components' + import SvgMessage from 'components/icons/Message' export function BetaWarningModal({ onAccept }: { onAccept: Function }) { return ( -
-
-

Before you continue...

-

- DAO DAO is in beta, and has not yet been audited. Do not keep - large sums of money in your DAO, and do not use your DAO for - anything mission critical. -

-

- - Give us feedback! - - Bug reports and feature requests are welcome. -

-

- DAO DAO TOOLING IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT - WARRANTIES OF ANY KIND. No developer or entity involved in creating - the DAO DAO UI or smart contracts will be liable for any claims or - damages whatsoever associated with your use, inability to use, or your - interaction with other users of DAO DAO tooling, including any direct, - indirect, incidental, special, exemplary, punitive or consequential - damages, or loss of profits, cryptocurrencies, tokens, or anything - else of value. -

- +
) @@ -47,14 +48,14 @@ export function BetaWarningModal({ onAccept }: { onAccept: Function }) { export function BetaNotice({ onClose }: { onClose: Function }) { return ( -
+

DAO DAO is in
beta!

}) { return ( -