Experiment: new reply/thread "badges"

Also totally forced one-lined the name text + date at the top of a status
This commit is contained in:
Lim Chee Aun 2022-12-22 10:35:39 +08:00
parent 9a0f538d69
commit ade3ebb5ae
5 changed files with 75 additions and 12 deletions

View file

@ -42,6 +42,8 @@ const ICONS = {
popin: ['mingcute:external-link-line', '180deg'], popin: ['mingcute:external-link-line', '180deg'],
plus: 'mingcute:add-circle-line', plus: 'mingcute:add-circle-line',
'chevron-left': 'mingcute:left-line', 'chevron-left': 'mingcute:left-line',
reply: ['mingcute:share-forward-line', '180deg', 'horizontal'],
thread: 'mingcute:route-line',
}; };
function Icon({ icon, size = 'm', alt, title, class: className = '' }) { function Icon({ icon, size = 'm', alt, title, class: className = '' }) {
@ -49,9 +51,9 @@ function Icon({ icon, size = 'm', alt, title, class: className = '' }) {
const iconSize = SIZES[size]; const iconSize = SIZES[size];
let iconName = ICONS[icon]; let iconName = ICONS[icon];
let rotate; let rotate, flip;
if (Array.isArray(iconName)) { if (Array.isArray(iconName)) {
[iconName, rotate] = iconName; [iconName, rotate, flip] = iconName;
} }
return ( return (
<div <div
@ -70,6 +72,7 @@ function Icon({ icon, size = 'm', alt, title, class: className = '' }) {
height={iconSize} height={iconSize}
icon={iconName} icon={iconName}
rotate={rotate} rotate={rotate}
flip={flip}
> >
{alt} {alt}
</iconify-icon> </iconify-icon>

View file

@ -104,6 +104,12 @@
display: flex; display: flex;
gap: 8px; gap: 8px;
justify-content: space-between; justify-content: space-between;
white-space: nowrap;
}
.status > .container > .meta > * {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
} }
.status.large > .container > .meta { .status.large > .container > .meta {
min-height: 50px; min-height: 50px;
@ -129,6 +135,39 @@
font-size: smaller; font-size: smaller;
} }
.status-reply-badge {
display: inline-flex;
margin-left: 4px;
gap: 4px;
align-items: center;
}
.status-reply-badge .icon {
color: var(--reply-to-color);
}
.status-thread-badge {
display: inline-flex;
margin: 8px 0 0 0;
gap: 4px;
align-items: center;
color: var(--reply-to-color);
background: var(--bg-color);
border: 1px solid var(--reply-to-color);
border-radius: 4px;
padding: 4px;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
opacity: 0.75;
background-image: repeating-linear-gradient(
-70deg,
transparent,
transparent 3px,
var(--reply-to-faded-color) 3px,
var(--reply-to-faded-color) 4px
);
font-weight: bold;
}
.status.large .content-container { .status.large .content-container {
margin-left: calc(-50px - 16px); margin-left: calc(-50px - 16px);
padding-top: 10px; padding-top: 10px;

View file

@ -220,13 +220,13 @@ function Status({
)} )}
<div class="container"> <div class="container">
<div class="meta"> <div class="meta">
<span> {/* <span> */}
<NameText <NameText
account={status.account} account={status.account}
showAvatar={size === 's'} showAvatar={size === 's'}
showAcct={size === 'l'} showAcct={size === 'l'}
/> />
{inReplyToAccount && !withinContext && size !== 's' && ( {/* {inReplyToAccount && !withinContext && size !== 's' && (
<> <>
{' '} {' '}
<span class="ib"> <span class="ib">
@ -234,8 +234,8 @@ function Status({
<NameText account={inReplyToAccount} short /> <NameText account={inReplyToAccount} short />
</span> </span>
</> </>
)} )} */}
</span>{' '} {/* </span> */}{' '}
{size !== 'l' && {size !== 'l' &&
(uri ? ( (uri ? (
<a href={uri} target="_blank" class="time"> <a href={uri} target="_blank" class="time">
@ -271,6 +271,25 @@ function Status({
</span> </span>
))} ))}
</div> </div>
{inReplyToAccount && !withinContext && size !== 's' && (
<div
class={`status-${
inReplyToAccountId === status.account.id ? 'thread' : 'reply'
}-badge`}
>
{inReplyToAccountId === status.account.id ? (
<>
<Icon icon="thread" size="s" />
Thread
</>
) : (
<>
<Icon icon="reply" />{' '}
<NameText account={inReplyToAccount} short />
</>
)}
</div>
)}
<div <div
class={`content-container ${ class={`content-container ${
sensitive || spoilerText ? 'has-spoiler' : '' sensitive || spoilerText ? 'has-spoiler' : ''

View file

@ -2,7 +2,7 @@
--blue-color: royalblue; --blue-color: royalblue;
--purple-color: blueviolet; --purple-color: blueviolet;
--green-color: green; --green-color: green;
--orange-color: orange; --orange-color: darkorange;
--red-color: orangered; --red-color: orangered;
--bg-color: #fff; --bg-color: #fff;
--bg-faded-color: #f0f2f5; --bg-faded-color: #f0f2f5;
@ -39,6 +39,7 @@
--blue-color: CornflowerBlue; --blue-color: CornflowerBlue;
--purple-color: mediumpurple; --purple-color: mediumpurple;
--green-color: limegreen; --green-color: limegreen;
--orange-color: orange;
--bg-color: #242526; --bg-color: #242526;
--bg-faded-color: #18191a; --bg-faded-color: #18191a;
--bg-blur-color: #0009; --bg-blur-color: #0009;

View file

@ -58,6 +58,7 @@
.notification-content { .notification-content {
flex-grow: 1; flex-grow: 1;
min-width: 0;
} }
.notification-content p:first-child { .notification-content p:first-child {
margin-top: 0; margin-top: 0;