diff --git a/src/equicordplugins/githubRepos/utils/colors.ts b/src/equicordplugins/githubRepos/colors.ts similarity index 92% rename from src/equicordplugins/githubRepos/utils/colors.ts rename to src/equicordplugins/githubRepos/colors.ts index 64da1284..e674e1d7 100644 --- a/src/equicordplugins/githubRepos/utils/colors.ts +++ b/src/equicordplugins/githubRepos/colors.ts @@ -1,3 +1,9 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + export function getLanguageColor(language: string): string { const colors: Record = { "JavaScript": "#f1e05a", @@ -58,4 +64,4 @@ export function getLanguageColor(language: string): string { }; return colors[language] || "#858585"; -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx b/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx index 8b355da4..34b40495 100644 --- a/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx +++ b/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx @@ -8,9 +8,9 @@ import { Flex } from "@components/Flex"; import { openModal } from "@utils/modal"; import { React, useEffect, UserProfileStore, useState } from "@webpack/common"; -import { fetchReposByUserId, fetchReposByUsername, fetchUserInfo, GitHubUserInfo } from "../services/githubApi"; +import { settings } from ".."; +import { fetchReposByUserId, fetchReposByUsername, fetchUserInfo, GitHubUserInfo } from "../githubApi"; import { GitHubRepo } from "../types"; -import { settings } from "../utils/settings"; import { RepoCard } from "./RepoCard"; import { ReposModal } from "./ReposModal"; diff --git a/src/equicordplugins/githubRepos/components/RepoCard.tsx b/src/equicordplugins/githubRepos/components/RepoCard.tsx index 23338cfa..aa10f24e 100644 --- a/src/equicordplugins/githubRepos/components/RepoCard.tsx +++ b/src/equicordplugins/githubRepos/components/RepoCard.tsx @@ -1,8 +1,15 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import { Flex } from "@components/Flex"; import { React } from "@webpack/common"; + +import { getLanguageColor } from "../colors"; import { RepoCardProps } from "../types"; -import { getLanguageColor } from "../utils/colors"; -import { Star } from "./icons/Star"; +import { Star } from "./Star"; export function RepoCard({ repo, theme, showStars, showLanguage }: RepoCardProps) { const handleClick = () => window.open(repo.html_url, "_blank"); @@ -48,4 +55,4 @@ export function RepoCard({ repo, theme, showStars, showLanguage }: RepoCardProps {renderLanguage()} ); -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/components/ReposModal.tsx b/src/equicordplugins/githubRepos/components/ReposModal.tsx index c3a591b1..2ff81761 100644 --- a/src/equicordplugins/githubRepos/components/ReposModal.tsx +++ b/src/equicordplugins/githubRepos/components/ReposModal.tsx @@ -1,8 +1,15 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import { ModalContent, ModalFooter, ModalHeader, ModalRoot } from "@utils/modal"; import { Button, Forms, React } from "@webpack/common"; + +import { getLanguageColor } from "../colors"; import { GitHubRepo } from "../types"; -import { getLanguageColor } from "../utils/colors"; -import { Star } from "./icons/Star"; +import { Star } from "./Star"; interface ReposModalProps { repos: GitHubRepo[]; @@ -91,4 +98,4 @@ export function ReposModal({ repos, username, rootProps }: ReposModalProps) { ); -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/components/icons/Star.tsx b/src/equicordplugins/githubRepos/components/Star.tsx similarity index 78% rename from src/equicordplugins/githubRepos/components/icons/Star.tsx rename to src/equicordplugins/githubRepos/components/Star.tsx index 6b5e87c4..4686520d 100644 --- a/src/equicordplugins/githubRepos/components/icons/Star.tsx +++ b/src/equicordplugins/githubRepos/components/Star.tsx @@ -1,5 +1,12 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import { React } from "@webpack/common"; -import { IconProps } from "../../types"; + +import { IconProps } from "../types"; export function Star({ className, width = 16, height = 16 }: IconProps) { return ( @@ -14,4 +21,4 @@ export function Star({ className, width = 16, height = 16 }: IconProps) { ); -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/services/githubApi.ts b/src/equicordplugins/githubRepos/githubApi.ts similarity index 91% rename from src/equicordplugins/githubRepos/services/githubApi.ts rename to src/equicordplugins/githubRepos/githubApi.ts index 92f3b1fc..c589de71 100644 --- a/src/equicordplugins/githubRepos/services/githubApi.ts +++ b/src/equicordplugins/githubRepos/githubApi.ts @@ -1,6 +1,13 @@ -import { GitHubRepo } from "../types"; +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import { Logger } from "@utils/Logger"; +import { GitHubRepo } from "./types"; + const logger = new Logger("GitHubRepos"); export interface GitHubUserInfo { @@ -55,4 +62,4 @@ export async function fetchReposByUsername(username: string, perPage: number = 3 function sortReposByStars(repos: GitHubRepo[]): GitHubRepo[] { return repos.sort((a, b) => b.stargazers_count - a.stargazers_count); -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/index.tsx b/src/equicordplugins/githubRepos/index.tsx index 09a93d71..1c081048 100644 --- a/src/equicordplugins/githubRepos/index.tsx +++ b/src/equicordplugins/githubRepos/index.tsx @@ -6,16 +6,35 @@ import "./styles.css"; +import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { EquicordDevs } from "@utils/constants"; import { Logger } from "@utils/Logger"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy } from "@webpack"; import { React } from "@webpack/common"; import { User } from "discord-types/general"; import { GitHubReposComponent } from "./components/GitHubReposComponent"; -import { settings } from "./utils/settings"; + +export const settings = definePluginSettings({ + showStars: { + type: OptionType.BOOLEAN, + description: "Show repository stars", + default: true + }, + showLanguage: { + type: OptionType.BOOLEAN, + description: "Show repository language", + default: true + }, + showInMiniProfile: { + type: OptionType.BOOLEAN, + description: "Only show a button in the mini profile", + default: true + }, +}); + const getProfileThemeProps = findByCodeLazy(".getPreviewThemeColors", "primaryColor:"); @@ -58,8 +77,8 @@ export default definePlugin({ { find: "action:\"PRESS_APP_CONNECTION\"", replacement: { - match: /(?<=user:(\i).{0,15}displayProfile:(\i).*?#{intl::USER_PROFILE_MEMBER_SINCE}.{0,90}\}\)\}\))/, - replace: "$&,$self.ProfilePopoutComponent({ user: $1, displayProfile: $2 })," + match: /(?<=user:(\i).{0,15}displayProfile:(\i).*?CONNECTIONS.{0,100}\}\)\}\))/, + replace: ",$self.ProfilePopoutComponent({ user: $1, displayProfile: $2 })" } } ], diff --git a/src/equicordplugins/githubRepos/types/index.ts b/src/equicordplugins/githubRepos/types.ts similarity index 74% rename from src/equicordplugins/githubRepos/types/index.ts rename to src/equicordplugins/githubRepos/types.ts index 5ccca82a..00353b1d 100644 --- a/src/equicordplugins/githubRepos/types/index.ts +++ b/src/equicordplugins/githubRepos/types.ts @@ -1,3 +1,9 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + export interface GitHubRepo { id: number; name: string; @@ -19,4 +25,4 @@ export interface RepoCardProps { theme: string; showStars: boolean; showLanguage: boolean; -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/utils/settings.ts b/src/equicordplugins/githubRepos/utils/settings.ts deleted file mode 100644 index a45bf6c2..00000000 --- a/src/equicordplugins/githubRepos/utils/settings.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { definePluginSettings } from "@api/Settings"; -import { OptionType } from "@utils/types"; - -export const settings = definePluginSettings({ - showStars: { - type: OptionType.BOOLEAN, - description: "Show repository stars", - default: true - }, - showLanguage: { - type: OptionType.BOOLEAN, - description: "Show repository language", - default: true - }, - showInMiniProfile: { - type: OptionType.BOOLEAN, - description: "Only show a button in the mini profile", - default: true - }, -});