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: added a link to OSCR tooltips pointing to the OSCR docs #3921

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions components/Contributors/Oscr.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LockIcon } from "@primer/octicons-react";
import { usePostHog } from "posthog-js/react";
import { useRouter } from "next/router";
import { HiOutlineInformationCircle } from "react-icons/hi";
import Pill from "components/atoms/Pill/pill";
import Tooltip from "components/atoms/Tooltip/tooltip";
import Button from "components/shared/Button/button";
Expand Down Expand Up @@ -83,3 +84,26 @@ export const OscrButton = ({ rating, hideRating, signIn = DEFAULT_SIGN_IN, calcu
</>
);
};

export const OscrInfoTooltip = () => {
return (
<Tooltip
content={
<div className="grid gap-2">
<p>OSCR evaluates the engagement and impact of contributors across the entire open source ecosystem.</p>

<a
href="https://opensauced.pizza/docs/features/contributor-insights/#open-source-contributor-rating-oscr"
className="underline"
>
Learn more...
<span className="sr-only"> about OSCR rating</span>
</a>
</div>
}
className="w-fit max-w-xs !text-sm shadow-lg text-slate-100 !px-4 !py-3 !rounded-xl"
>
<HiOutlineInformationCircle className="text-slate-500" />
</Tooltip>
);
};
4 changes: 2 additions & 2 deletions components/Tables/ContributorsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Avatar from "components/atoms/Avatar/avatar";
import { getAvatarByUsername } from "lib/utils/github";
import HoverCardWrapper from "components/molecules/HoverCardWrapper/hover-card-wrapper";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "components/shared/Table";
import { OscrPill } from "components/Contributors/Oscr";
import { OscrInfoTooltip, OscrPill } from "components/Contributors/Oscr";
import { useMediaQuery } from "lib/hooks/useMediaQuery";
import { setQueryParams } from "lib/utils/query-params";
import Pagination from "components/molecules/Pagination/pagination";
Expand Down Expand Up @@ -212,7 +212,7 @@ const mobileColumns = ({ isLoggedIn }: { isLoggedIn: boolean }) => [
header: () => (
<div className="flex gap-2 w-fit items-center">
<p>OSCR</p>
<InfoTooltip information="OSCR evaluates the engagement and impact of contributors across the entire open source ecosystem." />
<OscrInfoTooltip />
</div>
),
enableSorting: true,
Expand Down
2 changes: 1 addition & 1 deletion components/atoms/Tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from "clsx";

interface TooltipProps {
children: React.ReactNode;
content: string;
content: React.ReactNode;
direction?: "top" | "right" | "left" | "bottom";
delay?: number;
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ import { DayRangePicker } from "components/shared/DayRangePicker";
import IssueCommentsTable from "components/Profiles/IssueCommentsTable/issue-comments-table";
import { contributionsOptions, useContributionsFilter } from "components/Profiles/contributors-sub-tab-list";
import { SubTabsList } from "components/TabList/tab-list";
import { OscrButton } from "components/Contributors/Oscr";
import InfoTooltip from "components/shared/InfoTooltip";
import { OscrButton, OscrInfoTooltip } from "components/Contributors/Oscr";
import { INITIAL_DEV_STATS_TIMESTAMP } from "lib/utils/devStats";
import UserRepositoryRecommendations from "../UserRepositoryRecommendations/user-repository-recommendations";

Expand Down Expand Up @@ -375,7 +374,7 @@ const ContributorProfileTab = ({
<span className="relative text-xs text-light-slate-11 flex gap-0.5 items-center">
<span>OSCR Rating</span>
<span className="text-sm grid place-content-center">
<InfoTooltip information="OSCR evaluates the engagement and impact of contributors across the entire open source ecosystem." />
<OscrInfoTooltip />
</span>
</span>
<div className="flex mt-1 text-lg md:text-xl lg:text-2xl !text-black leading-none">
Expand Down
Loading