Merge branch 'dev' into CopyEmojiMarkdown

This commit is contained in:
vishnyanetchereshnya 2024-06-09 20:24:59 +03:00 committed by GitHub
commit 2e454846ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 66 additions and 26 deletions

View file

@ -93,17 +93,13 @@ export default definePlugin({
{
find: ".PANEL]:14",
replacement: {
match: /(?<=\i=\(0,\i\.default\)\(\i\);)return 0===\i.length/,
replace: "$& && $self.getBadges(arguments[0]?.displayProfile).length===0"
match: /(?<=(\i)=\(0,\i\.default\)\(\i\);)return 0===\i.length\?/,
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
}
},
{
find: ".description,delay:",
replacement: [
{
match: /...(\i)\}=\(0,\i\.useUserProfileAnalyticsContext\)\(\);/,
replace: "$&arguments[0].badges?.unshift(...$self.getBadges($1));"
},
{
// alt: "", aria-hidden: false, src: originalSrc
match: /alt:" ","aria-hidden":!0,src:(?=.{0,20}(\i)\.icon)/,

View file

@ -60,6 +60,7 @@ export default definePlugin({
// FIXME: remove once change merged to stable
{
find: "Messages.ACTIVITY_SETTINGS",
noWarn: true,
replacement: {
get match() {
switch (Settings.plugins.Settings.settingsLocation) {

View file

@ -40,9 +40,16 @@ const settings = definePluginSettings({
default: true,
description: "Show role colors in the voice chat user list",
restartNeeded: true
},
reactorsList: {
type: OptionType.BOOLEAN,
default: true,
description: "Show role colors in the reactors list",
restartNeeded: true
}
});
export default definePlugin({
name: "RoleColorEverywhere",
authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN],
@ -99,6 +106,14 @@ export default definePlugin({
}
],
predicate: () => settings.store.voiceUsers,
},
{
find: ".reactorDefault",
replacement: {
match: /\.openUserContextMenu\)\((\i),(\i),\i\).{0,250}tag:"strong"/,
replace: "$&,style:{color:$self.getColor($2?.id,$1)}"
},
predicate: () => settings.store.reactorsList,
}
],
settings,

View file

@ -74,15 +74,28 @@ interface ConnectionPlatform {
icon: { lightSVG: string, darkSVG: string; };
}
const profilePopoutComponent = ErrorBoundary.wrap((props: { user: User, displayProfile; }) =>
<ConnectionsComponent id={props.user.id} theme={getProfileThemeProps(props).theme} />
const profilePopoutComponent = ErrorBoundary.wrap(
(props: { user: User; displayProfile?: any; simplified?: boolean; }) => (
<ConnectionsComponent
{...props}
id={props.user.id}
theme={getProfileThemeProps(props).theme}
/>
),
{ noop: true }
);
const profilePanelComponent = ErrorBoundary.wrap(({ id }: { id: string; }) =>
<ConnectionsComponent id={id} theme={ThemeStore.theme} />
const profilePanelComponent = ErrorBoundary.wrap(
(props: { id: string; simplified?: boolean; }) => (
<ConnectionsComponent
{...props}
theme={ThemeStore.theme}
/>
),
{ noop: true }
);
function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
function ConnectionsComponent({ id, theme, simplified }: { id: string, theme: string, simplified?: boolean; }) {
const profile = UserProfileStore.getUserProfile(id);
if (!profile)
return null;
@ -91,6 +104,19 @@ function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
if (!connections?.length)
return null;
const connectionsContainer = (
<Flex style={{
marginTop: !simplified ? "8px" : undefined,
gap: getSpacingPx(settings.store.iconSpacing),
flexWrap: "wrap"
}}>
{connections.map(connection => <CompactConnectionComponent connection={connection} theme={theme} />)}
</Flex>
);
if (simplified)
return connectionsContainer;
return (
<Section>
<Text
@ -100,13 +126,7 @@ function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
>
Connections
</Text>
<Flex style={{
marginTop: "8px",
gap: getSpacingPx(settings.store.iconSpacing),
flexWrap: "wrap"
}}>
{connections.map(connection => <CompactConnectionComponent connection={connection} theme={theme} />)}
</Flex>
{connectionsContainer}
</Section>
);
}
@ -132,7 +152,7 @@ function CompactConnectionComponent({ connection, theme }: { connection: Connect
<Tooltip
text={
<span className="vc-sc-tooltip">
{connection.name}
<span className="vc-sc-connection-name">{connection.name}</span>
{connection.verified && <VerifiedIcon />}
<TooltipIcon height={16} width={16} />
</span>
@ -188,6 +208,13 @@ export default definePlugin({
match: /\(0,\i\.jsx\)\(\i\.\i,\{\}\).{0,100}setNote:(?=.+?channelId:(\i).id)/,
replace: "$self.profilePanelComponent({ id: $1.recipients[0] }),$&"
}
},
{
find: "autoFocusNote:!0})",
replacement: {
match: /{autoFocusNote:!1}\)}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })"
}
}
],
settings,

View file

@ -9,3 +9,11 @@
gap: 0.25em;
align-items: center;
}
.vc-sc-connection-name {
word-break: break-all;
}
.vc-sc-tooltip svg {
min-width: 16px;
}

View file

@ -69,13 +69,6 @@ export default definePlugin({
}
]
},
{
find: "=!1,canUsePremiumCustomization:",
replacement: {
match: /(\i)\.premiumType/,
replace: "$self.patchPremiumType($1)||$&"
}
},
{
find: "BannerLoadingStatus:function",
replacement: {