From 4ecb35b4169968a816f981bb958a1340d813c01b Mon Sep 17 00:00:00 2001 From: Anush Date: Sun, 4 Jun 2023 17:16:32 +0530 Subject: [PATCH 1/3] chore: deleted duplicate css file --- src/content-scripts.css | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/content-scripts.css diff --git a/src/content-scripts.css b/src/content-scripts.css deleted file mode 100644 index e089f726..00000000 --- a/src/content-scripts.css +++ /dev/null @@ -1,22 +0,0 @@ -@tailwind components; -@tailwind utilities; - -* { - box-sizing: border-box; - margin: 0px; - padding: 0px; -} - -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", - monospace; -} From adcd315816be813ad5f6b790e4e3bb684f38994b Mon Sep 17 00:00:00 2001 From: Anush Date: Sun, 4 Jun 2023 17:19:47 +0530 Subject: [PATCH 2/3] chore: update title, favicon --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 38f38611..a1c5c97a 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ - + - Vite App + OpenSauced.ai
From 9e0f27bb783f5aedb236ce293de2d5c233d748ad Mon Sep 17 00:00:00 2001 From: Anush Date: Sun, 4 Jun 2023 17:25:21 +0530 Subject: [PATCH 3/3] fix: post-highlight-page-check --- src/hooks/useGithubPRPageCheck.ts | 19 +++++++++++++++++++ src/pages/home.tsx | 21 ++++++++++++--------- src/pages/posthighlight.tsx | 7 ++++--- 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 src/hooks/useGithubPRPageCheck.ts diff --git a/src/hooks/useGithubPRPageCheck.ts b/src/hooks/useGithubPRPageCheck.ts new file mode 100644 index 00000000..d2ea60b1 --- /dev/null +++ b/src/hooks/useGithubPRPageCheck.ts @@ -0,0 +1,19 @@ +import { useEffect, useState } from "react"; +import { isGithubPullRequestPage } from "../utils/urlMatchers"; + +export const useIsGithubPRPageCheck = () => { + const [isGithubPRPage, setIsGithubPRPage] = useState(false); + + useEffect(() => { + chrome.tabs.query({ active: true, currentWindow: true }, tabs => { + if (tabs.length > 0) { + const tab = tabs[0]; + + setIsGithubPRPage(isGithubPullRequestPage(tab.url!)); + } + }); + }, []); + + + return isGithubPRPage; +}; diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 011c6264..4735279c 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -19,10 +19,12 @@ import { getHighlights } from "../utils/fetchOpenSaucedApiData"; import Help from "./help"; import { OPEN_SAUCED_INSIGHTS_DOMAIN } from "../constants"; import type { Highlight } from "../ts/types"; +import { useIsGithubPRPageCheck } from "../hooks/useGithubPRPageCheck"; const Home = () => { const { user } = useAuth(); const { currentTabIsOpensaucedUser, checkedUser } = useOpensaucedUserCheck(); + const isGithubPRPage = useIsGithubPRPageCheck(); const [highlights, setHighlights] = useState([]); const [currentPage, setCurrentPage] = useState(0); @@ -173,15 +175,16 @@ const Home = () => { AI Configuration - + {isGithubPRPage && ( + )} {currentTabIsOpensaucedUser && (