UserIndex: display dates on accounts in a more compact way
This commit is contained in:
parent
76b05f738a
commit
a368ddfee8
|
@ -10,16 +10,20 @@ exports[`<DisplayName /> renders display name + account name 1`] = `
|
||||||
onMouseEnter={[Function]}
|
onMouseEnter={[Function]}
|
||||||
onMouseLeave={[Function]}
|
onMouseLeave={[Function]}
|
||||||
>
|
>
|
||||||
<bdi>
|
<span
|
||||||
<strong
|
className="display-name__name"
|
||||||
className="display-name__html"
|
>
|
||||||
dangerouslySetInnerHTML={
|
<bdi>
|
||||||
Object {
|
<strong
|
||||||
"__html": "<p>Foo</p>",
|
className="display-name__html"
|
||||||
|
dangerouslySetInnerHTML={
|
||||||
|
Object {
|
||||||
|
"__html": "<p>Foo</p>",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
/>
|
||||||
/>
|
</bdi>
|
||||||
</bdi>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="display-name__account"
|
className="display-name__account"
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Account extends ImmutablePureComponent {
|
||||||
<div className='account__wrapper'>
|
<div className='account__wrapper'>
|
||||||
<Permalink key={account.get('id')} className='account__display-name' title={account.get('acct')} href={`/@${account.get('acct')}`} to={`/@${account.get('acct')}`}>
|
<Permalink key={account.get('id')} className='account__display-name' title={account.get('acct')} href={`/@${account.get('acct')}`} to={`/@${account.get('acct')}`}>
|
||||||
<div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div>
|
<div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div>
|
||||||
<DisplayName account={account} />
|
<DisplayName account={account} withDate={Boolean(withDate && withRelationship)} />
|
||||||
</Permalink>
|
</Permalink>
|
||||||
|
|
||||||
{withRelationship ? (<>
|
{withRelationship ? (<>
|
||||||
|
@ -156,8 +156,6 @@ class Account extends ImmutablePureComponent {
|
||||||
</div>
|
</div>
|
||||||
</>) : withDate && joinedAt}
|
</>) : withDate && joinedAt}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(withDate && withRelationship) && joinedAt}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import VerificationBadge from './verification_badge';
|
||||||
import { getAcct } from '../utils/accounts';
|
import { getAcct } from '../utils/accounts';
|
||||||
import { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper';
|
import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper';
|
||||||
|
import Icon from './icon';
|
||||||
|
import RelativeTimestamp from './relative_timestamp';
|
||||||
import { displayFqn } from 'soapbox/utils/state';
|
import { displayFqn } from 'soapbox/utils/state';
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
@ -22,31 +24,47 @@ class DisplayName extends React.PureComponent {
|
||||||
displayFqn: PropTypes.bool,
|
displayFqn: PropTypes.bool,
|
||||||
others: ImmutablePropTypes.list,
|
others: ImmutablePropTypes.list,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
|
withDate: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
withDate: false,
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, displayFqn, others, children } = this.props;
|
const { account, displayFqn, others, children, withDate } = this.props;
|
||||||
|
|
||||||
let displayName, suffix;
|
let displayName, suffix;
|
||||||
const verified = account.getIn(['pleroma', 'tags'], ImmutableList()).includes('verified');
|
const verified = account.getIn(['pleroma', 'tags'], ImmutableList()).includes('verified');
|
||||||
|
|
||||||
|
const createdAt = account.get('created_at');
|
||||||
|
|
||||||
|
const joinedAt = createdAt ? (
|
||||||
|
<div className='account__joined-at'>
|
||||||
|
<Icon id='calendar' />
|
||||||
|
<RelativeTimestamp timestamp={createdAt} />
|
||||||
|
</div>
|
||||||
|
) : null;
|
||||||
|
|
||||||
if (others && others.size > 1) {
|
if (others && others.size > 1) {
|
||||||
displayName = others.take(2).map(a => [
|
displayName = others.take(2).map(a => (
|
||||||
<bdi key={a.get('id')}>
|
<span className='display-name__name'>
|
||||||
<strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} />
|
<bdi key={a.get('id')}><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} /></bdi>
|
||||||
</bdi>,
|
{verified && <VerificationBadge />}
|
||||||
verified && <VerificationBadge />,
|
{withDate && joinedAt}
|
||||||
]).reduce((prev, cur) => [prev, ', ', cur]);
|
</span>
|
||||||
|
)).reduce((prev, cur) => [prev, ', ', cur]);
|
||||||
|
|
||||||
if (others.size - 2 > 0) {
|
if (others.size - 2 > 0) {
|
||||||
suffix = `+${others.size - 2}`;
|
suffix = `+${others.size - 2}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayName = (
|
displayName = (
|
||||||
<>
|
<span className='display-name__name'>
|
||||||
<bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
|
<bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
|
||||||
{verified && <VerificationBadge />}
|
{verified && <VerificationBadge />}
|
||||||
</>
|
{withDate && joinedAt}
|
||||||
|
</span>
|
||||||
);
|
);
|
||||||
suffix = <span className='display-name__account'>@{getAcct(account, displayFqn)}</span>;
|
suffix = <span className='display-name__account'>@{getAcct(account, displayFqn)}</span>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,14 @@ class UserPanel extends ImmutablePureComponent {
|
||||||
const displayNameHtml = { __html: account.get('display_name_html') };
|
const displayNameHtml = { __html: account.get('display_name_html') };
|
||||||
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
|
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
|
||||||
const verified = account.getIn(['pleroma', 'tags'], ImmutableList()).includes('verified');
|
const verified = account.getIn(['pleroma', 'tags'], ImmutableList()).includes('verified');
|
||||||
|
const header = account.get('header');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='user-panel'>
|
<div className='user-panel'>
|
||||||
<div className='user-panel__container'>
|
<div className='user-panel__container'>
|
||||||
|
|
||||||
<div className='user-panel__header'>
|
<div className='user-panel__header'>
|
||||||
<StillImage src={account.get('header')} alt='' />
|
{header && <StillImage src={account.get('header')} alt='' />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='user-panel__profile'>
|
<div className='user-panel__profile'>
|
||||||
|
|
|
@ -201,6 +201,10 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
||||||
|
.display-name__name {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,6 +506,7 @@ a .account__avatar {
|
||||||
.relationship-tag {
|
.relationship-tag {
|
||||||
color: var(--primary-text-color);
|
color: var(--primary-text-color);
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
margin-left: 4px;
|
||||||
display: block;
|
display: block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
|
@ -511,6 +516,7 @@ a .account__avatar {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -518,18 +524,14 @@ a .account__avatar {
|
||||||
}
|
}
|
||||||
|
|
||||||
.account__joined-at {
|
.account__joined-at {
|
||||||
padding: 3px 2px 0 5px;
|
padding-left: 3px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
display: flex;
|
display: flex;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: var(--primary-text-color--faint);
|
||||||
|
|
||||||
i.fa-calendar {
|
i.fa-calendar {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.account--with-date.account--with-relationship {
|
|
||||||
.account__joined-at {
|
|
||||||
padding-left: 48px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -114,7 +114,6 @@
|
||||||
|
|
||||||
strong,
|
strong,
|
||||||
span {
|
span {
|
||||||
display: inline-block;
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +129,7 @@
|
||||||
|
|
||||||
.display-name__account {
|
.display-name__account {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: -10px;
|
margin-top: -5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ a.account__display-name {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
bdi {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.display-name__html {
|
.display-name__html {
|
||||||
|
|
|
@ -675,6 +675,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
Loading…
Reference in New Issue