mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
Bot avatars will be squircles
This commit is contained in:
parent
6f8ddf4dfe
commit
13b2273022
11 changed files with 23 additions and 9 deletions
|
@ -44,6 +44,7 @@ function AccountBlock({
|
||||||
url,
|
url,
|
||||||
statusesCount,
|
statusesCount,
|
||||||
lastStatusAt,
|
lastStatusAt,
|
||||||
|
bot,
|
||||||
} = account;
|
} = account;
|
||||||
const displayNameWithEmoji = emojifyText(displayName, emojis);
|
const displayNameWithEmoji = emojifyText(displayName, emojis);
|
||||||
const [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct];
|
const [_, acct1, acct2] = acct.match(/([^@]+)(@.+)/i) || [, acct];
|
||||||
|
@ -68,7 +69,7 @@ function AccountBlock({
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Avatar url={avatar} size={avatarSize} />
|
<Avatar url={avatar} size={avatarSize} squircle={bot} />
|
||||||
<span>
|
<span>
|
||||||
{displayName ? (
|
{displayName ? (
|
||||||
<b
|
<b
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
drop-shadow(2px 0 4px var(--header-color-4, --bg-color));
|
drop-shadow(2px 0 4px var(--header-color-4, --bg-color));
|
||||||
}
|
}
|
||||||
.account-container header .avatar:not(.has-alpha) img {
|
.account-container header .avatar:not(.has-alpha) img {
|
||||||
border-radius: 50%;
|
border-radius: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-container main > *:first-child {
|
.account-container main > *:first-child {
|
||||||
|
|
|
@ -507,6 +507,7 @@ function RelatedActions({ info, instance, authenticated }) {
|
||||||
url={follower.avatarStatic}
|
url={follower.avatarStatic}
|
||||||
size="l"
|
size="l"
|
||||||
alt={`${follower.displayName} @${follower.acct}`}
|
alt={`${follower.displayName} @${follower.acct}`}
|
||||||
|
squircle={follower?.bot}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
.avatar.has-alpha {
|
.avatar.has-alpha {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
.avatar:not(.has-alpha).squircle {
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.avatar img {
|
.avatar img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -13,14 +13,16 @@ const SIZES = {
|
||||||
|
|
||||||
const alphaCache = {};
|
const alphaCache = {};
|
||||||
|
|
||||||
function Avatar({ url, size, alt = '', ...props }) {
|
function Avatar({ url, size, alt = '', squircle, ...props }) {
|
||||||
size = SIZES[size] || size || SIZES.m;
|
size = SIZES[size] || size || SIZES.m;
|
||||||
const avatarRef = useRef();
|
const avatarRef = useRef();
|
||||||
const isMissing = /missing\.png$/.test(url);
|
const isMissing = /missing\.png$/.test(url);
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
ref={avatarRef}
|
ref={avatarRef}
|
||||||
class={`avatar ${alphaCache[url] ? 'has-alpha' : ''}`}
|
class={`avatar ${squircle ? 'squircle' : ''} ${
|
||||||
|
alphaCache[url] ? 'has-alpha' : ''
|
||||||
|
}`}
|
||||||
style={{
|
style={{
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
|
|
|
@ -508,6 +508,7 @@ function Compose({
|
||||||
url={currentAccountInfo.avatarStatic}
|
url={currentAccountInfo.avatarStatic}
|
||||||
size="xl"
|
size="xl"
|
||||||
alt={currentAccountInfo.username}
|
alt={currentAccountInfo.username}
|
||||||
|
squircle={currentAccountInfo?.bot}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!standalone ? (
|
{!standalone ? (
|
||||||
|
|
|
@ -67,6 +67,7 @@ function NavMenu(props) {
|
||||||
currentAccount?.info?.avatarStatic
|
currentAccount?.info?.avatarStatic
|
||||||
}
|
}
|
||||||
size="l"
|
size="l"
|
||||||
|
squircle={currentAccount?.info?.bot}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Icon icon="menu" size={moreThanOneAccount ? 's' : 'l'} />
|
<Icon icon="menu" size={moreThanOneAccount ? 's' : 'l'} />
|
||||||
|
|
|
@ -14,7 +14,8 @@ function NameText({
|
||||||
external,
|
external,
|
||||||
onClick,
|
onClick,
|
||||||
}) {
|
}) {
|
||||||
const { acct, avatar, avatarStatic, id, url, displayName, emojis } = account;
|
const { acct, avatar, avatarStatic, id, url, displayName, emojis, bot } =
|
||||||
|
account;
|
||||||
let { username } = account;
|
let { username } = account;
|
||||||
|
|
||||||
const displayNameWithEmoji = emojifyText(displayName, emojis);
|
const displayNameWithEmoji = emojifyText(displayName, emojis);
|
||||||
|
@ -52,7 +53,7 @@ function NameText({
|
||||||
>
|
>
|
||||||
{showAvatar && (
|
{showAvatar && (
|
||||||
<>
|
<>
|
||||||
<Avatar url={avatarStatic || avatar} />{' '}
|
<Avatar url={avatarStatic || avatar} squircle={bot} />{' '}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{displayName && !short ? (
|
{displayName && !short ? (
|
||||||
|
|
|
@ -118,6 +118,7 @@ function Status({
|
||||||
displayName,
|
displayName,
|
||||||
username,
|
username,
|
||||||
emojis: accountEmojis,
|
emojis: accountEmojis,
|
||||||
|
bot,
|
||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
repliesCount,
|
repliesCount,
|
||||||
|
@ -753,7 +754,7 @@ function Status({
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Avatar url={avatarStatic || avatar} size="xxl" />
|
<Avatar url={avatarStatic || avatar} size="xxl" squircle={bot} />
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -1957,7 +1958,7 @@ function safeBoundingBoxPadding() {
|
||||||
|
|
||||||
function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
|
function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
|
||||||
const {
|
const {
|
||||||
account: { avatar, avatarStatic },
|
account: { avatar, avatarStatic, bot },
|
||||||
createdAt,
|
createdAt,
|
||||||
visibility,
|
visibility,
|
||||||
reblog,
|
reblog,
|
||||||
|
@ -2002,7 +2003,7 @@ function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
|
||||||
<span>Filtered</span>
|
<span>Filtered</span>
|
||||||
<span>{filterTitleStr}</span>
|
<span>{filterTitleStr}</span>
|
||||||
</b>{' '}
|
</b>{' '}
|
||||||
<Avatar url={avatarStatic || avatar} />
|
<Avatar url={avatarStatic || avatar} squircle={bot} />
|
||||||
<span class="status-filtered-info">
|
<span class="status-filtered-info">
|
||||||
<span class="status-filtered-info-1">
|
<span class="status-filtered-info-1">
|
||||||
<NameText account={status.account} instance={instance} />{' '}
|
<NameText account={status.account} instance={instance} />{' '}
|
||||||
|
@ -2022,6 +2023,7 @@ function FilteredStatus({ status, filterInfo, instance, containerProps = {} }) {
|
||||||
<>
|
<>
|
||||||
<Avatar
|
<Avatar
|
||||||
url={reblog.account.avatarStatic || reblog.account.avatar}
|
url={reblog.account.avatarStatic || reblog.account.avatar}
|
||||||
|
squircle={bot}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -403,6 +403,7 @@ function Notification({ notification, instance }) {
|
||||||
}
|
}
|
||||||
key={account.id}
|
key={account.id}
|
||||||
alt={`${account.displayName} @${account.acct}`}
|
alt={`${account.displayName} @${account.acct}`}
|
||||||
|
squircle={account?.bot}
|
||||||
/>
|
/>
|
||||||
{type === 'favourite+reblog' && (
|
{type === 'favourite+reblog' && (
|
||||||
<div class="account-sub-icons">
|
<div class="account-sub-icons">
|
||||||
|
|
|
@ -909,6 +909,7 @@ function SubComments({
|
||||||
key={a.id}
|
key={a.id}
|
||||||
url={a.avatarStatic}
|
url={a.avatarStatic}
|
||||||
title={`${a.displayName} @${a.username}`}
|
title={`${a.displayName} @${a.username}`}
|
||||||
|
squircle={a?.bot}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue