From 543cd2a95862d07fba1ffdea7ccd15a7650f79c6 Mon Sep 17 00:00:00 2001 From: Santiago Siri Date: Fri, 23 Oct 2020 14:28:10 +0200 Subject: [PATCH 1/3] tag for tokens and dates --- src/components/Browser/Browser.jsx | 10 ++++++++++ src/lang/en.json | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Browser/Browser.jsx b/src/components/Browser/Browser.jsx index 493ff5558..88cd08248 100644 --- a/src/components/Browser/Browser.jsx +++ b/src/components/Browser/Browser.jsx @@ -136,6 +136,16 @@ class Browser extends Component { return } + if (this.props.match.params.token) { + return + } + + if (this.props.match.params.date) { + let options = { year: 'numeric', month: 'short', day: 'numeric' }; + var today = new Date(this.props.match.params.date); + return + } + return ; } diff --git a/src/lang/en.json b/src/lang/en.json index 17a7a1e3e..4b098ba39 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -150,6 +150,7 @@ "email-sample": "satoshi@nakamoto.org", "password-sample": "make it long.", "sign-in": "Connect Wallet", + "connect": "Connect", "password": "Password", "use-social-media": "or use:", "facebook": "Facebook", @@ -876,10 +877,11 @@ "search-user": "👤 {{searchTerm}}", "search-collective": "🏳️ {{searchTerm}}", "search-contract": "💡 {{searchTerm}}", + "search-token": "💰 {{searchTerm}}", "search-summon": "🔥 Summon of {{dao}}", "search-ragequit": "💸 Ragequit of {{shares}} shares from {{dao}} by {{address}}", "search-default": "🔍 {{searchTerm}}", - "search-dates": "📅 {{searchTerm}}", + "search-date": "📅 {{searchTerm}}", "moloch-unsponsored": "Unsponsored Proposal", "voted-yes": "Yes to {{proposal}}", "voted-no": "No to {{proposal}}", From ffa597324e98584ec632320b2ce4588af1cd8b3d Mon Sep 17 00:00:00 2001 From: Santiago Siri Date: Sat, 24 Oct 2020 00:40:41 +0200 Subject: [PATCH 2/3] more elegant error messages --- src/components/Account/Account.jsx | 11 ++++++++++- src/components/DAO/DAO.jsx | 3 ++- src/components/Menu/Sidebar.jsx | 12 +++++++++++- src/components/Timeline/Timeline.jsx | 11 ++++++++++- src/components/Vote/Vote.jsx | 3 ++- src/lang/en.json | 4 +++- src/lib/const.js | 2 +- src/styles/Dapp.css | 17 ++++++++++++++--- 8 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/components/Account/Account.jsx b/src/components/Account/Account.jsx index e0706aaa3..3e493920b 100644 --- a/src/components/Account/Account.jsx +++ b/src/components/Account/Account.jsx @@ -7,6 +7,7 @@ import { Link } from 'react-router-dom'; import { shortenCryptoName } from 'utils/strings'; import Search, { includeInSearch } from 'components/Search/Search'; +import parser from 'html-react-parser'; import i18n from 'i18n'; import { config } from 'config' @@ -81,7 +82,15 @@ const AccountQuery = ({ publicAddress, width, height, format, hidden }) => { ); } - if (error) return `Error! ${error}`; + if (error) return ( + <> + {(format === 'searchBar') ? + + : +
{parser(i18n.t('failure-short', { errorMessage: error }))}
+ } + + ); if (data) { label = getENSName(data, publicAddress); diff --git a/src/components/DAO/DAO.jsx b/src/components/DAO/DAO.jsx index 714d300df..2bd25cb5e 100644 --- a/src/components/DAO/DAO.jsx +++ b/src/components/DAO/DAO.jsx @@ -8,6 +8,7 @@ import { findLast } from 'lodash'; import { gui } from 'lib/const'; import { shortenCryptoName } from 'utils/strings'; import Search, { includeInSearch } from 'components/Search/Search'; +import parser from 'html-react-parser'; import i18n from 'i18n'; import { config } from 'config' @@ -43,7 +44,7 @@ const DAOQuery = ({ publicAddress, width, height, format }) => { if (loading) { return null; } - if (error) return `Error! ${error}`; + if (error) return
{parser(i18n.t('failure-short', { errorMessage: error }))}
; const daoTitle = findLast(data.moloches, { id: publicAddress }).title; let label; diff --git a/src/components/Menu/Sidebar.jsx b/src/components/Menu/Sidebar.jsx index 27d9be2ac..e97607896 100644 --- a/src/components/Menu/Sidebar.jsx +++ b/src/components/Menu/Sidebar.jsx @@ -9,6 +9,8 @@ import { query } from 'components/Menu/queries'; import { reduce, sortBy } from 'lodash'; import { view as routerView } from 'lib/const' +import parser from 'html-react-parser'; + import back from 'images/back.svg'; import i18n from 'i18n'; import 'styles/Dapp.css'; @@ -231,7 +233,15 @@ const MenuQuery = ({ address, scrollUp, view, proposalId, param }) => { ); } - if (error) return `Error! ${error}`; + if (error) return ( + + ); const defaultMenu = _getMenu(view, data, address, param); const sorted = _getDAOs(data); diff --git a/src/components/Timeline/Timeline.jsx b/src/components/Timeline/Timeline.jsx index 09363040c..d42260b94 100644 --- a/src/components/Timeline/Timeline.jsx +++ b/src/components/Timeline/Timeline.jsx @@ -30,6 +30,7 @@ import { uniqBy, orderBy as _orderBy } from 'lodash'; import { getDescription } from 'components/Post/Post'; import i18n from 'i18n'; +import parser from 'html-react-parser'; import notFound from 'images/not-found.svg'; import ethereum from 'images/ethereum.svg'; @@ -165,7 +166,15 @@ const Feed = (props) => { } return ; } - if (error) return

