From 46b59b6f508ab4dbe8760ea7f0a280d947909a8b Mon Sep 17 00:00:00 2001 From: Peter Phillips Date: Wed, 22 Apr 2020 17:46:51 -0700 Subject: [PATCH] fix: small ui fixes --- app/components/App.js | 5 +-- app/components/Content/EmptyState.js | 5 ++- app/components/Content/WidgetMapper.js | 42 +++++++++++-------------- app/components/EditModeButtons.js | 16 +++++++--- app/components/Panel/Panel.js | 2 +- app/components/Widget/Votes/Votes.js | 17 +++++----- app/store/utils/ipfs.js | 10 +++++- manifest.json | 2 +- public/meta/screenshot-1.png | Bin 0 -> 576136 bytes public/meta/screenshot-2.png | Bin 0 -> 498663 bytes public/meta/screenshot-3.png | Bin 0 -> 515297 bytes 11 files changed, 55 insertions(+), 44 deletions(-) diff --git a/app/components/App.js b/app/components/App.js index 4d643c9..84e60d9 100644 --- a/app/components/App.js +++ b/app/components/App.js @@ -43,7 +43,8 @@ const App = ({ api, widgets, isSyncing }) => { nextWidgets = widgets nextWidgets[index] = widgetObject } - const cId = (await ipfs.object.put({ Data: Buffer.from(JSON.stringify(nextWidgets)), Links: [] }, { enc: 'json', pin: true })).string + const cId = (await ipfs.add(Buffer.from(JSON.stringify(nextWidgets))))[0].hash + //const cId = (await ipfs.object.put({ Data: Buffer.from(JSON.stringify(nextWidgets)), Links: [] }, { enc: 'json', pin: true })).string api.updateContent(cId).toPromise() setEditWidget(null) }, [ api, widgets ]) @@ -53,7 +54,7 @@ const App = ({ api, widgets, isSyncing }) => { } const handleEditModeSubmit = useCallback(async () => { - const cId = (await ipfs.object.put({ Data: Buffer.from(JSON.stringify(editedWidgets)), Links: [] }, { enc: 'json', pin: true })).string + const cId = (await ipfs.add(Buffer.from(JSON.stringify(editedWidgets))))[0].hash api.updateContent(cId).toPromise() setEditMode(false) }, [ api, editedWidgets, setEditMode ]) diff --git a/app/components/Content/EmptyState.js b/app/components/Content/EmptyState.js index 8cf27b3..d97ddb0 100644 --- a/app/components/Content/EmptyState.js +++ b/app/components/Content/EmptyState.js @@ -31,7 +31,7 @@ const EmptyState = React.memo(({ isSyncing, onActionClick }) => { grid-template-columns: auto auto; grid-gap: ${1 * GU}px; /* Fixed weight to avoid flicker - resizing when switching from + resizing when switching from text to syncing state */ height: ${10.5 * GU}px; margin: ${3 * GU}px 0; @@ -52,8 +52,7 @@ const EmptyState = React.memo(({ isSyncing, onActionClick }) => {
{ const { editMode } = useEditMode() const label = LABELS[type] return ( - <> -
- {label} - {false && editMode && } -
- - +
+ {label} + {false && editMode && } +
) } @@ -109,7 +105,7 @@ const Widget = ({ id, children, type, onEditMarkdown, ...props }) => { const onRemove = async id => { const nextWidgets = widgets.filter(w => w.id !== id) - const cId = (await ipfs.object.put({ Data: Buffer.from(JSON.stringify(nextWidgets)), Links: [] }, { enc: 'json', pin: true })).string + const cId = (await ipfs.add(Buffer.from(JSON.stringify(nextWidgets))))[0].hash api.updateContent(cId).toPromise() } @@ -123,7 +119,7 @@ const Widget = ({ id, children, type, onEditMarkdown, ...props }) => { height: auto; justify-content: center; overflow: hidden; - padding: ${2.25 * GU}px ${3 * GU}px; + padding: ${3 * GU}px; width: auto; margin-bottom: ${2 * GU}px; &.sortable-ghost { @@ -141,7 +137,7 @@ const Widget = ({ id, children, type, onEditMarkdown, ...props }) => { css={` position: absolute; right: ${3 * GU}px; - top: ${3* GU}px; + top: ${3 * GU}px; display: flex; justify-content: flex-start; `} @@ -167,7 +163,7 @@ const Widget = ({ id, children, type, onEditMarkdown, ...props }) => { />
} - {(type !== 'MARKDOWN' || editMode) && } + {type !== 'MARKDOWN' && } {React.cloneElement(children, props)} ) diff --git a/app/components/EditModeButtons.js b/app/components/EditModeButtons.js index 0ef9fdb..0f32c5c 100644 --- a/app/components/EditModeButtons.js +++ b/app/components/EditModeButtons.js @@ -1,14 +1,20 @@ import React from 'react' import PropTypes from 'prop-types' -import { Button, GU } from '@aragon/ui' +import { Button, GU, Help } from '@aragon/ui' const EditModeButtons = ({ onCancel, onSubmit }) => { return ( - <> -