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