GitHubRepos Stuff
Some checks are pending
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-03-18 21:27:48 -04:00
parent 178062ac41
commit f2462a9baa
No known key found for this signature in database
9 changed files with 77 additions and 38 deletions

View file

@ -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<string, string> = {
"JavaScript": "#f1e05a",

View file

@ -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";

View file

@ -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");

View file

@ -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[];

View file

@ -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 (

View file

@ -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 {

View file

@ -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 })"
}
}
],

View file

@ -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;

View file

@ -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
},
});