From a2601d5716526a9b7eaf6ef0c33b72096a46455f Mon Sep 17 00:00:00 2001 From: Loremly Date: Sun, 8 Jan 2023 17:33:42 -0500 Subject: [PATCH] Update --- .../Modal/CommitsModal/Commit.tsx | 10 +- .../Modal/CommitsModal/index.tsx | 13 +- .../githubindiscord/Modal/Issues/index.tsx | 14 +- .../Modal/RepoModal/Folder.tsx | 31 ++- .../githubindiscord/Modal/RepoModal/index.tsx | 9 +- plugins/githubindiscord/Modal/index.tsx | 252 +++++++++++------- plugins/githubindiscord/components.ts | 4 - plugins/githubindiscord/style.scss | 181 ++++++++++--- plugins/githubindiscord/theme.ts | 4 + 9 files changed, 354 insertions(+), 164 deletions(-) create mode 100644 plugins/githubindiscord/theme.ts diff --git a/plugins/githubindiscord/Modal/CommitsModal/Commit.tsx b/plugins/githubindiscord/Modal/CommitsModal/Commit.tsx index a1ad045..cc8217f 100644 --- a/plugins/githubindiscord/Modal/CommitsModal/Commit.tsx +++ b/plugins/githubindiscord/Modal/CommitsModal/Commit.tsx @@ -4,6 +4,8 @@ import { getCommit } from "../../utils"; import { Spinner } from "@primer/react"; import { components } from "@octokit/openapi-types"; +const textClasses = webpack.getByProps("heading-lg/bold"); + const classes = { markup: webpack.getByProps("markup")?.markup, scrollbarGhostHairline: webpack.getByProps("scrollbarGhostHairline")?.scrollbarGhostHairline, @@ -33,10 +35,10 @@ export default memo( if (!commit && Spinner) return ( -

- Fetching commit - -

+
+ Fetching Commits... + +
); else if (commit) return commit.files!.map((file) => ( diff --git a/plugins/githubindiscord/Modal/CommitsModal/index.tsx b/plugins/githubindiscord/Modal/CommitsModal/index.tsx index 91ed0fa..7dfa531 100644 --- a/plugins/githubindiscord/Modal/CommitsModal/index.tsx +++ b/plugins/githubindiscord/Modal/CommitsModal/index.tsx @@ -1,9 +1,12 @@ import { FC, memo, useEffect, useState } from "react"; -import { Spinner } from "../../components"; import { getCommits } from "../../utils"; import Commit from "./Commit"; import { GitCommitIcon } from "@primer/styled-octicons"; import { components } from "@octokit/openapi-types"; +import { Spinner } from "@primer/react"; +import { webpack } from "replugged"; + +const textClasses = webpack.getByProps("heading-lg/bold"); type Props = { url: string; branch: components["schemas"]["branch-short"] | null }; @@ -20,10 +23,10 @@ const CommitsModal: FC = ({ url, branch }) => { console.log(commits); if (!commits && Spinner) return ( -

- Fetching commits - -

+
+ Fetching Commits... + +
); if (!selectedCommit) return ( diff --git a/plugins/githubindiscord/Modal/Issues/index.tsx b/plugins/githubindiscord/Modal/Issues/index.tsx index b46dabe..25b31c6 100644 --- a/plugins/githubindiscord/Modal/Issues/index.tsx +++ b/plugins/githubindiscord/Modal/Issues/index.tsx @@ -2,9 +2,12 @@ import { components } from "@octokit/openapi-types"; import { Box, Label, LabelGroup, RelativeTime, Spinner, Text } from "@primer/react"; import { IssueOpenedIcon } from "@primer/styled-octicons"; import { FC, memo, useEffect, useState } from "react"; +import { webpack } from "replugged"; import { getIssues } from "../../utils"; import IssueComp from "./Issue"; +const textClasses = webpack.getByProps("heading-lg/bold"); + interface Props { url: string; repo: (components["schemas"]["repository"] & { commit: components["schemas"]["commit"] }) | null; @@ -25,21 +28,22 @@ const Issues: FC = ({ url, repo }) => { if (!issues) return ( -
-

Fetching Issues

- +
+ Fetching Issues... +
); if (issue) return ; return ( - + {issues.map((issue) => ( @@ -49,7 +53,7 @@ const Issues: FC = ({ url, repo }) => { setIssue(issue)}> {issue.title} - + {issue.labels.map((label) => ( {dir.path && (
diff --git a/plugins/githubindiscord/Modal/RepoModal/index.tsx b/plugins/githubindiscord/Modal/RepoModal/index.tsx index ab98468..dda9694 100644 --- a/plugins/githubindiscord/Modal/RepoModal/index.tsx +++ b/plugins/githubindiscord/Modal/RepoModal/index.tsx @@ -4,6 +4,9 @@ import { FC, memo, useEffect, useState } from "react"; import { File, getFile, getFolder } from "../../utils"; import FolderModal from "./Folder"; import FileModal from "./File"; +import { webpack } from "replugged"; + +const textClasses = webpack.getByProps("heading-sm/bold"); type Props = { url: string; @@ -32,9 +35,9 @@ const RepoModal: FC = ({ url, repo, branch, trigger, path }) => { if (!folder) return ( -
-

Fetching Issues

- +
+ Fetching Repository Contents... +
); diff --git a/plugins/githubindiscord/Modal/index.tsx b/plugins/githubindiscord/Modal/index.tsx index eb1a0a3..86aec27 100644 --- a/plugins/githubindiscord/Modal/index.tsx +++ b/plugins/githubindiscord/Modal/index.tsx @@ -5,13 +5,14 @@ import { CommitIcon, GitBranchIcon, IssueOpenedIcon, + LinkExternalIcon, LockIcon, RepoForkedIcon, RepoIcon, StarIcon, TagIcon, } from "@primer/styled-octicons"; -import { Breadcrumbs, Button, Label, ThemeProvider, theme } from "@primer/react"; +import { Breadcrumbs, Button, ButtonGroup, Label, Text, ThemeProvider, theme } from "@primer/react"; import { UnderlineNav } from "@primer/react/drafts"; import { SelectMenu } from "../components"; import CommitsModal from "./CommitsModal"; @@ -21,13 +22,56 @@ import { common, components as rpC, webpack } from "replugged"; import { useEffect, useState } from "react"; import Issues from "./Issues"; import { components } from "@octokit/openapi-types"; +import deepmerge from "deepmerge"; + +const discordtheme = deepmerge(theme, { + colorSchemes: { + dark: { + colors: { + border: { + default: "var(--primary-dark-700)", + muted: "var(--primary-dark-700)", + subtle: "var(--primary-dark-700)", + }, + btn: { + text: "var(--text-normal)", + bg: "var(--button-secondary-background)", + border: "transparent", + hoverBg: "var(--button-secondary-background-hover)", + hoverBorder: "transparent", + activeBg: "red", + activeBorder: "transparent", + selectedBg: "red", + focusBg: "red", + focusBorder: "transparent", + counterBg: "rgba(27,31,36,0.08)", + primary: { + text: "var(--text-normal)", + bg: "#2da44e", + border: "transparent", + hoverBg: "#2c974b", + hoverBorder: "transparent", + selectedBg: "hsla(137,55%,36%,1)", + disabledText: "rgba(255,255,255,0.8)", + disabledBg: "#94d3a2", + disabledBorder: "transparent", + focusBg: "#2da44e", + focusBorder: "transparent", + icon: "rgba(255,255,255,0.8)", + counterBg: "rgba(255,255,255,0.2)", + }, + }, + }, + }, + }, +}); const { ModalContent, ModalHeader, ModalRoot } = rpC.Modal; const wumpus = { ...webpack.getByProps("emptyStateImage", "emptyStateSubtext"), }; -const textClasses = webpack.getByProps("heading-sm/bold"); +const textClasses = webpack.getByProps("heading-lg/bold"); // const tabs = { // repo: RepoModal, @@ -39,8 +83,6 @@ const tabs = [ { title: "Issues", component: Issues, icon: IssueOpenedIcon }, ]; -// const customTheme = deepmerge(theme) - export function GithubModal({ url, tab, ...props }: ModalProps<{ url: string; tab?: string }>) { const [repoInfo, setInfo] = useState< (components["schemas"]["repository"] & { commit: components["schemas"]["commit"] }) | null @@ -67,52 +109,75 @@ export function GithubModal({ url, tab, ...props }: ModalProps<{ url: string; ta return ( - + -
-
- {repoInfo?.visibility === "private" ? : } +
+
+
+ {repoInfo?.visibility === "private" ? ( + + ) : ( + + )} +
+ + + {repoInfo?.owner.login} + + + {repoInfo?.name} + + + +
+
+ {repoInfo && ( + + + + + )} + {repoInfo && ( + + + + + )}
- - {repoInfo?.owner.login} - - / - - {repoInfo?.name || url} - - -
- + + {tabs.map(({ title, icon }) => ( + setTab(title)}> + {title} + + ))} +
@@ -127,57 +192,56 @@ export function GithubModal({ url, tab, ...props }: ModalProps<{ url: string; ta }} /> )} - {path ? ( - - {path.split("/").map((inPath, idx) => ( - - setPath( - path - .split("/") - .splice(0, idx + 1) - .join("/"), - ) - }> - {inPath} - - ))} - - ) : ( - - )}
- - {tabs.map(({ title, icon }) => ( - setTab(title)}> - {title} - - ))} - + {path ? ( + + setPath("")}>{repoInfo?.name} + {path.split("/").map((inPath, idx) => ( + + setPath( + path + .split("/") + .splice(0, idx + 1) + .join("/"), + ) + }> + {inPath} + + ))} + + ) : ( + + )}
- {err && ( + {err && textClasses && (
- {err} + + {err} +
)} {!err && Tab && ( diff --git a/plugins/githubindiscord/components.ts b/plugins/githubindiscord/components.ts index dd3360f..94c8bfd 100644 --- a/plugins/githubindiscord/components.ts +++ b/plugins/githubindiscord/components.ts @@ -35,7 +35,3 @@ export const TabBar = webpack.getByProps("Header", "Panel", "Item") as unknown a }>; }) | undefined; -export const Spinner = webpack.getExportsForProps( - await webpack.waitForModule(webpack.filters.bySource("spinningCircle")), - ["Type"], -) as unknown as React.FC<{ type: string }> | undefined; diff --git a/plugins/githubindiscord/style.scss b/plugins/githubindiscord/style.scss index 4574a46..9e43938 100644 --- a/plugins/githubindiscord/style.scss +++ b/plugins/githubindiscord/style.scss @@ -1,101 +1,208 @@ -// Styled by https://github.com/loremly - .githubModel { color: var(--text-normal); width: fit-content; max-width: 80vw; max-height: 70vh; + min-width: 60vw; + + >* { + line-height: normal; + } .header-1zd7se { justify-content: space-between; - align-items: center; + padding-bottom: 0 !important; + align-items: flex-start; + flex-direction: column; white-space: nowrap; - flex-direction: row; + overflow: hidden; display: flex; - .repo-visibility-icon { - color: var(--text-muted); - margin-right: 8px; - } - - .repo-path { - flex-direction: row; - align-items: center; - margin-right: 15vw; + .repository-info { display: flex; + width: 100%; - .separator { - color: var(--text-muted); - margin: 0 4px; - } + .repo-path { + flex-direction: row; + align-items: center; + margin-right: auto; + display: flex; - .visibility { - text-transform: capitalize; - margin-left: 8px; + .separator { + color: var(--text-muted); + margin: 0 4px; + } + + .visibility { + text-transform: capitalize; + margin-left: 8px; + } + + a { + font-size: 20px !important; + + &:hover { + text-decoration: underline; + } + } } - a { - &:hover { - text-decoration: underline; + .extlink-buttons { + flex-direction: row; + align-items: center; + margin-left: 15vw; + display: flex; + gap: 15px; + + >.ButtonGroup-sc-tk435v-0 { + >button { + padding-left: 12px; + padding-right: 12px; + } } } } - .extlink-buttons { - flex-direction: row; - align-items: center; - display: flex; - gap: 15px; + nav[aria-label="tabs"] { + padding-left: 0 !important; + border-bottom: none; + margin-top: 12px; + width: 100%; } } + .content-2hZxGK { padding-right: 10px !important; padding-bottom: 16px; + padding-top: 10px; + .repository-options { - justify-content: space-between; align-items: center; padding: 8px 0; display: flex; + .branches { align-items: center; display: flex; + .select-1Ia3hD { margin-right: 20px; min-width: 11rem; } + a { display: flex; } } + + nav.Breadcrumbs__BreadcrumbsBase-sc-zwknu7-1 { + .Box-sc-1gh2r6s-0 { + display: flex; + + .fLAmDQ { + align-items: center; + display: flex; + + a { + font-size: 17px !important; + font-weight: 600; + + &.selected { + color: var(--text-normal) !important; + font-weight: normal; + } + } + } + } + } + div.miscLinks { display: flex; - .taglink { - margin-left: 16px; + + a { + display: flex; + + &.taglink { + margin-left: 16px; + } } } } + + .fetching { + justify-content: center; + flex-direction: column; + align-items: center; + min-height: 25vh; + display: flex; + + span { + margin-bottom: 16px; + } + } + .Gout-folder, .Gin-folder { border-radius: 4px; margin-top: 8px; - .Gfolder:nth-child(1) > div { + + .Gfolder:nth-child(1)>div { border-top: none !important; } + a:hover { text-decoration: underline !important; } + .Box-sc-1gh2r6s-0 { display: flex; - &:hover { + + &:hover:not(.latestCommitInfo:hover) { background-color: var(--background-modifier-hover); } + + &.latestCommitInfo { + border-radius: 4px 4px 0 0; + + .relativeTime { + margin-left: auto; + } + } + } + } + + .issueList { + border-radius: 4px; + + .issue { + &:nth-child(1) { + border-top: none !important; + } + } + } + + .Gerror { + justify-content: center; + flex-direction: column; + align-items: center; + padding: 30px 0; + display: flex; + + .emptyStateImage-1kilCd { + margin: 0; + } + + span { + padding-top: 15px; } } } - a:not(.repo-path > *):not(.Gout-folder a:hover):not(.Gin-folder a:hover):not( - .branches a:hover - ):not(.backbtn a) { - color: var(--text-normal); + a { + color: var(--text-link); + + &:not(.repo-path > *):not(.Gout-folder a:hover):not(.Gin-folder a:hover):not(.branches a:hover):not(.backbtn a):not(.doegSW):not(.miscLinks a:hover) { + color: var(--text-normal); + } } } diff --git a/plugins/githubindiscord/theme.ts b/plugins/githubindiscord/theme.ts new file mode 100644 index 0000000..e69a9f0 --- /dev/null +++ b/plugins/githubindiscord/theme.ts @@ -0,0 +1,4 @@ +import {theme} from '@primer/react' +import deepmerge from 'deepmerge' + +