From 674a441cc2943210b857a9f1628d3c00620a4177 Mon Sep 17 00:00:00 2001 From: DaBluLite Date: Mon, 29 Apr 2024 09:29:33 +0300 Subject: [PATCH] DiscordColorways v5.6.5.1, Info modal bugfix --- DiscordColorways.plugin.js | 26 +++++++++---------- .../discordColorways/components/InfoModal.tsx | 15 ++--------- VencordUserPlugin/discordColorways/index.tsx | 5 ++-- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/DiscordColorways.plugin.js b/DiscordColorways.plugin.js index 5d4c75e..b0fc8f2 100644 --- a/DiscordColorways.plugin.js +++ b/DiscordColorways.plugin.js @@ -2,7 +2,7 @@ * @name DiscordColorways * @author DaBluLite * @description A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways - * @version 5.6.5 + * @version 5.6.5.1 * @authorId 582170007505731594 * @invite ZfPH6SDkMW */ @@ -301,6 +301,15 @@ function HexToHSL(H) { l = +(l * 100).toFixed(1); return [Math.round(h), Math.round(s), Math.round(l)]; } +const stringToHex = (str) => { + let hex = ""; + for (let i = 0; i < str.length; i++) { + const charCode = str.charCodeAt(i); + const hexValue = charCode.toString(16); + hex += hexValue.padStart(2, "0"); + } + return hex; +}; const hexToString = (hex) => { let str = ""; for (let i = 0; i < hex.length; i += 2) { @@ -838,7 +847,7 @@ const mainColors = [ const name = "DiscordColorways"; const author = "DaBluLite"; const description = "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways"; -const version = "5.6.5"; +const version = "5.6.5.1"; const authorId = "582170007505731594"; const invite = "ZfPH6SDkMW"; const creatorVersion = "1.19"; @@ -2684,7 +2693,7 @@ function ColorwayInfoModal({ color: Button.Colors.PRIMARY, size: Button.Sizes.MEDIUM, look: Button.Looks.OUTLINED, - style: { flex: "0 0 auto" }, + style: { flex: "0 0 auto", maxWidth: "236px" }, onClick: () => { openUserProfile(colorwayProps.authorID); } @@ -2699,15 +2708,6 @@ function ColorwayInfoModal({ look: Button.Looks.OUTLINED, style: { flex: "0 0 auto" }, onClick: () => { - const stringToHex = (str) => { - let hex = ""; - for (let i = 0; i < str.length; i++) { - const charCode = str.charCodeAt(i); - const hexValue = charCode.toString(16); - hex += hexValue.padStart(2, "0"); - } - return hex; - }; const colorwayIDArray = `${colorwayProps.accent},${colorwayProps.primary},${colorwayProps.secondary},${colorwayProps.tertiary}`; const colorwayID = stringToHex(colorwayIDArray); Clipboard.copy(colorwayID); @@ -2746,7 +2746,7 @@ function ColorwayInfoModal({ }); } }, - "Delete..." + "Delete" ))), BdApi.React.createElement("div", { className: "colorwayInfo-row colorwayInfo-css" + (collapsedCSS ? " colorwaysCreator-settingCat-collapsed" : "") }, BdApi.React.createElement(Flex, { style: { gap: "10px", width: "100%", alignItems: "center" } }, BdApi.React.createElement(Forms.FormTitle, { style: { marginBottom: 0, width: "100%" } }, "CSS:"), BdApi.React.createElement( Button, { diff --git a/VencordUserPlugin/discordColorways/components/InfoModal.tsx b/VencordUserPlugin/discordColorways/components/InfoModal.tsx index f333650..72dd71a 100644 --- a/VencordUserPlugin/discordColorways/components/InfoModal.tsx +++ b/VencordUserPlugin/discordColorways/components/InfoModal.tsx @@ -19,7 +19,7 @@ import { Button, Clipboard, Forms, Text, Toasts, useState } from "@webpack/commo import { ColorwayCSS } from ".."; import { generateCss, pureGradientBase } from "../css"; import { Colorway } from "../types"; -import { colorToHex } from "../utils"; +import { colorToHex, stringToHex } from "../utils"; import ThemePreviewCategory from "./ThemePreview"; export default function ({ @@ -70,7 +70,7 @@ export default function ({ color={Button.Colors.PRIMARY} size={Button.Sizes.MEDIUM} look={Button.Looks.OUTLINED} - style={{ flex: "0 0 auto" }} + style={{ flex: "0 0 auto", maxWidth: "236px" }} onClick={() => { openUserProfile(colorwayProps.authorID); }} @@ -83,17 +83,6 @@ export default function ({ look={Button.Looks.OUTLINED} style={{ flex: "0 0 auto" }} onClick={() => { - const stringToHex = (str: string) => { - let hex = ""; - for (let i = 0; i < str.length; i++) { - const charCode = str.charCodeAt(i); - const hexValue = charCode.toString(16); - - // Pad with zeros to ensure two-digit representation - hex += hexValue.padStart(2, "0"); - } - return hex; - }; const colorwayIDArray = `${colorwayProps.accent},${colorwayProps.primary},${colorwayProps.secondary},${colorwayProps.tertiary}`; const colorwayID = stringToHex(colorwayIDArray); Clipboard.copy(colorwayID); diff --git a/VencordUserPlugin/discordColorways/index.tsx b/VencordUserPlugin/discordColorways/index.tsx index 6f87b1a..5e230ee 100644 --- a/VencordUserPlugin/discordColorways/index.tsx +++ b/VencordUserPlugin/discordColorways/index.tsx @@ -85,14 +85,13 @@ export const ColorwayCSS = { }; export const versionData = { - pluginVersion: "5.6.5", + pluginVersion: "5.6.5.1", creatorVersion: "1.19", }; export default definePlugin({ name: "DiscordColorways", - description: - "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways", + description: "A plugin that offers easy access to simple color schemes/themes for Discord, also known as Colorways", authors: [{ name: "DaBluLite", id: 582170007505731594n