From 35d809f93dc6c40178e51959ed319867f773ca00 Mon Sep 17 00:00:00 2001 From: creations Date: Tue, 18 Mar 2025 19:49:42 -0400 Subject: [PATCH] add option to just show a button on mini user profiles --- .../components/GitHubReposComponent.tsx | 14 ++++++++++++++ src/equicordplugins/githubRepos/styles.css | 4 +++- src/equicordplugins/githubRepos/utils/settings.ts | 9 +++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx b/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx index 6199ec22..8b355da4 100644 --- a/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx +++ b/src/equicordplugins/githubRepos/components/GitHubReposComponent.tsx @@ -19,6 +19,7 @@ export function GitHubReposComponent({ id, theme }: { id: string, theme: string; const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [userInfo, setUserInfo] = useState(null); + const [returnJustButton, setReturnJustButton] = useState(false); const openReposModal = () => { if (!userInfo) return; @@ -62,6 +63,8 @@ export function GitHubReposComponent({ id, theme }: { id: string, theme: string; const githubId = githubConnection.id; + if (!settings.store.showInMiniProfile) setReturnJustButton(true); + // Try to fetch by ID first, fall back to username const reposById = await fetchReposByUserId(githubId); if (reposById) { @@ -87,6 +90,17 @@ export function GitHubReposComponent({ id, theme }: { id: string, theme: string; if (error) return
Error: {error}
; if (!repos.length) return null; + if (returnJustButton) { + return ( + + ); + } + const topRepos = repos.slice(0, 3); return ( diff --git a/src/equicordplugins/githubRepos/styles.css b/src/equicordplugins/githubRepos/styles.css index ab6ce26f..d7a9e9b7 100644 --- a/src/equicordplugins/githubRepos/styles.css +++ b/src/equicordplugins/githubRepos/styles.css @@ -70,6 +70,7 @@ text-decoration: underline; } +.vc-github-button, .vc-github-repos-show-more { background-color: transparent; color: var(--text-normal); @@ -82,6 +83,7 @@ transition: background-color 0.2s ease, border-color 0.2s ease; } +.vc-github-button:hover, .vc-github-repos-show-more:hover { background-color: var(--background-modifier-hover); border-color: var(--background-modifier-selected); @@ -284,4 +286,4 @@ .vc-github-repos-table-star-icon { color: var(--text-warning); -} \ No newline at end of file +} diff --git a/src/equicordplugins/githubRepos/utils/settings.ts b/src/equicordplugins/githubRepos/utils/settings.ts index c5572871..a45bf6c2 100644 --- a/src/equicordplugins/githubRepos/utils/settings.ts +++ b/src/equicordplugins/githubRepos/utils/settings.ts @@ -11,5 +11,10 @@ export const settings = definePluginSettings({ type: OptionType.BOOLEAN, description: "Show repository language", default: true - } -}); \ No newline at end of file + }, + showInMiniProfile: { + type: OptionType.BOOLEAN, + description: "Only show a button in the mini profile", + default: true + }, +});