Fix ViewIcons

This commit is contained in:
Vendicated 2023-10-25 19:08:28 +02:00
parent f385dc380e
commit 8f0009778a
No known key found for this signature in database
GPG Key ID: D66986BAF75ECF18
4 changed files with 7 additions and 8 deletions

@ -173,7 +173,7 @@ export default definePlugin({
patches: [ patches: [
// Make pfps clickable // Make pfps clickable
{ {
find: "onAddFriend:", find: "onAddFriend:function",
replacement: { replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/, match: /\{src:(\i)(?=,avatarDecoration)/,
replace: "{src:$1,onClick:()=>$self.openImage($1)" replace: "{src:$1,onClick:()=>$self.openImage($1)"
@ -191,9 +191,9 @@ export default definePlugin({
} }
}, },
{ {
find: "().avatarWrapperNonUserBot", find: ".avatarPositionPanel",
replacement: { replacement: {
match: /(?<=avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/, match: /(?<=avatarWrapperNonUserBot.{0,50})onClick:(\i\|\|\i)\?void 0(?<=,avatarSrc:(\i).+?)/,
replace: "style:($1)?{cursor:\"pointer\"}:{},onClick:$1?()=>{$self.openImage($2)}" replace: "style:($1)?{cursor:\"pointer\"}:{},onClick:$1?()=>{$self.openImage($2)}"
} }
} }

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { filters, findByCode, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; import { filters, findByProps, findByPropsLazy, mapMangledModuleLazy } from "@webpack";
import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react"; import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
import { LazyComponent } from "./react"; import { LazyComponent } from "./react";
@ -124,7 +124,7 @@ export type ImageModal = ComponentType<{
shouldHideMediaOptions?: boolean; shouldHideMediaOptions?: boolean;
}>; }>;
export const ImageModal = LazyComponent(() => findByCode(".renderLinkComponent", ".responsive") as ImageModal); export const ImageModal = LazyComponent(() => findByProps("ImageModal").ImageModal as ImageModal);
export const ModalRoot = LazyComponent(() => Modals.ModalRoot); export const ModalRoot = LazyComponent(() => Modals.ModalRoot);
export const ModalHeader = LazyComponent(() => Modals.ModalHeader); export const ModalHeader = LazyComponent(() => Modals.ModalHeader);

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy, findLazy } from "@webpack";
import * as t from "./types/classes"; import * as t from "./types/classes";
export const ModalImageClasses: t.ImageModalClasses = findByPropsLazy("image", "modal", "responsiveWidthMobile"); export const ModalImageClasses: t.ImageModalClasses = findLazy(m => m.image && m.modal && !m.applicationIcon);
export const ButtonWrapperClasses: t.ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent"); export const ButtonWrapperClasses: t.ButtonWrapperClasses = findByPropsLazy("buttonWrapper", "buttonContent");

@ -19,7 +19,6 @@
export interface ImageModalClasses { export interface ImageModalClasses {
image: string, image: string,
modal: string, modal: string,
responsiveWidthMobile: string;
} }
export interface ButtonWrapperClasses { export interface ButtonWrapperClasses {