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-");
|
const cl = classNameFactory("vc-customColors-");
|
||||||
|
|
||||||
export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) {
|
export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) {
|
||||||
|
|
||||||
const userColor = colors[userId];
|
|
||||||
|
|
||||||
const initialColor = parseInt(colors[userId], 16) || 372735;
|
const initialColor = parseInt(colors[userId], 16) || 372735;
|
||||||
// color picker default to current color set for user (if null it's 0x05afff :3 )
|
// color picker default to current color set for user (if null it's 0x05afff :3 )
|
||||||
|
|
||||||
|
@ -57,39 +54,39 @@ export function SetColorModal({ userId, modalProps }: { userId: string, modalPro
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalRoot {...modalProps}>
|
<ModalRoot {...modalProps}>
|
||||||
<ModalHeader className={cl("modal-header")}>
|
<ModalHeader className={cl("modal-header")}>
|
||||||
<Forms.FormTitle tag="h2">
|
<Forms.FormTitle tag="h2">
|
||||||
Custom Color
|
Custom Color
|
||||||
|
</Forms.FormTitle>
|
||||||
|
<ModalCloseButton onClick={modalProps.onClose} />
|
||||||
|
</ModalHeader>
|
||||||
|
<ModalContent className={cl("modal-content")} onKeyDown={handleKey}>
|
||||||
|
<section className={Margins.bottom16}>
|
||||||
|
<Forms.FormTitle tag="h3">
|
||||||
|
Pick a color
|
||||||
</Forms.FormTitle>
|
</Forms.FormTitle>
|
||||||
<ModalCloseButton onClick={modalProps.onClose} />
|
<ColorPicker
|
||||||
</ModalHeader>
|
color={colorPickerColor}
|
||||||
<ModalContent className={cl("modal-content")} onKeyDown={handleKey}>
|
onChange={setUserColor}
|
||||||
<section className={Margins.bottom16}>
|
showEyeDropper={false}
|
||||||
<Forms.FormTitle tag="h3">
|
/>
|
||||||
Pick a color
|
</section>
|
||||||
</Forms.FormTitle>
|
</ModalContent>
|
||||||
<ColorPicker
|
|
||||||
color={colorPickerColor}
|
|
||||||
onChange={setUserColor}
|
|
||||||
showEyeDropper={false}
|
|
||||||
/>
|
|
||||||
</section>
|
|
||||||
</ModalContent>
|
|
||||||
|
|
||||||
<ModalFooter className={cl("modal-footer")}>
|
<ModalFooter className={cl("modal-footer")}>
|
||||||
<Button
|
<Button
|
||||||
color={Button.Colors.RED}
|
color={Button.Colors.RED}
|
||||||
onClick={deleteUserColor}
|
onClick={deleteUserColor}
|
||||||
>
|
>
|
||||||
Delete Entry
|
Delete Entry
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
color={Button.Colors.BRAND}
|
color={Button.Colors.BRAND}
|
||||||
onClick={saveUserColor}
|
onClick={saveUserColor}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalRoot>
|
</ModalRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,19 +13,21 @@ import { EquicordDevs } from "@utils/constants";
|
||||||
import { openModal } from "@utils/modal";
|
import { openModal } from "@utils/modal";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { extractAndLoadChunksLazy } from "@webpack";
|
import { extractAndLoadChunksLazy } from "@webpack";
|
||||||
import { Menu, UserStore } from "@webpack/common";
|
import { Menu } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
import { SetColorModal } from "./SetColorModal";
|
import { SetColorModal } from "./SetColorModal";
|
||||||
|
|
||||||
export const DATASTORE_KEY = "equicord-customcolors";
|
export const DATASTORE_KEY = "equicord-customcolors";
|
||||||
export let colors: Record<string, string> = {};
|
export let colors: Record<string, string> = {};
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
colors = await get<Record<string, string>>(DATASTORE_KEY) || {};
|
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!!)
|
// 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; }) => {
|
const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: { user: User; }) => {
|
||||||
if (user?.id == null) return;
|
if (user?.id == null) return;
|
||||||
|
|
||||||
|
@ -96,15 +98,11 @@ export default definePlugin({
|
||||||
],
|
],
|
||||||
|
|
||||||
colorDMList(a: any): string | undefined {
|
colorDMList(a: any): string | undefined {
|
||||||
try {
|
const userId = a?.subText?.props?.user?.id;
|
||||||
// @ts-ignore
|
if (!userId) return;
|
||||||
const { id } = UserStore.findByTag(a.avatar.props["aria-label"]);
|
const colorString = getCustomColorString(userId, true);
|
||||||
// get user id by props on avatars having username as aria label
|
if (colorString) return colorString;
|
||||||
const colorString = getCustomColorString(id, true);
|
return "inherit";
|
||||||
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 {
|
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 { EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin, { ReporterTestable } from "@utils/types";
|
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; };
|
type ExtUpload = Upload & { fixExtension?: boolean; };
|
||||||
|
|
||||||
|
|
|
@ -797,5 +797,5 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
startAt: StartAt.DOMContentLoaded,
|
startAt: StartAt.DOMContentLoaded,
|
||||||
// preview thing, kinda low effort but eh
|
// 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)"
|
color: "var(--text-normal)"
|
||||||
}}>
|
}}>
|
||||||
<p> This tab was replaced in favour of the new website: </p>
|
<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={{
|
<p style={{
|
||||||
fontSize: ".75em",
|
fontSize: ".75em",
|
||||||
color: "var(--text-muted)"
|
color: "var(--text-muted)"
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
import { Upload } from "@api/MessageEvents";
|
import { Upload } from "@api/MessageEvents";
|
||||||
import { definePluginSettings, Settings } from "@api/Settings";
|
import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { reverseExtensionMap } from "@equicordplugins/fixFileExtensions";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||||
|
|
||||||
import { reverseExtensionMap } from "../../equicordplugins/fixFileExtensions/components";
|
|
||||||
|
|
||||||
type AnonUpload = Upload & { anonymise?: boolean; };
|
type AnonUpload = Upload & { anonymise?: boolean; };
|
||||||
|
|
||||||
const ActionBarIcon = findByCodeLazy(".actionBarIcon)");
|
const ActionBarIcon = findByCodeLazy(".actionBarIcon)");
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
import { definePluginSettings, Settings } from "@api/Settings";
|
import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { makeRange } from "@components/PluginSettings/components";
|
import { makeRange } from "@components/PluginSettings/components";
|
||||||
|
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy } from "@webpack";
|
import { findByCodeLazy } from "@webpack";
|
||||||
import { ChannelStore, GuildMemberStore, GuildStore } from "@webpack/common";
|
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"');
|
const useMessageAuthor = findByCodeLazy('"Result cannot be null because the message is not null"');
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
|
|
||||||
import { definePluginSettings, Settings } from "@api/Settings";
|
import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { openUserProfile } from "@utils/discord";
|
import { openUserProfile } from "@utils/discord";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
import { getCustomColorString } from "@equicordplugins/customUserColors";
|
|
||||||
import { PropsWithChildren } from "react";
|
import { PropsWithChildren } from "react";
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
|
@ -58,7 +58,7 @@ interface Props {
|
||||||
guildId: string;
|
guildId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TypingUserColor(guildId: string, userId: string) {
|
function typingUserColor(guildId: string, userId: string) {
|
||||||
if (!settings.store.showRoleColors) return;
|
if (!settings.store.showRoleColors) return;
|
||||||
if (Settings.plugins.customUserColors.enabled) return getCustomColorString(userId, true);
|
if (Settings.plugins.customUserColors.enabled) return getCustomColorString(userId, true);
|
||||||
return GuildMemberStore.getMember(guildId, userId)?.colorString;
|
return GuildMemberStore.getMember(guildId, userId)?.colorString;
|
||||||
|
|
Loading…
Add table
Reference in a new issue