diff --git a/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx b/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx index c5db1157..1c424ee2 100644 --- a/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx +++ b/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx @@ -32,36 +32,40 @@ async function downloadTheme(themesDir: string, theme: Theme) { } export const ThemeInfoModal: React.FC = ({ author, theme, ...props }) => { - const content = window.atob(theme.content); - const metadata = content.match(/\/\*\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g)?.[0] || ""; + const { type, content, likes, guild, tags } = theme; + + const themeContent = window.atob(content); + const metadata = themeContent.match(/\/\*\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g)?.[0] || ""; const donate = metadata.match(/@donate\s+(.+)/)?.[1] || ""; const version = metadata.match(/@version\s+(.+)/)?.[1] || ""; - const { likes, guild, tags } = theme; + + const authors = Array.isArray(author) ? author : [author]; return ( - Theme Details + {type} Details - Author + {authors.length > 1 ? "Authors" : "Author"}
- - - {author.username} + + {authors.map(author => author.username).join(", ")}
{version && ( @@ -74,7 +78,7 @@ export const ThemeInfoModal: React.FC = ({ author, theme, . )} Likes - {likes === 0 ? `Nobody liked this ${theme.type} yet.` : `${likes} users liked this ${theme.type}!`} + {likes === 0 ? `Nobody liked this ${type} yet.` : `${likes} users liked this ${type}!`} {donate && ( <> @@ -122,7 +126,7 @@ export const ThemeInfoModal: React.FC = ({ author, theme, . - + @@ -135,7 +139,7 @@ export const ThemeInfoModal: React.FC = ({ author, theme, . diff --git a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx index 3feb3b2d..310faf65 100644 --- a/src/equicordplugins/themeLibrary/components/ThemeTab.tsx +++ b/src/equicordplugins/themeLibrary/components/ThemeTab.tsx @@ -18,7 +18,7 @@ import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; import { classes } from "@utils/misc"; import { openModal } from "@utils/modal"; -import { findByPropsLazy, findLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { Button, Card, FluxDispatcher, Forms, React, SearchableSelect, TabBar, TextArea, TextInput, Toasts, useEffect, UserStore, UserUtils, useState } from "@webpack/common"; import { User } from "discord-types/general"; import { Constructor } from "type-fest"; @@ -30,7 +30,6 @@ import { ThemeInfoModal } from "./ThemeInfoModal"; const InputStyles = findByPropsLazy("inputDefault", "inputWrapper", "error"); const UserRecord: Constructor> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any; -const TextAreaProps = findLazy(m => typeof m.textarea === "string"); const API_URL = "https://themes-delta.vercel.app/api"; @@ -124,7 +123,7 @@ function ThemeTab() { return ( theme.name.toLowerCase().includes(v) || theme.description.toLowerCase().includes(v) || - theme.author.discord_name.toLowerCase().includes(v) || + (Array.isArray(theme.author) ? theme.author.some(author => author.discord_name.toLowerCase().includes(v)) : theme.author.discord_name.toLowerCase().includes(v)) || tags.has(v) ); }; @@ -281,8 +280,11 @@ function ThemeTab() { )}