Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Resources page to link users to open-sauced feedback/discussions #100

Merged
merged 14 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Loading from "./pages/loading";
import { Profile } from "./pages/profile";
import { useAuth } from "./hooks/useAuth";
import AIPRDescription from "./pages/aiprdescription";
import Resources from "./pages/resources";

export const RouteContext = createContext<{ page: { name: string, props?: any }, setCurrentPage:(page: RouteKeys, props?: any) => void }>({ page: { name: "loading" }, setCurrentPage: () => {} });

Expand All @@ -15,6 +16,7 @@ const routes = {
loading: <Loading />,
profile: <Profile />,
aiprdescription: <AIPRDescription />,
resources: <Resources />,
diivi marked this conversation as resolved.
Show resolved Hide resolved
};

type RouteKeys = keyof typeof routes;
Expand Down
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ 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 DISCUSSIONS = { link: "https://github.com/orgs/open-sauced/discussions", key: "Discussions", displayValue: "Go to feedback Discussions" };
diivi marked this conversation as resolved.
Show resolved Hide resolved
export const ISSUES = { link: "https://github.com/open-sauced/ai/issues", key: "Issues", displayValue: "Go to our current Issues" };
10 changes: 10 additions & 0 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ const Home = () => {
&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={() => {
setCurrentPage("resources");
}}
>
<HiArrowTopRightOnSquare />
diivi marked this conversation as resolved.
Show resolved Hide resolved
Resources
</button>
</div>
</main>
</div>
Expand Down
65 changes: 65 additions & 0 deletions src/pages/resources.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { useContext } from "react";

import { FaChevronLeft } from "react-icons/fa";
import OpenSaucedLogo from "../assets/opensauced-logo.svg";
import { RouteContext } from "../App";
import { Toaster } from "react-hot-toast";
import { DISCUSSIONS, ISSUES } from "../constants";
import { HiArrowTopRightOnSquare } from "react-icons/hi2";

const externalLinks = [DISCUSSIONS, ISSUES];

const Resources = () => {
const { setCurrentPage } = useContext(RouteContext);

return (
<>
<Toaster />

<div className="grid grid-cols-1 divide-y divider-y-center-2 min-w-[320px]">
<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={() => {
setCurrentPage("home");
}}
>
<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">
External Resources:
</h3>

<div className="tools flex flex-col gap-2">
{externalLinks.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"
>
<HiArrowTopRightOnSquare />

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

export default Resources;