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

View file

@ -18,46 +18,68 @@ function SettingsComponent() {
return (
<Flex flexDirection="column">
{tags.map(t => (
<Card key={t.name} style={{ padding: "1em 1em 0" }}>
<Forms.FormTitle style={{ width: "fit-content" }}>
<Tooltip text={t.description}>
{({ onMouseEnter, onMouseLeave }) => (
<div
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
{t.displayName} Tag <Tag type={localTags[t.name]}></Tag>
</div>
)}
</Tooltip>
</Forms.FormTitle>
<TextInput
type="text"
value={tagSettings[t.name]?.text ?? t.displayName}
placeholder={`Text on tag (default: ${t.displayName})`}
onChange={v => tagSettings[t.name].text = v}
className={Margins.bottom16}
/>
<Switch
value={tagSettings[t.name]?.showInChat ?? true}
onChange={v => tagSettings[t.name].showInChat = v}
hideBorder
<div
style={{
display: "flex",
flexWrap: "wrap",
gap: "16px",
}}
>
{tags.map(t => (
<Card
key={t.name}
style={{
padding: "1em 1em 0",
width: "calc(33.333% - 11px)",
boxSizing: "border-box",
}}
>
Show in messages
</Switch>
<Forms.FormTitle style={{ width: "fit-content" }}>
<Tooltip text={t.description}>
{({ onMouseEnter, onMouseLeave }) => (
<div
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
{t.displayName} Tag
</div>
)}
</Tooltip>
</Forms.FormTitle>
<Switch
value={tagSettings[t.name]?.showInNotChat ?? true}
onChange={v => tagSettings[t.name].showInNotChat = v}
hideBorder
>
Show in member list and profiles
</Switch>
</Card>
))}
<div style={{ marginBottom: "10px" }}>
<Forms.FormText style={{ fontSize: "13px" }}>
Example:
</Forms.FormText>
<Tag type={localTags[t.name]} />
</div>
<TextInput
type="text"
value={tagSettings[t.name]?.text ?? t.displayName}
placeholder={`Text on tag (default: ${t.displayName})`}
onChange={v => tagSettings[t.name].text = v}
className={Margins.bottom16}
/>
<Switch
value={tagSettings[t.name]?.showInChat ?? true}
onChange={v => tagSettings[t.name].showInChat = v}
hideBorder
>
Show in messages
</Switch>
<Switch
value={tagSettings[t.name]?.showInNotChat ?? true}
onChange={v => tagSettings[t.name].showInNotChat = v}
hideBorder
>
Show in member list and profiles
</Switch>
</Card>
))}
</div>
</Flex>
);
}

View file

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