mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-18 02:47:03 -04:00
Add customUserColors (#150)
* add preferFriends to showMeYourName * Add customUserColors * pressing enter closes modal * please update your discord types package * sowwy.. * Do A Settings Check For Typing Tweaks * Do a proper import on rolecoloreverywhere --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
f385879b4b
commit
7ca3bbb8e6
5 changed files with 244 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { makeRange } from "@components/PluginSettings/components";
|
||||
import { Devs } from "@utils/constants";
|
||||
|
@ -24,6 +24,7 @@ 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"');
|
||||
|
||||
|
@ -164,6 +165,9 @@ export default definePlugin({
|
|||
|
||||
getColorString(userId: string, channelOrGuildId: string) {
|
||||
try {
|
||||
if (Settings.plugins.customUserColors.enabled)
|
||||
return getCustomColorString(userId, true);
|
||||
|
||||
const guildId = ChannelStore.getChannel(channelOrGuildId)?.guild_id ?? GuildStore.getGuild(channelOrGuildId)?.id;
|
||||
if (guildId == null) return null;
|
||||
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
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({
|
||||
|
@ -57,6 +58,12 @@ interface Props {
|
|||
guildId: 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;
|
||||
}
|
||||
|
||||
const TypingUser = ErrorBoundary.wrap(function ({ user, guildId }: Props) {
|
||||
return (
|
||||
<strong
|
||||
|
@ -68,7 +75,7 @@ const TypingUser = ErrorBoundary.wrap(function ({ user, guildId }: Props) {
|
|||
display: "grid",
|
||||
gridAutoFlow: "column",
|
||||
gap: "4px",
|
||||
color: settings.store.showRoleColors ? GuildMemberStore.getMember(guildId, user.id)?.colorString : undefined,
|
||||
color: typingUserColor(guildId, user.id),
|
||||
cursor: "pointer"
|
||||
}}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue