Skip to content

Commit

Permalink
Updates from Court Dashboard (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai authored May 19, 2020
1 parent b5e164e commit f4cc9df
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 35 deletions.
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'};
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`
})
}

// 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)
}

export const iOS =
Expand Down

0 comments on commit f4cc9df

Please sign in to comment.