Skip to content

Commit

Permalink
Merge pull request #1364 from alephdata/kirk/ui-updates
Browse files Browse the repository at this point in the history
Kirk/ui updates
  • Loading branch information
pudo authored Sep 17, 2020
2 parents a3eb443 + 44debd6 commit 81411b6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
5 changes: 4 additions & 1 deletion ui/src/app/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,14 @@ a {

&__title {
font-weight: bold;
margin-right: $aleph-grid-size*3;
max-width: $aleph-content-width-limit;

&__text {
display: inline-flex;

.bp3-icon {
align-self: center;
margin-top: 2px;
}
}
}
Expand All @@ -187,6 +189,7 @@ a {
&__count {
@include rtl(float, right, left);
display: block;
margin-top: 2px;
}

&__details {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/CollectionIndex/CollectionIndexItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CollectionIndexItem extends PureComponent {
{ collection.casefile && (
<span className="index-item__details__item">
<Icon icon="social-media" />
<Role.List roles={collection.team} icon={false} truncate={3} separateItems />
<Role.List roles={collection.team} icon={false} truncate={3} truncateItem={20} separateItems />
</span>
)}
</p>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/components/Entity/EntityReferencesMode.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import React from 'react';
import { Waypoint } from 'react-waypoint';
import { defineMessages, injectIntl } from 'react-intl';
Expand Down Expand Up @@ -115,7 +116,7 @@ class EntityReferencesMode extends React.Component {
return <ErrorSection icon="graph" title={intl.formatMessage(messages.no_relationships)} />;
}
const { property } = reference;
const results = ensureArray(result.results);
const results = _.uniqBy(ensureArray(result.results), 'id');
const columns = schema.getFeaturedProperties().filter(prop => prop.name !== property.name);
return (
<section className="EntityReferencesTable">
Expand Down
19 changes: 12 additions & 7 deletions ui/src/components/common/AnimatedCount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import { Skeleton } from 'components/common';

import './AnimatedCount.scss';

const AnimatedCount = ({ count, isPending, label}) => (
<div className="AnimatedCount">
{isPending && <Skeleton.Text className="AnimatedCount__count" type="span" length="3" />}
{!isPending && <CountUp className="AnimatedCount__count" end={count} separator="," />}
<p className="AnimatedCount__label">{label}</p>
</div>
)
const AnimatedCount = ({ count, isPending, label}) => {
if (!isPending && count === undefined) {
return null;
}
return (
<div className="AnimatedCount">
{isPending && <Skeleton.Text className="AnimatedCount__count" type="span" length="3" />}
{!isPending && <CountUp className="AnimatedCount__count" end={count} separator="," />}
<p className="AnimatedCount__label">{label}</p>
</div>
);
}
export default AnimatedCount;
3 changes: 2 additions & 1 deletion ui/src/components/common/Role.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class RoleList extends PureComponent {
const { roles, separateItems, truncate = Infinity, truncateItem } = this.props;
if (!roles) return null;

let names = roles.map(role => <RoleLink key={role.id} role={role} truncate={truncateItem} {...this.props} />);

let names = roles.map(role => <RoleLink key={role.id} role={role} truncate={truncateItem} />);

// Truncate if too long
if (names.length > truncate) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/screens/HomeScreen/HomeScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class HomeScreen extends Component {
placeholder={intl.formatMessage(messages.placeholder, { samples: samplesList })}
inputProps={{ large: true, autoFocus: true }}
/>
<div className="HomeScreen__thirds no-wrap">
<div className="HomeScreen__thirds">
<AnimatedCount
count={statistics?.things}
isPending={statistics.isPending}
Expand Down

0 comments on commit 81411b6

Please sign in to comment.