Skip to content

Commit

Permalink
feat: Resources page to link users to open-sauced feedback/discussions (
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanak360 committed May 23, 2023
1 parent 6f2f310 commit 3d607ae
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 45 deletions.
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Loading from "./pages/loading";
import { useAuth } from "./hooks/useAuth";
import { goTo } from "react-chrome-extension-router";


const App = () => {
const { isTokenValid } = useAuth();

Expand Down
7 changes: 7 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ export const GITHUB_PR_COMMENT_EDITOR_SELECTOR = "flex-nowrap d-inline-block mr-
export const GITHUB_REPO_ACTIONS_SELECTOR = ".pagehead-actions";
export const GITHUB_PR_COMMENT_TEXT_AREA_SELECTOR = "pull_request[body]";
export const GITHUB_PR_BASE_BRANCH_SELECTOR = "css-truncate css-truncate-target";

// External Links
export const EXTERNAL_RESOURCES = [
{ link: "https://docs.opensauced.pizza/chrome-extension/introduction-to-the-chrome-extension/", key: "Docs" },
{ link: "https://github.com/open-sauced/ai/issues", key: "Issues" },
{ link: "https://github.com/orgs/open-sauced/discussions", key: "Discussions" },
];
62 changes: 62 additions & 0 deletions src/pages/help.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { FaChevronLeft } from "react-icons/fa";
import OpenSaucedLogo from "../assets/opensauced-logo.svg";
import { EXTERNAL_RESOURCES } from "../constants";
import {
HiOutlineBookOpen,
HiOutlineChatBubbleLeftRight,
} from "react-icons/hi2";
import { goBack } from "react-chrome-extension-router";
import { VscIssues } from "react-icons/vsc";

const Help = () => (
<div className="p-4 bg-slate-800">
<div className="grid grid-cols-1 divide-y divide-white/40 divider-y-center-2 min-w-[320px] text-white">
<header className="flex justify-between">
<div className="flex items-center gap-2">
<button
className="rounded-full p-2 bg-slate-700 hover:bg-slate-700/50"
onClick={() => {
goBack();
}}
>
<FaChevronLeft className="text-osOrange text-white" />
</button>

<img
alt="OpenSauced logo"
className="w-[100%]"
src={OpenSaucedLogo}
/>
</div>
</header>

<main className="main-content text-white">
<h3 className="text font-medium text-base leading-10">Help:</h3>

<div className="tools flex flex-col gap-2">
{EXTERNAL_RESOURCES.map((externalLink) => (
<a
key={externalLink.key}
className="flex items-center bg-slate-700 hover:bg-slate-700/70 text-white hover:text-orange no-underline gap-2 p-1.5 px-3 w-full rounded-sm font-medium text-sm"
href={externalLink.link}
rel="noreferrer"
target="_blank"
>
{externalLink.key === "Docs" && <HiOutlineBookOpen />}

{externalLink.key === "Issues" && <VscIssues />}

{externalLink.key === "Discussions" && (
<HiOutlineChatBubbleLeftRight />
)}

{externalLink.key}
</a>
))}
</div>
</main>
</div>
</div>
);

export default Help;
98 changes: 54 additions & 44 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
import { HiArrowTopRightOnSquare, HiPencil, HiUserCircle } from "react-icons/hi2";
import {
HiArrowTopRightOnSquare,
HiOutlineQuestionMarkCircle,
HiPencil,
HiUserCircle,
} from "react-icons/hi2";
import OpenSaucedLogo from "../assets/opensauced-logo.svg";
import { useAuth } from "../hooks/useAuth";
import { useOpensaucedUserCheck } from "../hooks/useOpensaucedUserCheck";
import { Profile } from "./profile";
import { goTo } from "react-chrome-extension-router";
import AIPRDescription from "./aiprdescription";
import Help from "./help";

const Home = () => {
const { user } = useAuth();
const { currentTabIsOpensaucedUser, checkedUser } = useOpensaucedUserCheck();

return (
<div className="p-4 bg-slate-800">
<div className="grid grid-cols-1 divide-y divide-white/40 divider-y-center-2 min-w-[320px] text-white">
<header className="flex justify-between">
<img
alt="OpenSauced logo"
className="w-[45%]"
src={OpenSaucedLogo}
/>
<div className="p-4 bg-slate-800">
<div className="grid grid-cols-1 divide-y divide-white/40 divider-y-center-2 min-w-[320px] text-white">
<header className="flex justify-between">
<img alt="OpenSauced logo" className="w-[45%]" src={OpenSaucedLogo} />

{user && (
<button
className="flex gap-1 items-center hover:text-orange text-white no-underline"
onClick={() => {
goTo(Profile, { username: user.user_name });
}}
>
{user.user_name}
{user && (
<button
className="flex gap-1 items-center hover:text-orange text-white no-underline"
onClick={() => {
goTo(Profile, { username: user.user_name });
}}
>
{user.user_name}

<img
alt="User avatar"
className="rounded-full w-6 aspect-square border border-orange"
src={`https://github.com/${user.user_name}.png`}
/>
</button>
)}
</header>
<img
alt="User avatar"
className="rounded-full w-6 aspect-square border border-orange"
src={`https://github.com/${user.user_name}.png`}
/>
</button>
)}
</header>

<main className="main-content">
<h3 className="text font-medium text-base leading-10">Tools:</h3>
<main className="main-content">
<h3 className="text font-medium text-base leading-10">Tools:</h3>

<div className="tools flex flex-col gap-2">
<a
Expand Down Expand Up @@ -73,25 +75,33 @@ const Home = () => {
</button>

{currentTabIsOpensaucedUser && (
<button
className="flex items-center bg-slate-700 hover:bg-slate-700/70 hover:text-orange text-white gap-2 p-1.5 px-3 w-full rounded-sm font-medium text-sm"
onClick={() => {
goTo(Profile, { username: checkedUser });
}}
>
<HiUserCircle />
View

{" "}

{checkedUser}
&apos;s profile
</button>
)}
<button
className="flex items-center bg-slate-700 hover:bg-slate-700/70 hover:text-orange text-white gap-2 p-1.5 px-3 w-full rounded-sm font-medium text-sm"
onClick={() => {
goTo(Profile, { username: checkedUser });
}}
>
<HiUserCircle />
View {checkedUser}
&apos;s profile
</button>
)}
</div>
</main>
</main>

<footer className="tools flex gap-2">
<button
className="flex items-center bg-slate-700 hover:bg-slate-700/70 hover:text-orange text-white gap-2 p-1.5 px-3 w-fit rounded-sm font-medium text-sm"
onClick={() => {
goTo(Help);
}}
>
<HiOutlineQuestionMarkCircle />
Help
</button>
</footer>
</div>
</div>
</div>
);
};

Expand Down

0 comments on commit 3d607ae

Please sign in to comment.