fix various Plugins (#4237)
- FullSearchContext - CallTimer - ThemeAttributes - ShowConnections - TypingTweaks
This commit is contained in:
parent
cf8ac9122f
commit
cfaa92bc91
6 changed files with 25 additions and 17 deletions
|
|
@ -79,14 +79,21 @@ export default definePlugin({
|
|||
startTime: 0,
|
||||
interval: void 0 as NodeJS.Timeout | undefined,
|
||||
|
||||
patches: [{
|
||||
find: "renderConnectionStatus(){",
|
||||
replacement: {
|
||||
// in renderConnectionStatus()
|
||||
match: /(renderConnectionStatus\(\).{0,1000}?lineClamp:1,children:)(\i)(?=,|}\))/,
|
||||
replace: "$1[$2,$self.renderTimer({ channelId: this?.props?.channel?.id })]"
|
||||
}
|
||||
}],
|
||||
patches: [
|
||||
{
|
||||
find: "renderConnectionStatus(){",
|
||||
replacement: [
|
||||
{
|
||||
match: /(renderConnectionStatus\(\).{0,1000}?lineClamp:1,children:)(\i)(?=,|}\))/,
|
||||
replace: "$1[$2,$self.renderTimer({ channelId: this?.props?.channel?.id })]"
|
||||
},
|
||||
{
|
||||
match: /("RTCConnectionMenu".{0,200}?lineClamp:1,children:)(\i)(?=,|}\))/,
|
||||
replace: "$1[$2,$self.renderTimer({ channelId: this?.props?.channel?.id })]"
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
renderTimer: ErrorBoundary.wrap(({ channelId }: { channelId: string; }) => {
|
||||
const time = useTimer({ deps: [channelId] });
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default definePlugin({
|
|||
authors: [Devs.Ven, Devs.Aria],
|
||||
|
||||
patches: [{
|
||||
find: "onClick:this.handleMessageClick,",
|
||||
find: "Listbox navigator was given an unhandled action",
|
||||
replacement: {
|
||||
match: /this(?=\.handleContextMenu\(\i,\i\))/,
|
||||
replace: "$self"
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
// Same find as ReviewDB
|
||||
find: "#{intl::USER_PROFILE_FRIEND_REQUEST_TOAST}",
|
||||
find: '"UserProfilePopout");',
|
||||
replacement: {
|
||||
match: /userId:\i\.id,guild:\i\}\)(?=])/,
|
||||
replace: "$&,$self.profilePopoutComponent(arguments[0])"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default definePlugin({
|
|||
{
|
||||
find: ".tabBarRef",
|
||||
replacement: {
|
||||
match: /style:this\.getStyle\(\),role:"tab"/,
|
||||
match: /style:this\.getStyle\(\),role:\i/,
|
||||
replace: "$&,'data-tab-id':this?.props?.id"
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import { openUserProfile } from "@utils/discord";
|
||||
import { isNonNullish } from "@utils/guards";
|
||||
import { Logger } from "@utils/Logger";
|
||||
|
|
@ -29,6 +30,7 @@ import { PropsWithChildren } from "react";
|
|||
|
||||
import managedStyle from "./style.css?managed";
|
||||
|
||||
const cl = classNameFactory("vc-typing-tweaks-");
|
||||
const settings = definePluginSettings({
|
||||
showAvatars: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
|
@ -69,7 +71,7 @@ interface TypingUserProps {
|
|||
const TypingUser = ErrorBoundary.wrap(function TypingUser({ user, guildId }: TypingUserProps) {
|
||||
return (
|
||||
<strong
|
||||
className="vc-typing-user"
|
||||
className={cl("user")}
|
||||
role="button"
|
||||
onClick={() => {
|
||||
openUserProfile(user.id);
|
||||
|
|
@ -80,6 +82,7 @@ const TypingUser = ErrorBoundary.wrap(function TypingUser({ user, guildId }: Typ
|
|||
>
|
||||
{settings.store.showAvatars && (
|
||||
<Avatar
|
||||
className={cl("avatar")}
|
||||
size="SIZE_16"
|
||||
src={user.getAvatarURL(guildId, 128)} />
|
||||
)}
|
||||
|
|
@ -108,7 +111,7 @@ export default definePlugin({
|
|||
replacement: [
|
||||
{
|
||||
// Style the indicator and add function call to modify the children before rendering
|
||||
match: /(?<="aria-atomic":!0,children:)\i/,
|
||||
match: /(?<="aria-hidden":!0,children:)\i/,
|
||||
replace: "$self.renderTypingUsers({ users: arguments[0]?.typingUserObjects, guildId: arguments[0]?.channel?.guild_id, children: $& })"
|
||||
},
|
||||
{
|
||||
|
|
@ -151,7 +154,6 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
buildSeveralUsers,
|
||||
|
||||
renderTypingUsers: ErrorBoundary.wrap(({ guildId, users, children }: PropsWithChildren<{ guildId: string, users: User[]; }>) => {
|
||||
|
|
@ -163,8 +165,7 @@ export default definePlugin({
|
|||
let element = 0;
|
||||
|
||||
return children.map(c => {
|
||||
if (c.type !== "strong" && !(typeof c !== "string" && !React.isValidElement(c)))
|
||||
return c;
|
||||
if (c.type !== "strong" && !(typeof c !== "string" && !React.isValidElement(c))) return c;
|
||||
|
||||
const user = users[element++];
|
||||
return <TypingUser key={user.id} guildId={guildId} user={user} />;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.vc-typing-user {
|
||||
.vc-typing-tweaks-user {
|
||||
cursor: pointer;
|
||||
|
||||
[class*="wrapper"] {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue