Skip to content

Commit

Permalink
chore: release 2.4.1 (#2832)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Feb 29, 2024
2 parents 6b0801f + 449ec16 commit fa36712
Show file tree
Hide file tree
Showing 25 changed files with 523 additions and 651 deletions.
68 changes: 65 additions & 3 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,71 @@

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

## [2.4.0-beta.55](https://github.com/open-sauced/app/compare/v2.4.0-beta.54...v2.4.0-beta.55) (2024-02-29)


### 馃悰 Bug Fixes

* now the workspace creation redirects to the new workspace homepage ([#2830](https://github.com/open-sauced/app/issues/2830)) ([e1bbe84](https://github.com/open-sauced/app/commit/e1bbe849e00d5f4fb87bffbbf022558c1c169566))
* use pr histogram for contributor pull request activity line chart ([#2831](https://github.com/open-sauced/app/issues/2831)) ([7e93b9d](https://github.com/open-sauced/app/commit/7e93b9dd0b5a4b4b68f47953c7bd3d9d5e19af58))

## [2.4.0-beta.54](https://github.com/open-sauced/app/compare/v2.4.0-beta.53...v2.4.0-beta.54) (2024-02-29)


### 馃悰 Bug Fixes

* show upgrade banner only when needed ([#2809](https://github.com/open-sauced/app/issues/2809)) ([316ebd2](https://github.com/open-sauced/app/commit/316ebd2cbdefde39939a855d59e7318b5c913d57))

## [2.4.0-beta.53](https://github.com/open-sauced/app/compare/v2.4.0-beta.52...v2.4.0-beta.53) (2024-02-29)


### 馃悰 Bug Fixes

* now the workspaces homepage is /workspaces/some-workspace-id ([#2821](https://github.com/open-sauced/app/issues/2821)) ([bd5d5c7](https://github.com/open-sauced/app/commit/bd5d5c74a45d44b47f14fd4623f674b80a37b01e))

## [2.4.0-beta.52](https://github.com/open-sauced/app/compare/v2.4.0-beta.51...v2.4.0-beta.52) (2024-02-29)


### 馃悰 Bug Fixes

* top navigation workspace link works as expected now ([#2804](https://github.com/open-sauced/app/issues/2804)) ([4528b61](https://github.com/open-sauced/app/commit/4528b6172d59d7cd3ef277192d3be5d72500c97b))

## [2.4.0-beta.51](https://github.com/open-sauced/app/compare/v2.4.0-beta.50...v2.4.0-beta.51) (2024-02-28)


### 馃悰 Bug Fixes

* Rework workspace visibility flow ([#2796](https://github.com/open-sauced/app/issues/2796)) ([856d269](https://github.com/open-sauced/app/commit/856d2692ae8249e8a69d6558548a13da064ac5db))

## [2.4.0-beta.50](https://github.com/open-sauced/app/compare/v2.4.0-beta.49...v2.4.0-beta.50) (2024-02-28)


### 馃悰 Bug Fixes

* use workspace_id field when redirecting legacy insights and lists ([#2808](https://github.com/open-sauced/app/issues/2808)) ([1fd078d](https://github.com/open-sauced/app/commit/1fd078dc48582583b03bc60b270df381e3d2dd6a))

## [2.4.0-beta.49](https://github.com/open-sauced/app/compare/v2.4.0-beta.48...v2.4.0-beta.49) (2024-02-28)


### 馃悰 Bug Fixes

* now the complete the onboarding tooltip only appears on screens smaller than 1024px ([#2800](https://github.com/open-sauced/app/issues/2800)) ([86e9d5b](https://github.com/open-sauced/app/commit/86e9d5b24fd7459be85f92b3be0a766dae8817bb))
* remove duplicate layout on contributor insight edit page ([#2805](https://github.com/open-sauced/app/issues/2805)) ([7e563f9](https://github.com/open-sauced/app/commit/7e563f96fbe097486e76138888e5df8783c1d59c))

## [2.4.0-beta.48](https://github.com/open-sauced/app/compare/v2.4.0-beta.47...v2.4.0-beta.48) (2024-02-28)


### 馃悰 Bug Fixes

* removed unused feature flags in contributor insights page ([#2798](https://github.com/open-sauced/app/issues/2798)) ([0143738](https://github.com/open-sauced/app/commit/014373873db86b8ea640e85bdb7d57eced336b47))

## [2.4.0-beta.47](https://github.com/open-sauced/app/compare/v2.4.0-beta.46...v2.4.0-beta.47) (2024-02-28)


### 馃悰 Bug Fixes

* Corrects copy for Github -> GitHub ([#2797](https://github.com/open-sauced/app/issues/2797)) ([9f40019](https://github.com/open-sauced/app/commit/9f4001985bbf2c991099c0c53a83e84dd129be34))

## [2.4.0](https://github.com/open-sauced/app/compare/v2.3.1...v2.4.0) (2024-02-27)


Expand Down Expand Up @@ -235,13 +300,10 @@
### 馃悰 Bug Fixes

* now a click outside the tracked repositories modal closes the modal ([#2623](https://github.com/open-sauced/insights/issues/2623)) ([8d9ad05](https://github.com/open-sauced/insights/commit/8d9ad052a2405d94d87399e34b3f1aff414d7945))
<<<<<<< HEAD
=======
* Now you can't type more than 500 characters for a highlight summary ([#2614](https://github.com/open-sauced/insights/issues/2614)) ([ed3d1d9](https://github.com/open-sauced/insights/commit/ed3d1d983023a2d3a9a83a5670239b3fea73be71))
* redirect to `/workspaces/new` if user has no workspaces ([#2607](https://github.com/open-sauced/insights/issues/2607)) ([547fdf5](https://github.com/open-sauced/insights/commit/547fdf5719f0eab14032a6db6accc5fb7c4786e8))
* reduced the height of the chart wrapper that is making the button unclickable ([#2611](https://github.com/open-sauced/insights/issues/2611)) ([7fb4e40](https://github.com/open-sauced/insights/commit/7fb4e4042853c5ad7cb776ef1194a6b06a5acc0f))
* return empty arrays on error when fetching GitHub data ([#2616](https://github.com/open-sauced/insights/issues/2616)) ([5c9ad0b](https://github.com/open-sauced/insights/commit/5c9ad0b12a421e198340d46835aca5fa8dd6fd2f))
>>>>>>> main

## [2.2.0-beta.6](https://github.com/open-sauced/insights/compare/v2.2.0-beta.5...v2.2.0-beta.6) (2024-02-08)

Expand Down
46 changes: 30 additions & 16 deletions components/Workspaces/InsightUpgradeModal.tsx
Expand Up @@ -6,8 +6,8 @@ import Card from "components/atoms/Card/card";

type InsightUpgradeModalProps = {
workspaceId: string;
overLimit: number;
variant: "repositories" | "contributors";
overLimit?: number;
variant: "repositories" | "contributors" | "workspace";
isOpen: boolean;
onClose: () => void;
};
Expand All @@ -26,19 +26,30 @@ export default function InsightUpgradeModal({
<div className="min-w-[712px] flex flex-col gap-8">
<DialogCloseButton onClick={onClose} />
<section className="flex flex-col gap-2">
<DialogTitle className="text-xl">This Insight page is over the free Workspace limit</DialogTitle>
<p className="text-sm text-slate-500">
Your Insight page has{" "}
<span className="font-bold">
{overLimit} {variant}
</span>{" "}
but the free Workspace only allows for{" "}
<span className="font-bold">
{variant === "repositories" ? 100 : 10} {variant}
</span>{" "}
tracked. Don&apos;t worry, your insights won&apos;t be deleted, but if you want to continue using
OpenSauced you should upgrade your Workspace to a PRO Workspace.
</p>
<DialogTitle className="text-xl">
{variant !== "workspace"
? "This Insight page is over the free Workspace limit"
: "Upgrade to a PRO Workspace"}
</DialogTitle>
{variant !== "workspace" ? (
<p className="text-sm text-slate-500">
Your Insight page has{" "}
<span className="font-bold">
{overLimit} {variant}
</span>{" "}
but the free Workspace only allows for{" "}
<span className="font-bold">
{variant === "repositories" ? 100 : 10} {variant}
</span>{" "}
tracked. Don&apos;t worry, your insights won&apos;t be deleted. If you want to continue using
OpenSauced you should upgrade your Workspace to a PRO Account.
</p>
) : (
<p className="text-sm text-slate-500">
Setting your workspace to private is a PRO feature. Upgrade your Workspace and get exclusive access to
your work for you and your team!
</p>
)}
</section>

<section className="flex gap-8 justify-between w-full">
Expand Down Expand Up @@ -98,7 +109,10 @@ export default function InsightUpgradeModal({
</ul>

<Button
href={`/workspaces/${workspaceId}/settings#upgrade`}
onClick={() => {
if (variant === "workspace") onClose();
}}
href={variant !== "workspace" ? `/workspaces/${workspaceId}/settings#upgrade` : ""}
variant="primary"
className="py-3 flex justify-center"
>
Expand Down
2 changes: 1 addition & 1 deletion components/Workspaces/TrackedContributorsTable.tsx
Expand Up @@ -22,7 +22,7 @@ export const EmptyState = ({ onAddContributors }: { onAddContributors: () => voi
<div className="grid w-max max-w-sm mx-auto">
<span className="text-center font-medium mb-2">Add contributors to track</span>
<p className="text-sm text-slate-600 text-center">
Search and select the contributors you want to track and get insights on your entire Github ecosystem
Search and select the contributors you want to track and get insights on your entire GitHub ecosystem
</p>
</div>
<Button variant="primary" className="w-max mx-auto" onClick={onAddContributors}>
Expand Down
Expand Up @@ -50,9 +50,9 @@ export const PickReposOrOrgStep = ({ onSearchRepos, onPasteRepos, onImportOrg }:
>
<FaGithub size={20} className="text-purple-800 mb-2" />
<span data-button-title className="font-semibold">
Import a Github Organization
Import a GitHub Organization
</span>
<span className="text-left">Search for organizations on Github and import any or all repositories.</span>
<span className="text-left">Search for organizations on GitHub and import any or all repositories.</span>
</button>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion components/Workspaces/TrackedReposTable.tsx
Expand Up @@ -22,7 +22,7 @@ export const EmptyState = ({ onAddRepos }: { onAddRepos: () => void }) => {
<div className="grid w-max max-w-sm mx-auto">
<span className="text-center font-medium mb-2">Add repositories to track</span>
<p className="text-sm text-slate-600 text-center">
Search and select the repositories you want to track and get insights on your entire Github ecosystem
Search and select the repositories you want to track and get insights on your entire GitHub ecosystem
</p>
</div>
<Button variant="primary" className="w-max mx-auto" onClick={onAddRepos}>
Expand Down
14 changes: 14 additions & 0 deletions components/Workspaces/WorkspaceBanner.tsx
@@ -0,0 +1,14 @@
type WorkspaceBannerProps = {
openModal: () => void;
};

export default function WorkspaceBanner({ openModal }: WorkspaceBannerProps) {
return (
<button
onClick={openModal}
className="absolute top-0 inset-x-0 w-full h-fit px-4 py-2 bg-light-orange-10 text-white"
>
This insight page is over the free limit. <span className="font-bold underline">Upgrade to a PRO Workspace.</span>
</button>
);
}
6 changes: 4 additions & 2 deletions components/Workspaces/WorkspaceLayout.tsx
Expand Up @@ -10,10 +10,11 @@ import Footer from "components/organisms/Footer/footer";

interface WorkspaceLayoutProps {
workspaceId: string;
banner?: React.ReactNode;
children: React.ReactNode;
}

export const WorkspaceLayout = ({ workspaceId, children }: WorkspaceLayoutProps) => {
export const WorkspaceLayout = ({ workspaceId, banner, children }: WorkspaceLayoutProps) => {
const isLargeScreen = useMediaQuery("(min-width: 1024px)");
const [showingSidebar, setShowingSidebar] = useLocalStorage("showingSidebar", isLargeScreen);
const hideSidebar = () => setShowingSidebar(false);
Expand Down Expand Up @@ -60,7 +61,8 @@ export const WorkspaceLayout = ({ workspaceId, children }: WorkspaceLayoutProps)
)}
</ClientOnly>
</div>
<div className="flex flex-col items-center grow pt-8 md:pt-14 lg:pt-20">
<div className="relative flex flex-col items-center grow pt-8 md:pt-14 lg:pt-20">
{banner}
<div className="px-1 sm:px-2 md:px-4 xl:px-16 container w-full min-h-[100px]">{children}</div>
</div>
<div className="flex self-end pt-2">
Expand Down
Expand Up @@ -4,7 +4,8 @@ import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict";

import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid";
import Sparkline from "components/atoms/Sparkline/sparkline";
import { getPullRequestsToDays } from "lib/utils/get-prs-to-days";
import { usePullRequestsHistogram } from "lib/hooks/api/usePullRequestsHistogram";
import { getPullRequestsHistogramToDays } from "lib/utils/get-prs-to-days";
import { classNames } from "components/organisms/RepositoriesTable/repositories-table";

import useContributorPullRequests from "lib/hooks/api/useContributorPullRequests";
Expand Down Expand Up @@ -83,12 +84,14 @@ const ContributorListTableRow = ({
repoIds: [],
range,
mostRecent: true,
limit: 50,
});
const { data: prData } = usePullRequestsHistogram({ contributor: login, range: Number(range ?? "30"), width: 1 });

const repoList = useRepoList(Array.from(new Set(data.map((prData) => prData.repo_name))).join(","));
const contributorLanguageList = user ? getTopContributorLanguages(user) : [];
const days = getPullRequestsToDays(data, Number(range ?? 30));
const totalPrs = data.length;
const days = getPullRequestsHistogramToDays(prData, Number(range ?? 30));
const totalPrs = days.reduce((acc, curr) => acc + curr.y, 0);
const last30days = [
{
id: `last30-${login}`,
Expand Down
7 changes: 5 additions & 2 deletions components/organisms/TopNav/top-nav.tsx
Expand Up @@ -9,10 +9,13 @@ import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import { useFetchUser } from "lib/hooks/useFetchUser";
import OnboardingButton from "components/molecules/OnboardingButton/onboarding-button";
import Tooltip from "components/atoms/Tooltip/tooltip";
import { useMediaQuery } from "lib/hooks/useMediaQuery";

const TopNav = () => {
const isLargeScreen = useMediaQuery("(min-width: 1024px)");
const { user } = useSupabaseAuth();
const { onboarded } = useSession();

return (
<header className="top-nav-container w-full fixed top-0 left-0 z-50 py-0.5 bg-light-slate-2 border-b px-2">
<div className="flex gap-2 justify-between items-center mx-auto px-2">
Expand All @@ -21,7 +24,7 @@ const TopNav = () => {
<Nav className="flex" />
{user && onboarded === false && (
<div className="relative lg:hidden">
<Tooltip content="Complete the onboarding" defaultOpen={true}>
<Tooltip content="Complete the onboarding" defaultOpen={!isLargeScreen}>
<OnboardingButton ariaLabel="Complete the onboarding" />
</Tooltip>
</div>
Expand Down Expand Up @@ -51,7 +54,7 @@ const Nav = ({ className }: { className?: string }) => {
className={`font-medium text-sm text-slate-700 hover:text-orange-500 transition-all ${getActiveStyle(
router.asPath.startsWith("/workspaces/") || router.asPath.includes("/pages")
)}`}
href={"/"}
href={"/workspaces"}
>
Workspace
</Link>
Expand Down
6 changes: 3 additions & 3 deletions components/shared/AppSidebar/AppSidebar.tsx
Expand Up @@ -121,7 +121,7 @@ export const AppSideBar = ({ workspaceId, hideSidebar, sidebarCollapsed }: AppSi
return;
}

router.push(`/workspaces/${value}/repositories`);
router.push(`/workspaces/${value}`);
}}
/>
</label>
Expand All @@ -133,7 +133,7 @@ export const AppSideBar = ({ workspaceId, hideSidebar, sidebarCollapsed }: AppSi
<ul className="grid gap-1 mb-6">
<SidebarMenuItem
title="Home"
url={`/workspaces/${workspaceId}/repositories`}
url={`/workspaces/${workspaceId}`}
icon={<BiHomeAlt className="w-5 h-5 text-slate-400" />}
/>
<li className="flex flex-row justify-between items-center ">
Expand Down Expand Up @@ -236,7 +236,7 @@ export const AppSideBar = ({ workspaceId, hideSidebar, sidebarCollapsed }: AppSi
</DropdownMenuItem>
<DropdownMenuItem className="rounded-md group">
<Link
title="Report a bug on our Github repository"
title="Report a bug on our GitHub repository"
href="https://github.com/open-sauced/app/issues/new?assignees=&labels=%F0%9F%91%80+needs+triage%2C%F0%9F%90%9B+bug&projects=&template=bug_report.yml&title=Bug%3A+"
className="text-sm font-medium flex gap-1 items-center rounded-md transition-colors cursor-pointer tracking-tight p-1"
>
Expand Down
2 changes: 2 additions & 0 deletions lib/hooks/api/usePullRequestsHistogram.ts
Expand Up @@ -84,6 +84,8 @@ const usePullRequestsHistogram = ({

if (contributor) {
query.set("contributor", contributor);
query.delete("topic");
query.delete("filter");
}

if (direction) {
Expand Down
26 changes: 26 additions & 0 deletions lib/utils/workspace-utils.test.ts
@@ -0,0 +1,26 @@
import { randomUUID } from "crypto";
import { RequestCookies } from "next/dist/compiled/@edge-runtime/cookies";
import { WORKSPACE_ID_COOKIE_NAME, getWorkspaceUrl } from "./workspace-utils";

describe("[lib/utils] getWorkspaceUrl()", () => {
const baseUrl = "http://localhost:3000";
const personalWorkspaceId = randomUUID();

it("should return a workspace URL if a workspace was previously visited", () => {
const workspaceId = randomUUID();
const cookies = new RequestCookies(new Headers());
cookies.set(WORKSPACE_ID_COOKIE_NAME, workspaceId);

expect(getWorkspaceUrl(cookies, baseUrl, personalWorkspaceId)).toEqual(
new URL(`/workspaces/${workspaceId}`, baseUrl)
);
});

it("should return a personal workspace URL if a workspace was not previously visited", () => {
const cookies = new RequestCookies(new Headers());

expect(getWorkspaceUrl(cookies, baseUrl, personalWorkspaceId)).toEqual(
new URL(`/workspaces/${personalWorkspaceId}`, baseUrl)
);
});
});
2 changes: 1 addition & 1 deletion lib/utils/workspace-utils.ts
Expand Up @@ -172,7 +172,7 @@ export function getWorkspaceUrl(cookies: RequestCookies, baseUrl: string, person
// @ts-expect-error the cookie value will be defined
const workspaceId = cookies.get(WORKSPACE_ID_COOKIE_NAME).value;

return new URL(`/workspaces/${workspaceId}/repositories`, baseUrl);
return new URL(`/workspaces/${workspaceId}`, baseUrl);
}

export async function getInsightWithWorkspace({ insightId }: { insightId: number }) {
Expand Down
14 changes: 12 additions & 2 deletions middleware.ts
Expand Up @@ -82,6 +82,13 @@ export async function middleware(req: NextRequest) {
data: { session },
} = await supabase.auth.getSession();

if (session?.user && req.nextUrl.pathname === "/workspaces") {
const data = await loadSession(req, session?.access_token);
const workspaceUrl = getWorkspaceUrl(req.cookies, req.url, data.personal_workspace_id);

return NextResponse.redirect(`${workspaceUrl}`);
}

if (session?.user && req.nextUrl.pathname === "/account-deleted") {
// Delete the account from Supabase and log the user out.
await supabase.auth.admin.deleteUser(session.user.id);
Expand All @@ -107,7 +114,10 @@ export async function middleware(req: NextRequest) {

if (list && list.data) {
return NextResponse.redirect(
new URL(`/workspaces/${list.data.workspaces?.id}/contributor-insights/${listId}/${rest.join("/")}`, req.url)
new URL(
`/workspaces/${list.data.workspaces?.workspace_id}/contributor-insights/${listId}/${rest.join("/")}`,
req.url
)
);
}
} else if (req.nextUrl.pathname.startsWith("/pages")) {
Expand All @@ -118,7 +128,7 @@ export async function middleware(req: NextRequest) {
if (insight && insight.data) {
return NextResponse.redirect(
new URL(
`/workspaces/${insight.data.workspaces?.id}/repository-insights/${insightId}/${rest.join("/")}`,
`/workspaces/${insight.data.workspaces?.workspace_id}/repository-insights/${insightId}/${rest.join("/")}`,
req.url
)
);
Expand Down

0 comments on commit fa36712

Please sign in to comment.