Skip to content

Commit

Permalink
chore: 2.50.0 release (#3866)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline authored Aug 6, 2024
2 parents 1cd4fff + d3a59a8 commit 5c57c52
Show file tree
Hide file tree
Showing 45 changed files with 469 additions and 645 deletions.
91 changes: 91 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,97 @@

> All notable changes to this project will be documented in this file

## [2.50.0-beta.13](https://github.com/open-sauced/app/compare/v2.50.0-beta.12...v2.50.0-beta.13) (2024-08-06)


### 🐛 Bug Fixes

* remove gradient from metadata tags ([#3856](https://github.com/open-sauced/app/issues/3856)) ([b446fc7](https://github.com/open-sauced/app/commit/b446fc721c19e8d208fa9a642655a4099b2ca676))

## [2.50.0-beta.12](https://github.com/open-sauced/app/compare/v2.50.0-beta.11...v2.50.0-beta.12) (2024-08-05)


### 🍕 Features

* add option to import a SBOM of repositories to a workspace ([#3838](https://github.com/open-sauced/app/issues/3838)) ([ce6b783](https://github.com/open-sauced/app/commit/ce6b78303219d0b1b49db1058409f895cbeb8531))

## [2.50.0-beta.11](https://github.com/open-sauced/app/compare/v2.50.0-beta.10...v2.50.0-beta.11) (2024-08-05)


### 🍕 Features

* converted contributor insight contributor table to new table component ([#3843](https://github.com/open-sauced/app/issues/3843)) ([c91211c](https://github.com/open-sauced/app/commit/c91211c16bff21f43444b55d04265868b76942fc))

## [2.50.0-beta.10](https://github.com/open-sauced/app/compare/v2.50.0-beta.9...v2.50.0-beta.10) (2024-08-05)


### 🐛 Bug Fixes

* **/app/pages/_document.tsx:** add lang attribute to html tag ([#3851](https://github.com/open-sauced/app/issues/3851)) ([d98bc0a](https://github.com/open-sauced/app/commit/d98bc0a702578f7167b87d65fd58467a25cfdffb))

## [2.50.0-beta.9](https://github.com/open-sauced/app/compare/v2.50.0-beta.8...v2.50.0-beta.9) (2024-08-05)


### 🍕 Features

* added a skip link ([#3850](https://github.com/open-sauced/app/issues/3850)) ([83b335a](https://github.com/open-sauced/app/commit/83b335a53e4a8219ab11253a3448e3034ee4da72))

## [2.50.0-beta.8](https://github.com/open-sauced/app/compare/v2.50.0-beta.7...v2.50.0-beta.8) (2024-08-05)


### 🐛 Bug Fixes

* removed some unused code ([#3849](https://github.com/open-sauced/app/issues/3849)) ([70be5b9](https://github.com/open-sauced/app/commit/70be5b9bba379ac2243a6716ba400d0949207417))

## [2.50.0-beta.7](https://github.com/open-sauced/app/compare/v2.50.0-beta.6...v2.50.0-beta.7) (2024-08-02)


### 🍕 Features

* 'Coming Soon' state for OSSF Scorecard ([#3840](https://github.com/open-sauced/app/issues/3840)) ([a36205a](https://github.com/open-sauced/app/commit/a36205afaba8c10c06e8a4bc0173cd9832dd8d41))

## [2.50.0-beta.6](https://github.com/open-sauced/app/compare/v2.50.0-beta.5...v2.50.0-beta.6) (2024-08-02)


### 🐛 Bug Fixes

* OSCR math ceiling for contributor card ([#3839](https://github.com/open-sauced/app/issues/3839)) ([fc9b3e9](https://github.com/open-sauced/app/commit/fc9b3e93ad05f90d81f5e95cf8fa86ed54574d2c))

## [2.50.0-beta.5](https://github.com/open-sauced/app/compare/v2.50.0-beta.4...v2.50.0-beta.5) (2024-08-02)


### 🐛 Bug Fixes

* now using setQueryParams no longer causes page to jump ([#3837](https://github.com/open-sauced/app/issues/3837)) ([6541971](https://github.com/open-sauced/app/commit/6541971dcd6d0930f62e2a41365e7039eaebab35))

## [2.50.0-beta.4](https://github.com/open-sauced/app/compare/v2.50.0-beta.3...v2.50.0-beta.4) (2024-08-02)


### 🐛 Bug Fixes

* now tooltip appears over lock button ([#3832](https://github.com/open-sauced/app/issues/3832)) ([b3274cb](https://github.com/open-sauced/app/commit/b3274cb6296f104daa8fed49e97d85d27a9aa55b))

## [2.50.0-beta.3](https://github.com/open-sauced/app/compare/v2.50.0-beta.2...v2.50.0-beta.3) (2024-08-02)


### 🐛 Bug Fixes

* put back original heading for PR velocity ([#3830](https://github.com/open-sauced/app/issues/3830)) ([e8acd50](https://github.com/open-sauced/app/commit/e8acd50aab41c86601e068027278ae9ba8965823))

## [2.50.0-beta.2](https://github.com/open-sauced/app/compare/v2.50.0-beta.1...v2.50.0-beta.2) (2024-08-02)


### 🐛 Bug Fixes

* removed unused code ([#3827](https://github.com/open-sauced/app/issues/3827)) ([3d28f2c](https://github.com/open-sauced/app/commit/3d28f2cefe93ed20788f170b69a0cdfa01acbb23))

## [2.50.0-beta.1](https://github.com/open-sauced/app/compare/v2.49.0...v2.50.0-beta.1) (2024-08-02)


### 🍕 Features

* OSCR works with API range 0-300 and uses ceiling math ([#3829](https://github.com/open-sauced/app/issues/3829)) ([23ae445](https://github.com/open-sauced/app/commit/23ae445a9247e954981db43bf2db0dcf8050acb4))

## [2.49.0](https://github.com/open-sauced/app/compare/v2.48.0...v2.49.0) (2024-08-01)


Expand Down
8 changes: 4 additions & 4 deletions components/Contributors/Oscr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const OSCR_LOGIN_TEXT = "Log in to view Open Source Contributor Rating (O

export const OscrPill = ({ rating, hideRating, signIn = DEFAULT_SIGN_IN }: OscrProps) => {
const posthog = usePostHog();
let ratingToRender = rating ? Math.floor(rating * 100) : 0;
let ratingToRender = rating ? Math.ceil(rating) : 0;

if (ratingToRender < 1) {
ratingToRender = 0;
Expand All @@ -29,10 +29,10 @@ export const OscrPill = ({ rating, hideRating, signIn = DEFAULT_SIGN_IN }: OscrP
<Tooltip direction="top" content={tooltipText}>
{hideRating ? (
<div className="relative flex items-center justify-center w-fit">
<span className="absolute blur-sm text-xl text-purple-00 z-0 leading-tight">000</span>
<span className="absolute blur-sm text-xl text-purple-00 leading-tight">000</span>
<Button
variant="primary"
className="flex items-center gap-2 !p-1 !text-xs z-10"
className="flex items-center gap-2 !p-1 !text-xs z-0"
onClick={() => {
posthog.capture("OSCR Login Button Clicked");
signIn({ provider: "github", options: { redirectTo: window.location.href } });
Expand All @@ -51,7 +51,7 @@ export const OscrPill = ({ rating, hideRating, signIn = DEFAULT_SIGN_IN }: OscrP

export const OscrButton = ({ rating, hideRating, signIn = DEFAULT_SIGN_IN }: OscrProps) => {
const posthog = usePostHog();
let ratingToRender = rating ? Math.floor(rating * 100) : 0;
let ratingToRender = rating ? Math.ceil(rating) : 0;

const tooltipText = hideRating
? "Log in to view Open Source Contributor Rating (OSCR)"
Expand Down
165 changes: 104 additions & 61 deletions components/Repositories/OssfChart.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { useMemo } from "react";
import { useMemo, useState } from "react";
import { FaShieldAlt } from "react-icons/fa";
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
import { usePostHog } from "posthog-js/react";
import SkeletonWrapper from "components/atoms/SkeletonLoader/skeleton-wrapper";
import Card from "components/atoms/Card/card";
import Button from "components/shared/Button/button";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { useToast } from "lib/hooks/useToast";
import OssfRequestModal from "./OssfRequestModal";

type OssfChartProps = {
repository: string;
totalScore: number | null;
dependencyUpdateScore: number | null;
fuzzingScore: number | null;
Expand All @@ -16,6 +22,7 @@ type OssfChartProps = {
};

export default function OssfChart({
repository,
totalScore,
dependencyUpdateScore,
fuzzingScore,
Expand All @@ -25,6 +32,10 @@ export default function OssfChart({
onLearnMoreClick,
className,
}: OssfChartProps) {
const posthog = usePostHog();
const { toast } = useToast();
const { user } = useSupabaseAuth();
const [isOssfRequestModalOpen, setIsOssfRequestModalOpen] = useState(false);
const data = useMemo(
() => [
{ name: "totalScore", value: totalScore ?? 0 },
Expand All @@ -33,6 +44,18 @@ export default function OssfChart({
[totalScore]
);

const onRequestClick = () => {
if (!user) {
setIsOssfRequestModalOpen(true);
} else {
posthog.capture(`Repo Page: requested OpenSSF score`, {
repository,
email: user.email,
});
toast({ description: "Request sent! We'll notify you when it's ready.", variant: "success" });
}
};

const getValueBasedOnScore = ({
low,
med,
Expand All @@ -52,17 +75,18 @@ export default function OssfChart({
const pieColor = getValueBasedOnScore({ low: "#f59e0b", med: "#2563eb", high: "#22c55e", error: "#e2e8f0" });

const projectStatus = getValueBasedOnScore({
low: "might not be safe to use",
med: "is safe to use",
high: "is safe to use",
error: "hasn't been calculated yet.",
low: "This project might not be safe to use",
med: "This project is safe to use",
high: "This project is safe to use",
error: "Coming soon!",
});

const projectDescription = getValueBasedOnScore({
low: "It might not pass all checks in the OpenSSF software security checklist. ",
med: "It passes almost all checks in the OpenSSF software security checklist. ",
high: "It passes almost all checks in the OpenSSF software security checklist with a high score. ",
error: "No checks have been tested from the OpenSSF software security checklist. ",
error:
"We are still calculating the OpenSSF Score for this repository that measures the security level of the project.",
});

const renderCustomLabel = ({ cx, cy }: { cx: number; cy: number }) => {
Expand All @@ -75,62 +99,81 @@ export default function OssfChart({
};

return (
<Card className={`${className ?? ""} flex flex-col gap-4 w-full h-fit items-center py-8`}>
<header className="flex items-center justify-between w-full px-4">
<div className="flex items-center gap-2">
<FaShieldAlt className="text-xl" />
<h3 className="text-sm font-semibold xl:text-lg text-slate-800">OpenSSF Score</h3>
</div>
<a
href="https://opensauced.pizza/docs/features/repo-pages/#insights-into-the-ossf-scorecard"
onClick={onLearnMoreClick}
className="text-xs font-semibold text-sauced-orange xl:text-sm hover:underline"
>
Learn More
</a>
</header>

{!isError && (isLoading || !totalScore) ? ( // check if other scores are null
<SkeletonWrapper width={300} height={100} />
) : (
<section className="flex justify-between w-full gap-2 lg:flex-col xl:flex-row h-fit max-h-24 lg:max-h-full xl:max-h-24">
<div className="w-full !max-w-[14rem] lg:max-w-full lg:mx-auto h-full lg:max-h-24 xl:h-full">
<ResponsiveContainer width="100%" height={150}>
<PieChart>
<Pie
data={data}
label={renderCustomLabel}
labelLine={false}
dataKey="value"
startAngle={180}
endAngle={0}
innerRadius={40}
paddingAngle={0}
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.name === "totalScore" ? pieColor : "#e2e8f0"} />
))}
</Pie>
</PieChart>
</ResponsiveContainer>
<>
<Card className={`${className ?? ""} flex flex-col gap-4 w-full h-fit items-center py-8`}>
<header className="flex items-center justify-between w-full px-4">
<div className="flex items-center gap-2">
<FaShieldAlt className="text-xl" />
<h3 className="text-sm font-semibold xl:text-lg text-slate-800">OpenSSF Score</h3>
</div>
<section className="flex flex-col gap-1 lg:text-center xl:text-start">
<h3 className="font-medium text-sm text-slate-700">This project {projectStatus}</h3>
<p className="text-xs text-slate-600">
{projectDescription}
You can run the full test{" "}
<a
href="https://github.com/ossf/scorecard?tab=readme-ov-file#view-a-projects-score"
target="_blank"
className="text-orange-500"
>
here
</a>
.
</p>
<a
href="https://opensauced.pizza/docs/features/repo-pages/#insights-into-the-ossf-scorecard"
onClick={onLearnMoreClick}
className="text-xs font-semibold text-sauced-orange xl:text-sm hover:underline"
>
Learn More
</a>
</header>

{!isError && (isLoading || !totalScore) ? ( // check if other scores are null
<SkeletonWrapper width={300} height={100} />
) : (
<section className="flex justify-between items-center w-full gap-2 lg:flex-col xl:flex-row h-fit max-h-24 lg:max-h-full xl:max-h-24">
<div className="relative w-full !max-w-[14rem] lg:max-w-full lg:mx-auto h-full lg:max-h-24 xl:h-full">
{isError && (
<div className="absolute inset-0 z-50 flex items-center justify-center">
<Button variant="primary" onClick={onRequestClick} className="!text-xs">
I want this now!
</Button>
</div>
)}
<ResponsiveContainer width="100%" height={150} className={`${isError && "blur-[2.5px]"}`}>
<PieChart>
<Pie
data={data}
label={renderCustomLabel}
labelLine={false}
dataKey="value"
startAngle={180}
endAngle={0}
innerRadius={40}
paddingAngle={0}
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.name === "totalScore" ? pieColor : "#e2e8f0"} />
))}
</Pie>
</PieChart>
</ResponsiveContainer>
</div>
<section className="flex flex-col gap-1 lg:text-center xl:text-start">
<h3 className="font-medium text-sm text-slate-700">{projectStatus}</h3>
<p className="text-xs text-slate-600">
{projectDescription}
{!isError && (
<span>
You can run the full test{" "}
<a
href="https://github.com/ossf/scorecard?tab=readme-ov-file#view-a-projects-score"
target="_blank"
className="text-orange-500"
>
here
</a>
.
</span>
)}
</p>
</section>
</section>
</section>
)}
</Card>
)}
</Card>

<OssfRequestModal
repository={repository}
isOpen={isOssfRequestModalOpen}
onClose={() => setIsOssfRequestModalOpen(false)}
/>
</>
);
}
Loading

0 comments on commit 5c57c52

Please sign in to comment.