mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-11 15:43:02 -04:00
GitHubRepos Stuff
This commit is contained in:
parent
178062ac41
commit
f2462a9baa
9 changed files with 77 additions and 38 deletions
|
@ -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 {
|
export function getLanguageColor(language: string): string {
|
||||||
const colors: Record<string, string> = {
|
const colors: Record<string, string> = {
|
||||||
"JavaScript": "#f1e05a",
|
"JavaScript": "#f1e05a",
|
|
@ -8,9 +8,9 @@ import { Flex } from "@components/Flex";
|
||||||
import { openModal } from "@utils/modal";
|
import { openModal } from "@utils/modal";
|
||||||
import { React, useEffect, UserProfileStore, useState } from "@webpack/common";
|
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 { GitHubRepo } from "../types";
|
||||||
import { settings } from "../utils/settings";
|
|
||||||
import { RepoCard } from "./RepoCard";
|
import { RepoCard } from "./RepoCard";
|
||||||
import { ReposModal } from "./ReposModal";
|
import { ReposModal } from "./ReposModal";
|
||||||
|
|
||||||
|
|
|
@ -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 { Flex } from "@components/Flex";
|
||||||
import { React } from "@webpack/common";
|
import { React } from "@webpack/common";
|
||||||
|
|
||||||
|
import { getLanguageColor } from "../colors";
|
||||||
import { RepoCardProps } from "../types";
|
import { RepoCardProps } from "../types";
|
||||||
import { getLanguageColor } from "../utils/colors";
|
import { Star } from "./Star";
|
||||||
import { Star } from "./icons/Star";
|
|
||||||
|
|
||||||
export function RepoCard({ repo, theme, showStars, showLanguage }: RepoCardProps) {
|
export function RepoCard({ repo, theme, showStars, showLanguage }: RepoCardProps) {
|
||||||
const handleClick = () => window.open(repo.html_url, "_blank");
|
const handleClick = () => window.open(repo.html_url, "_blank");
|
||||||
|
|
|
@ -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 { ModalContent, ModalFooter, ModalHeader, ModalRoot } from "@utils/modal";
|
||||||
import { Button, Forms, React } from "@webpack/common";
|
import { Button, Forms, React } from "@webpack/common";
|
||||||
|
|
||||||
|
import { getLanguageColor } from "../colors";
|
||||||
import { GitHubRepo } from "../types";
|
import { GitHubRepo } from "../types";
|
||||||
import { getLanguageColor } from "../utils/colors";
|
import { Star } from "./Star";
|
||||||
import { Star } from "./icons/Star";
|
|
||||||
|
|
||||||
interface ReposModalProps {
|
interface ReposModalProps {
|
||||||
repos: GitHubRepo[];
|
repos: GitHubRepo[];
|
||||||
|
|
|
@ -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 { React } from "@webpack/common";
|
||||||
import { IconProps } from "../../types";
|
|
||||||
|
import { IconProps } from "../types";
|
||||||
|
|
||||||
export function Star({ className, width = 16, height = 16 }: IconProps) {
|
export function Star({ className, width = 16, height = 16 }: IconProps) {
|
||||||
return (
|
return (
|
|
@ -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 { Logger } from "@utils/Logger";
|
||||||
|
|
||||||
|
import { GitHubRepo } from "./types";
|
||||||
|
|
||||||
const logger = new Logger("GitHubRepos");
|
const logger = new Logger("GitHubRepos");
|
||||||
|
|
||||||
export interface GitHubUserInfo {
|
export interface GitHubUserInfo {
|
|
@ -6,16 +6,35 @@
|
||||||
|
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy } from "@webpack";
|
import { findByCodeLazy } from "@webpack";
|
||||||
import { React } from "@webpack/common";
|
import { React } from "@webpack/common";
|
||||||
import { User } from "discord-types/general";
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
import { GitHubReposComponent } from "./components/GitHubReposComponent";
|
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:");
|
const getProfileThemeProps = findByCodeLazy(".getPreviewThemeColors", "primaryColor:");
|
||||||
|
|
||||||
|
@ -58,8 +77,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "action:\"PRESS_APP_CONNECTION\"",
|
find: "action:\"PRESS_APP_CONNECTION\"",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=user:(\i).{0,15}displayProfile:(\i).*?#{intl::USER_PROFILE_MEMBER_SINCE}.{0,90}\}\)\}\))/,
|
match: /(?<=user:(\i).{0,15}displayProfile:(\i).*?CONNECTIONS.{0,100}\}\)\}\))/,
|
||||||
replace: "$&,$self.ProfilePopoutComponent({ user: $1, displayProfile: $2 }),"
|
replace: ",$self.ProfilePopoutComponent({ user: $1, displayProfile: $2 })"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -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 {
|
export interface GitHubRepo {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
|
@ -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
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
Add table
Add a link
Reference in a new issue