mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-24 00:59:09 -05:00
CustomUserColors: Remove Ignore
This commit is contained in:
parent
7ca3bbb8e6
commit
d7d9e7dca1
9 changed files with 59 additions and 72 deletions
|
@ -24,9 +24,6 @@ const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{intl::USER_SETT
|
|||
const cl = classNameFactory("vc-customColors-");
|
||||
|
||||
export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) {
|
||||
|
||||
const userColor = colors[userId];
|
||||
|
||||
const initialColor = parseInt(colors[userId], 16) || 372735;
|
||||
// color picker default to current color set for user (if null it's 0x05afff :3 )
|
||||
|
||||
|
|
|
@ -13,19 +13,21 @@ import { EquicordDevs } from "@utils/constants";
|
|||
import { openModal } from "@utils/modal";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { extractAndLoadChunksLazy } from "@webpack";
|
||||
import { Menu, UserStore } from "@webpack/common";
|
||||
import { Menu } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
|
||||
import { SetColorModal } from "./SetColorModal";
|
||||
|
||||
export const DATASTORE_KEY = "equicord-customcolors";
|
||||
export let colors: Record<string, string> = {};
|
||||
|
||||
(async () => {
|
||||
colors = await get<Record<string, string>>(DATASTORE_KEY) || {};
|
||||
})();
|
||||
|
||||
const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/);
|
||||
// needed for color picker to be available without opening settings (ty pindms!!)
|
||||
const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}(\i\.\i\("?.+?"?\).*?).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/);
|
||||
|
||||
const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: { user: User; }) => {
|
||||
if (user?.id == null) return;
|
||||
|
||||
|
@ -96,15 +98,11 @@ export default definePlugin({
|
|||
],
|
||||
|
||||
colorDMList(a: any): string | undefined {
|
||||
try {
|
||||
// @ts-ignore
|
||||
const { id } = UserStore.findByTag(a.avatar.props["aria-label"]);
|
||||
// get user id by props on avatars having username as aria label
|
||||
const colorString = getCustomColorString(id, true);
|
||||
if (colorString)
|
||||
return colorString;
|
||||
const userId = a?.subText?.props?.user?.id;
|
||||
if (!userId) return;
|
||||
const colorString = getCustomColorString(userId, true);
|
||||
if (colorString) return colorString;
|
||||
return "inherit";
|
||||
} catch { return; } // if you have a group in your dms then discord will crash on load without this
|
||||
},
|
||||
|
||||
colorIfServer(a: any): string | undefined {
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
const extensionMap = {
|
||||
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
||||
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
||||
"svg": [".svgz"],
|
||||
"mp4": [".m4v", ".m4r", ".m4p"],
|
||||
"m4a": [".m4b"],
|
||||
"mov": [".movie", ".qt"],
|
||||
};
|
||||
|
||||
export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => {
|
||||
exts.forEach(ext => acc[ext] = `.${target}`);
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
|
@ -9,7 +9,19 @@ import { Settings } from "@api/Settings";
|
|||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin, { ReporterTestable } from "@utils/types";
|
||||
|
||||
import { reverseExtensionMap } from "./components";
|
||||
const extensionMap = {
|
||||
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
||||
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
||||
"svg": [".svgz"],
|
||||
"mp4": [".m4v", ".m4r", ".m4p"],
|
||||
"m4a": [".m4b"],
|
||||
"mov": [".movie", ".qt"],
|
||||
};
|
||||
|
||||
export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => {
|
||||
exts.forEach(ext => acc[ext] = `.${target}`);
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
||||
|
||||
type ExtUpload = Upload & { fixExtension?: boolean; };
|
||||
|
||||
|
|
|
@ -797,5 +797,5 @@ export default definePlugin({
|
|||
},
|
||||
startAt: StartAt.DOMContentLoaded,
|
||||
// preview thing, kinda low effort but eh
|
||||
settingsAboutComponent: () => <img src="https://cdn.nest.rip/uploads/97fdf6c1-764c-4445-9422-d3d52af7434c.webp" style={{ width: "568px", borderRadius: "30px" }} ></img>
|
||||
settingsAboutComponent: () => <img src="https://cdn.nest.rip/uploads/97fdf6c1-764c-4445-9422-d3d52af7434c.webp" style={{ width: "568px", borderRadius: "30px" }} alt=""></img>
|
||||
});
|
||||
|
|
|
@ -275,7 +275,7 @@ function SubmitThemes() {
|
|||
color: "var(--text-normal)"
|
||||
}}>
|
||||
<p> This tab was replaced in favour of the new website: </p>
|
||||
<p><a href="https://discord-themes.com" target="_blank">discord-themes.com</a></p>
|
||||
<p><a href="https://discord-themes.com" target="_blank" rel="noreferrer">discord-themes.com</a></p>
|
||||
<p style={{
|
||||
fontSize: ".75em",
|
||||
color: "var(--text-muted)"
|
||||
|
|
|
@ -19,12 +19,11 @@
|
|||
import { Upload } from "@api/MessageEvents";
|
||||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { reverseExtensionMap } from "@equicordplugins/fixFileExtensions";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||
|
||||
import { reverseExtensionMap } from "../../equicordplugins/fixFileExtensions/components";
|
||||
|
||||
type AnonUpload = Upload & { anonymise?: boolean; };
|
||||
|
||||
const ActionBarIcon = findByCodeLazy(".actionBarIcon)");
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { makeRange } from "@components/PluginSettings/components";
|
||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByCodeLazy } from "@webpack";
|
||||
import { ChannelStore, GuildMemberStore, GuildStore } from "@webpack/common";
|
||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||
|
||||
const useMessageAuthor = findByCodeLazy('"Result cannot be null because the message is not null"');
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { openUserProfile } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||
import { PropsWithChildren } from "react";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
|
@ -58,7 +58,7 @@ interface Props {
|
|||
guildId: string;
|
||||
}
|
||||
|
||||
function TypingUserColor(guildId: string, userId: string) {
|
||||
function typingUserColor(guildId: string, userId: string) {
|
||||
if (!settings.store.showRoleColors) return;
|
||||
if (Settings.plugins.customUserColors.enabled) return getCustomColorString(userId, true);
|
||||
return GuildMemberStore.getMember(guildId, userId)?.colorString;
|
||||
|
|
Loading…
Add table
Reference in a new issue