Fix MoreUserTags Settings
Some checks are pending
Release / Build Equicord (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-05-04 00:21:12 -04:00
parent a0dfaf056a
commit d2a0324647
No known key found for this signature in database
3 changed files with 67 additions and 49 deletions

View file

@ -179,20 +179,18 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
} }
} }
function renderMoreUsers(_label: string, count: number) { function renderMoreUsers(_label: string) {
const sliceCount = plugin.authors.length - count; const remainingAuthors = plugin.authors.slice(6);
const sliceStart = plugin.authors.length - sliceCount;
const sliceEnd = sliceStart + plugin.authors.length - count;
return ( return (
<Tooltip text={plugin.authors.slice(sliceStart, sliceEnd).map(u => u.name).join(", ")}> <Tooltip text={remainingAuthors.map(u => u.name).join(", ")}>
{({ onMouseEnter, onMouseLeave }) => ( {({ onMouseEnter, onMouseLeave }) => (
<div <div
className={AvatarStyles.moreUsers} className={AvatarStyles.moreUsers}
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
> >
+{sliceCount} +{remainingAuthors.length}
</div> </div>
)} )}
</Tooltip> </Tooltip>
@ -252,7 +250,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
renderIcon={false} renderIcon={false}
showDefaultAvatarsForNullUsers showDefaultAvatarsForNullUsers
showUserPopout showUserPopout
renderMoreUsers={plugin.authors.length > 6 ? renderMoreUsers : undefined} renderMoreUsers={renderMoreUsers}
renderUser={(user: User) => ( renderUser={(user: User) => (
<Clickable <Clickable
className={AvatarStyles.clickableAvatar} className={AvatarStyles.clickableAvatar}

View file

@ -18,8 +18,22 @@ function SettingsComponent() {
return ( return (
<Flex flexDirection="column"> <Flex flexDirection="column">
<div
style={{
display: "flex",
flexWrap: "wrap",
gap: "16px",
}}
>
{tags.map(t => ( {tags.map(t => (
<Card key={t.name} style={{ padding: "1em 1em 0" }}> <Card
key={t.name}
style={{
padding: "1em 1em 0",
width: "calc(33.333% - 11px)",
boxSizing: "border-box",
}}
>
<Forms.FormTitle style={{ width: "fit-content" }}> <Forms.FormTitle style={{ width: "fit-content" }}>
<Tooltip text={t.description}> <Tooltip text={t.description}>
{({ onMouseEnter, onMouseLeave }) => ( {({ onMouseEnter, onMouseLeave }) => (
@ -27,12 +41,19 @@ function SettingsComponent() {
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
> >
{t.displayName} Tag <Tag type={localTags[t.name]}></Tag> {t.displayName} Tag
</div> </div>
)} )}
</Tooltip> </Tooltip>
</Forms.FormTitle> </Forms.FormTitle>
<div style={{ marginBottom: "10px" }}>
<Forms.FormText style={{ fontSize: "13px" }}>
Example:
</Forms.FormText>
<Tag type={localTags[t.name]} />
</div>
<TextInput <TextInput
type="text" type="text"
value={tagSettings[t.name]?.text ?? t.displayName} value={tagSettings[t.name]?.text ?? t.displayName}
@ -58,6 +79,7 @@ function SettingsComponent() {
</Switch> </Switch>
</Card> </Card>
))} ))}
</div>
</Flex> </Flex>
); );
} }

View file

@ -44,11 +44,9 @@ export default ErrorBoundary.wrap(function NotificationComponent({
let renderBody: boolean = true; let renderBody: boolean = true;
let footer: boolean = false; let footer: boolean = false;
if (attachments > 0) if (attachments > 0) footer = true;
footer = true;
if (body === "") if (body === "") renderBody = false;
renderBody = false;
// Precompute appearance settings. // Precompute appearance settings.
const AppearanceSettings = { const AppearanceSettings = {