Error!

; + if (error) return ( + <> + {(props.format === 'searchBar') ? + + : +
{parser(i18n.t('failure', { errorMessage: error }))}
+ } + + ); const accountAddress = props.address; const timestamp = Math.floor(new Date().getTime() / 1000); diff --git a/src/components/Vote/Vote.jsx b/src/components/Vote/Vote.jsx index 2782699bf..1b29c4909 100644 --- a/src/components/Vote/Vote.jsx +++ b/src/components/Vote/Vote.jsx @@ -12,6 +12,7 @@ import Transaction from 'components/Transaction/Transaction'; import { view as routerView } from 'lib/const'; +import parser from 'html-react-parser'; import { query } from 'components/Vote/queries' import { config } from 'config' import 'styles/Dapp.css'; @@ -60,7 +61,7 @@ const VoteQuery = (props) => { ); } - if (error) return `Error! ${error}`; + if (error) return
{parser(i18n.t('failure', { errorMessage: error }))}
; if (data.votes.length === 0) { return ( diff --git a/src/lang/en.json b/src/lang/en.json index 4b098ba39..9572fa0fa 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -943,5 +943,7 @@ "meta-token": "Proposals with {{token}} token.", "meta-proposal": "Votes on a DAO proposal.", "meta-date": "Proposals from {{date}}.", - "meta-search": "Proposals mentioning {{search}}." + "meta-search": "Proposals mentioning {{search}}.", + "failure": "😱 Blockchain unreachable
{{errorMessage}}
Check network status.", + "failure-short": "😱" } diff --git a/src/lib/const.js b/src/lib/const.js index 252c42b12..7afc4c334 100644 --- a/src/lib/const.js +++ b/src/lib/const.js @@ -50,7 +50,7 @@ const _gui = { LIMIT_TRANSACTIONS_PER_LEDGER: 10, COLLECTIVE_MAX_FETCH: 25, MAX_LENGTH_ACCOUNT_NAMES: 19, - MAX_LENGTH_TAG_LABELS: 25, + MAX_LENGTH_TAG_LABELS: 15, }; /** diff --git a/src/styles/Dapp.css b/src/styles/Dapp.css index 8de24d912..6e206b0e5 100755 --- a/src/styles/Dapp.css +++ b/src/styles/Dapp.css @@ -8086,14 +8086,18 @@ width: 1px; .empty { border: 1px solid #7c839d; - font-size: 0.8em; - padding: 0px 5px; + padding: 5px; text-align: center; border-radius: 5px; color: #7c839d; - line-height: 28px; + line-height: 24px; background-color: #f0eef4; margin-bottom: 20px; + font-size:14px; +} + +.empty.failure { + margin: 10px; } .sidebar-label.sidebar-label-dao { @@ -9015,6 +9019,13 @@ h4 { .details.details-open { border: 1px solid var(--menu-sidebar-selected); } + + .submenu { + padding: 0px; + background-color: transparent; + border-radius: 0px; + margin-bottom: 0px; + } } From 6220ff8cd671763175227c371746d1097f2aa4d4 Mon Sep 17 00:00:00 2001 From: Santiago Siri Date: Sat, 24 Oct 2020 01:04:19 +0200 Subject: [PATCH 3/3] burger menu reappears on resize --- src/components/Dapp/Dapp.jsx | 21 ++++++++++++++++++++- src/styles/Dapp.css | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/Dapp/Dapp.jsx b/src/components/Dapp/Dapp.jsx index e61991be4..1cfc45feb 100644 --- a/src/components/Dapp/Dapp.jsx +++ b/src/components/Dapp/Dapp.jsx @@ -108,12 +108,18 @@ export default class Dapp extends Component { this.onConnect = this.onConnect.bind(this); this.reset = this.reset.bind(this); + this.resize = this.resize.bind(this); } async componentDidMount() { if (this.web3Modal.cachedProvider) { this.onConnect(); } + window.addEventListener('resize', this.resize) + } + + componentWillUnmount() { + window.removeEventListener('resize', this.resize) } async onConnect() { @@ -131,6 +137,7 @@ export default class Dapp extends Component { connected: true, address, networkId, + mobile: (window.innerWidth < 768) }); } @@ -158,6 +165,14 @@ export default class Dapp extends Component { }); } + resize() { + if (window.innerWidth < 768 && !this.state.mobile) { + this.setState({ mobile: true }); + } else if (window.innerWidth >= 768 && this.state.mobile) { + this.setState({ mobile: false }); + } + } + async reset() { const { web3 } = this.state; if (web3 && web3.currentProvider && web3.currentProvider.close) { @@ -183,7 +198,11 @@ export default class Dapp extends Component { - + {(this.state.mobile) ? + + : + null + } } /> diff --git a/src/styles/Dapp.css b/src/styles/Dapp.css index 6e206b0e5..b3c89ef87 100755 --- a/src/styles/Dapp.css +++ b/src/styles/Dapp.css @@ -5963,6 +5963,7 @@ blockquote { .burger-menu.burger-menu-close { transition: width 0.15s ease 0.15s; width:0px; + border: 0px; } .hero-button {