Skip to content

Commit

Permalink
Change design of account rows in web UI
Browse files Browse the repository at this point in the history
Port ef127c9 to glitch-soc

Signed-off-by: Claire <[email protected]>
  • Loading branch information
Gargron authored and ClearlyClaire committed Nov 15, 2023
1 parent 331c2b6 commit 4ee2c36
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
55 changes: 47 additions & 8 deletions app/javascript/flavours/glitch/components/account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { DisplayName } from './display_name';
import { IconButton } from './icon_button';
import Permalink from './permalink';
import { RelativeTimestamp } from './relative_timestamp';

Check failure on line 15 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

There should be at least one empty line between import groups


import { counterRenderer } from 'flavours/glitch/components/common_counter';

Check failure on line 16 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

There should be at least one empty line between import groups

Check failure on line 16 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

`flavours/glitch/components/common_counter` import should occur before import of `flavours/glitch/components/skeleton`

Check failure on line 16 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

Missing file extension for "flavours/glitch/components/common_counter"

Check failure on line 16 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module 'flavours/glitch/components/common_counter'
import ShortNumber from 'flavours/glitch/components/short_number';

Check failure on line 17 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

`flavours/glitch/components/short_number` import should occur before import of `flavours/glitch/components/skeleton`
import Icon from 'flavours/glitch/components/icon';

Check failure on line 18 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

`flavours/glitch/components/icon` import should occur before import of `flavours/glitch/components/skeleton`

const messages = defineMessages({
follow: { id: 'account.follow', defaultMessage: 'Follow' },
Expand All @@ -28,6 +29,26 @@ const messages = defineMessages({
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
});

class VerifiedBadge extends React.PureComponent {

Check failure on line 32 in app/javascript/flavours/glitch/components/account.jsx

View workflow job for this annotation

GitHub Actions / lint

'React' is not defined

static propTypes = {
link: PropTypes.string.isRequired,
verifiedAt: PropTypes.string.isRequired,
};

render () {
const { link } = this.props;

return (
<span className='verified-badge'>
<Icon id='check' className='verified-badge__mark' />
<span dangerouslySetInnerHTML={{ __html: link }} />
</span>
);
}

}

class Account extends ImmutablePureComponent {

static propTypes = {
Expand Down Expand Up @@ -82,7 +103,11 @@ class Account extends ImmutablePureComponent {
<div className='account__wrapper'>
<div className='account__display-name'>
<div className='account__avatar-wrapper'><Skeleton width={36} height={36} /></div>
<DisplayName />

<div>
<DisplayName />
<Skeleton width='7ch' />
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -136,18 +161,32 @@ class Account extends ImmutablePureComponent {
}
}

let mute_expires_at;
let muteTimeRemaining;

if (account.get('mute_expires_at')) {
mute_expires_at = <div><RelativeTimestamp timestamp={account.get('mute_expires_at')} futureDate /></div>;
muteTimeRemaining = <>· <RelativeTimestamp timestamp={account.get('mute_expires_at')} futureDate /></>;
}

let verification;

const firstVerifiedField = account.get('fields').find(item => !!item.get('verified_at'));

if (firstVerifiedField) {
verification = <>· <VerifiedBadge link={firstVerifiedField.get('value')} verifiedAt={firstVerifiedField.get('verified_at')} /></>;
}

return (
<div className='account'>
<div className='account__wrapper'>
<Permalink key={account.get('id')} className='account__display-name' title={account.get('acct')} href={account.get('url')} to={`/@${account.get('acct')}`}>
<div className='account__avatar-wrapper'><Avatar account={account} size={size} /></div>
{mute_expires_at}
<DisplayName account={account} />
<div className='account__avatar-wrapper'>
<Avatar account={account} size={size} />
</div>

<div>
<DisplayName account={account} />
<ShortNumber value={account.get('followers_count')} renderer={counterRenderer('followers')} /> {verification} {muteTimeRemaining}
</div>
</Permalink>

<div className='account__relationship'>
Expand Down
23 changes: 19 additions & 4 deletions app/javascript/flavours/glitch/styles/components/accounts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
text-decoration: none;
font-size: 14px;

&--with-note {
strong {
display: inline;
}
.display-name {
margin-bottom: 4px;
}

.display-name strong {
display: inline;
}
}

Expand Down Expand Up @@ -764,6 +766,19 @@
}
}

.verified-badge {
display: inline-flex;
align-items: center;
color: $valid-value-color;
gap: 4px;

a {
color: inherit;
font-weight: 500;
text-decoration: none;
}
}

.moved-account-banner,
.follow-request-banner,
.account-memorial-banner {
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/flavours/glitch/styles/components/status.scss
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@

.status__display-name,
.account__display-name {
strong {
.display-name strong {
color: $primary-text-color;
}
}
Expand All @@ -641,12 +641,12 @@ a.status__display-name,
.reply-indicator__display-name,
.detailed-status__display-name,
.account__display-name {
&:hover strong {
&:hover .display-name strong {
text-decoration: underline;
}
}

.account__display-name strong {
.account__display-name .display-name strong {
display: block;
overflow: hidden;
text-overflow: ellipsis;
Expand Down

0 comments on commit 4ee2c36

Please sign in to comment.