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

Updates from Court Dashboard #1426

Merged
merged 6 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/app-locator.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function getAppUrl(appId, location = '') {
// "Finance:1234": load the finance app from localhost & the port 1234.
// "Finance,TokenManager": load the finance app and the Tokens app locally.
// "0x6b20…:3333": load the app with 0x6b20… ID from localhost & the 3333 port.
// "Voting:http://example.com:4444/": load the Voting app from example.com & the 4444 port.
// "Voting:http://example.org:4444/": load the Voting app from example.org & the 4444 port.
//
export function parseAppLocator(appLocator) {
if (!appLocator || appLocator === 'ipfs') {
Expand Down
13 changes: 5 additions & 8 deletions src/components/Activity/ActivityItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from '@aragon/ui'
import { ActivityContext } from '../../contexts/ActivityContext'
import { network } from '../../environment'
import { cssgu } from '../../utils'
import { transformAddresses } from '../../web3-utils'
import AppIcon from '../AppIcon/AppIcon'
import LocalIdentityBadge from '../IdentityBadge/LocalIdentityBadge'
Expand Down Expand Up @@ -66,7 +65,7 @@ const ActivityItem = ({ activity }) => {
display: flex;
flex-direction: column;
overflow: hidden;
padding: ${cssgu`2gu`};
padding: ${2 * GU}px;
background: ${activity.read
? theme.surface
: theme.surfaceHighlight};
Expand All @@ -90,8 +89,8 @@ const ActivityItem = ({ activity }) => {
</div>
<div
css={`
margin-left: ${cssgu`1gu`};
max-width: ${cssgu`12.5gu`};
margin-left: ${1 * GU}px;
max-width: ${12.5 * GU}px
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand All @@ -105,7 +104,7 @@ const ActivityItem = ({ activity }) => {
<TimeTag
date={activity.createdAt}
css={`
margin: 0 ${cssgu`1.5gu`};
margin: 0 ${1.5 * GU}px;
`}
/>
)}
Expand Down Expand Up @@ -164,9 +163,7 @@ const ItemContent = React.memo(
>
{transformAddresses(text, (part, isAddress, index) =>
isAddress ? (
<span title={part} key={index}>
<LocalIdentityBadge entity={part} compact />
</span>
<LocalIdentityBadge key={index} entity={part} compact />
) : (
<span key={index}>{part}</span>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,24 @@ export default function NotificationsLogin({
: theme.border};
`}
adornment={
emailInvalid === false ? (
<IconCheck
css={`
color: ${theme.positive};
`}
/>
) : inputEmail.trim() ? (
emailInvalid ? (
<IconCross
css={`
color: ${theme.negative};
`}
/>
) : (
// hidden icon to avoid losing focus
<IconCheck
css={`
opacity: 0;
opacity: ${inputEmail.trim() ? '1' : '0'};
Copy link
Contributor

Choose a reason for hiding this comment

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

@bpierre hand was around here :)

color: ${theme.positive};
`}
/>
)
}
adornmentPosition="end"
type="email"
placeholder="you@example.com"
placeholder="you@example.org"
wide
value={inputEmail}
onChange={handleEmailChange}
Expand Down
17 changes: 1 addition & 16 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import resolvePathname from 'resolve-pathname'
import { GU } from '@aragon/ui'

export function pollEvery(fn, delay) {
let timer = -1
Expand Down Expand Up @@ -132,23 +131,9 @@ export function shuffleArray(original) {
return array
}

// Makes “gu” a CSS unit in a string, e.g.
// cssgu`10px 2gu 4gu`
export function cssgu(strings, ...substitutions) {
return strings
.map((str, i) => str + (substitutions[i] || ''))
.join('')
.replace(/([0-9]+(?:\.[0-9]+)?)gu/g, (match, value) => {
value = parseFloat(value)
return isNaN(value) ? match : `${value * GU}px`
})
}
Comment on lines -135 to -145
Copy link
Contributor

Choose a reason for hiding this comment

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

👋 👯

Copy link
Contributor

Choose a reason for hiding this comment

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

is that something that you used before having the grid unit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was just before the grid unit was introduced (we released the activity panel late April, and began introducing the GU in mid May).


// Email validation regex from https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript
export function validateEmail(email) {
// eslint-disable-next-line no-useless-escape
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(String(email).toLowerCase())
return /^.+\@.+\..+$/.test(email)
Copy link
Contributor

Choose a reason for hiding this comment

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

Quite the simplification!

}

export const iOS =
Expand Down