Skip to content

Commit

Permalink
chore: release 2.10.0 (#2997)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed Mar 21, 2024
2 parents 9f6c362 + 9afe94c commit c848368
Show file tree
Hide file tree
Showing 36 changed files with 884 additions and 196 deletions.
80 changes: 80 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,86 @@

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

## [2.10.0-beta.1](https://github.com/open-sauced/app/compare/v2.9.0...v2.10.0-beta.1) (2024-03-21)


### 🧑‍💻 Code Refactoring

* move [pageId] pages to dedicated /explore/topic route ([#2974](https://github.com/open-sauced/app/issues/2974)) ([bd449a4](https://github.com/open-sauced/app/commit/bd449a4131af569aaac43ed9012a445b7a94f58b))


### 🐛 Bug Fixes

* add workspace welcome modal image ([#2971](https://github.com/open-sauced/app/issues/2971)) ([857954f](https://github.com/open-sauced/app/commit/857954f5eb85969755b16645b8b9ce66f7912210))
* now workspace settings and new page have a fixed footer for CTAs ([#2982](https://github.com/open-sauced/app/issues/2982)) ([7fff9fa](https://github.com/open-sauced/app/commit/7fff9fa2a1711a8f2174bbf262f54b782d213856))
* now you can use free text to select an organization for tracking repos ([#2972](https://github.com/open-sauced/app/issues/2972)) ([ab0438a](https://github.com/open-sauced/app/commit/ab0438ab0104cd29bc856b4965fad08fd6aefed6))
* track bulk add input for Tracked Wizard Modal in localStorage ([#2976](https://github.com/open-sauced/app/issues/2976)) ([77ed601](https://github.com/open-sauced/app/commit/77ed601343489e6e41cba5373a76d4b1796d9f15))


### 🍕 Features

* bump to 2.10.0 ([#2999](https://github.com/open-sauced/app/issues/2999)) ([0bc4f3e](https://github.com/open-sauced/app/commit/0bc4f3e9921a6d32b95a50629dd80dcbeefcda4a))
* drawer component ([#2992](https://github.com/open-sauced/app/issues/2992)) ([ea686a8](https://github.com/open-sauced/app/commit/ea686a8c103f8381791e3496b5444ee5ab164981))
* replace outside click to button for tracked modal ([#2980](https://github.com/open-sauced/app/issues/2980)) ([7049199](https://github.com/open-sauced/app/commit/704919981665048da89e7eac5e928cb808358b43))
* use URL shortener when Share button is used ([#2990](https://github.com/open-sauced/app/issues/2990)) ([f237b2b](https://github.com/open-sauced/app/commit/f237b2bd40b7c5cf1e8deefede46f337625f4a07))

## [2.9.0-beta.15](https://github.com/open-sauced/app/compare/v2.9.0-beta.14...v2.9.0-beta.15) (2024-03-21)


### 🍕 Features

* bump to 2.10.0 ([#2999](https://github.com/open-sauced/app/issues/2999)) ([0bc4f3e](https://github.com/open-sauced/app/commit/0bc4f3e9921a6d32b95a50629dd80dcbeefcda4a))

## [2.9.0-beta.14](https://github.com/open-sauced/app/compare/v2.9.0-beta.13...v2.9.0-beta.14) (2024-03-21)


### 🍕 Features

* drawer component ([#2992](https://github.com/open-sauced/app/issues/2992)) ([ea686a8](https://github.com/open-sauced/app/commit/ea686a8c103f8381791e3496b5444ee5ab164981))
* use URL shortener when Share button is used ([#2990](https://github.com/open-sauced/app/issues/2990)) ([f237b2b](https://github.com/open-sauced/app/commit/f237b2bd40b7c5cf1e8deefede46f337625f4a07))

## [2.9.0-beta.13](https://github.com/open-sauced/app/compare/v2.9.0-beta.12...v2.9.0-beta.13) (2024-03-20)


### 🐛 Bug Fixes

* track bulk add input for Tracked Wizard Modal in localStorage ([#2976](https://github.com/open-sauced/app/issues/2976)) ([77ed601](https://github.com/open-sauced/app/commit/77ed601343489e6e41cba5373a76d4b1796d9f15))

## [2.9.0-beta.12](https://github.com/open-sauced/app/compare/v2.9.0-beta.11...v2.9.0-beta.12) (2024-03-20)


### 🧑‍💻 Code Refactoring

* move [pageId] pages to dedicated /explore/topic route ([#2974](https://github.com/open-sauced/app/issues/2974)) ([bd449a4](https://github.com/open-sauced/app/commit/bd449a4131af569aaac43ed9012a445b7a94f58b))

## [2.9.0-beta.11](https://github.com/open-sauced/app/compare/v2.9.0-beta.10...v2.9.0-beta.11) (2024-03-20)


### 🍕 Features

* replace outside click to button for tracked modal ([#2980](https://github.com/open-sauced/app/issues/2980)) ([7049199](https://github.com/open-sauced/app/commit/704919981665048da89e7eac5e928cb808358b43))

## [2.9.0-beta.10](https://github.com/open-sauced/app/compare/v2.9.0-beta.9...v2.9.0-beta.10) (2024-03-20)


### 🐛 Bug Fixes

* now workspace settings and new page have a fixed footer for CTAs ([#2982](https://github.com/open-sauced/app/issues/2982)) ([7fff9fa](https://github.com/open-sauced/app/commit/7fff9fa2a1711a8f2174bbf262f54b782d213856))

## [2.9.0-beta.9](https://github.com/open-sauced/app/compare/v2.9.0-beta.8...v2.9.0-beta.9) (2024-03-20)


### 🐛 Bug Fixes

* now you can use free text to select an organization for tracking repos ([#2972](https://github.com/open-sauced/app/issues/2972)) ([ab0438a](https://github.com/open-sauced/app/commit/ab0438ab0104cd29bc856b4965fad08fd6aefed6))

## [2.9.0-beta.8](https://github.com/open-sauced/app/compare/v2.9.0-beta.7...v2.9.0-beta.8) (2024-03-19)


### 🐛 Bug Fixes

* add workspace welcome modal image ([#2971](https://github.com/open-sauced/app/issues/2971)) ([857954f](https://github.com/open-sauced/app/commit/857954f5eb85969755b16645b8b9ce66f7912210))

## [2.9.0](https://github.com/open-sauced/app/compare/v2.8.0...v2.9.0) (2024-03-19)


Expand Down
4 changes: 3 additions & 1 deletion components/ListHeader/list-header.tsx
Expand Up @@ -11,6 +11,7 @@ import { truncateString } from "lib/utils/truncate-string";
import { useToast } from "lib/hooks/useToast";
import ClientOnly from "components/atoms/ClientOnly/client-only";
import StackedOwners from "components/Workspaces/StackedOwners";
import { shortenUrl } from "lib/utils/shorten-url";

interface ListHeaderProps {
name: string;
Expand Down Expand Up @@ -39,7 +40,8 @@ const ListHeader = ({
posthog!.capture("clicked: Lists copied");

try {
await navigator.clipboard.writeText(url);
const shortUrl = await shortenUrl(url);
await navigator.clipboard.writeText(shortUrl);
toast({ description: "Copied to clipboard", variant: "success" });
} catch (error) {
// eslint-disable-next-line no-console
Expand Down
8 changes: 6 additions & 2 deletions components/Workspaces/TrackedContributorsModal.tsx
Expand Up @@ -20,8 +20,12 @@ const TrackedContributorsModal = ({

return (
<Dialog open={isOpen}>
<DialogContent autoStyle={false} onEscapeKeyDown={onCloseModal} onPointerDownOutside={onCloseModal}>
<TrackedContributorsWizard onAddToTrackingList={onAddToTrackingList} onCancel={onCancel} />
<DialogContent autoStyle={false} onEscapeKeyDown={onCloseModal}>
<TrackedContributorsWizard
onAddToTrackingList={onAddToTrackingList}
onCancel={onCancel}
onCloseModal={onCloseModal}
/>
</DialogContent>
</Dialog>
);
Expand Down
@@ -1,17 +1,16 @@
import { useState } from "react";
import { useLocalStorage } from "react-use";
import Button from "components/atoms/Button/button";

interface PasteContributorsStepProps {
onBulkAddContributors: (contributors: string[]) => void;
}

export const PasteContributorsStep = ({ onBulkAddContributors }: PasteContributorsStepProps) => {
const [pastedInput, setPastedInput] = useState("");
const [pastedInput = "", setPastedInput] = useLocalStorage("bulk-add-contributors", "");

const parseInput = () => {
// split each line into a trimmed string and filter out any empty lines
const contributors = pastedInput
.split(pastedInput.includes(",") ? "," : "\n")
.split(/[,\n ]/g)
.map((line) => line.trim())
.filter((line) => line !== "");

Expand All @@ -23,7 +22,7 @@ export const PasteContributorsStep = ({ onBulkAddContributors }: PasteContributo
<textarea
value={pastedInput}
onChange={(e) => setPastedInput(e.target.value)}
placeholder="Paste contributors here line by line (e.g. open-sauced/app)"
placeholder="Paste contributors here line by line (e.g. bdougie)"
className="p-4 border rounded-xl h-full outline-none focus-visible:ring focus-visible:border-orange-500 focus-visible:ring-orange-100"
/>
<Button
Expand Down
@@ -1,4 +1,5 @@
import { useState } from "react";
import { useLocalStorage } from "react-use";
import { useSearchContributors } from "lib/hooks/useSearchContributors";
import { TrackedContributorsWizardLayout } from "./TrackedContributorsWizardLayout";

Expand All @@ -11,6 +12,7 @@ import { SelectFollowingStep } from "./SelectFollowingStep";
interface TrackedContributorsWizardProps {
onAddToTrackingList: (contributors: Map<string, boolean>) => void;
onCancel: () => void;
onCloseModal: () => void;
}

type TrackedContributorsStep =
Expand All @@ -21,14 +23,20 @@ type TrackedContributorsStep =
| "filterPastedContributors"
| "selectFollowing";

export const TrackedContributorsWizard = ({ onAddToTrackingList, onCancel }: TrackedContributorsWizardProps) => {
export const TrackedContributorsWizard = ({
onAddToTrackingList,
onCancel,
onCloseModal,
}: TrackedContributorsWizardProps) => {
const [step, setStep] = useState<TrackedContributorsStep>("pickOption");
const [currentTrackedContributors, setCurrentTrackedContributors] = useState<Map<string, boolean>>(new Map());
const suggestedContributors: any[] = [];

const [searchTerm, setSearchTerm] = useState<string | undefined>();
const { data, isError, isLoading } = useSearchContributors(searchTerm);

const [, , removePastedInput] = useLocalStorage("bulk-add-contributors", "");

const onToggleContributor = (contributor: string, isSelected: boolean) => {
setSearchTerm(undefined);

Expand Down Expand Up @@ -152,12 +160,14 @@ export const TrackedContributorsWizard = ({ onAddToTrackingList, onCancel }: Tra
return (
<TrackedContributorsWizardLayout
onAddToTrackingList={() => {
removePastedInput();
onAddToTrackingList(currentTrackedContributors);
}}
trackedContributorsCount={trackedContributors.size}
onCancel={() => {
goBack();
}}
onCloseModal={onCloseModal}
>
{renderStep(step)}
</TrackedContributorsWizardLayout>
Expand Down
@@ -1,9 +1,11 @@
import { FaArrowLeft } from "react-icons/fa6";
import { MdOutlineClose } from "react-icons/md";
import Card from "components/atoms/Card/card";
import Button from "components/atoms/Button/button";

interface TrackedContributorsWizardLayoutProps {
onCancel: () => void;
onCloseModal: () => void;
trackedContributorsCount: number;
onAddToTrackingList: () => void;
children: React.ReactNode;
Expand All @@ -13,20 +15,27 @@ export const TrackedContributorsWizardLayout = ({
trackedContributorsCount,
onAddToTrackingList,
onCancel,
onCloseModal,
children,
}: TrackedContributorsWizardLayoutProps) => {
return (
<Card className="!p-0 max-w-3xl">
{/* Using !p-0 for now as the Card component has explicit padding of p-3. We can revisit. */}
<div style={{ minWidth: "712px" }}>
<button
className="flex gap-1 items-center ml-4 mt-4 border border-transparent"
onClick={() => {
onCancel();
}}
>
<FaArrowLeft /> back
</button>
<section className="flex w-full justify-between">
<button
className="flex gap-1 items-center ml-4 mt-4 border border-transparent"
onClick={() => {
onCancel();
}}
>
<FaArrowLeft /> back
</button>

<button onClick={onCloseModal} className="mr-4 mt-4">
<MdOutlineClose className="w-6 h-6" />
</button>
</section>
<div className="flex flex-col justify-between gap-4">
<div className="px-4 pt-2">
<h2 className="font-semibold mb-4">Add contributors to track</h2>
Expand Down
8 changes: 4 additions & 4 deletions components/Workspaces/TrackedRepoWizard/PasteReposStep.tsx
@@ -1,15 +1,15 @@
import { useState } from "react";
import { useLocalStorage } from "react-use";
import Button from "components/atoms/Button/button";

interface PasteReposStepProps {
onBulkAddRepos: (repos: string[]) => void;
}

export const PasteReposStep = ({ onBulkAddRepos }: PasteReposStepProps) => {
const [pastedInput, setPastedInput] = useState("");
const [pastedInput, setPastedInput] = useLocalStorage("bulk-add-repos", "");

const parseInput = () => {
const repos = pastedInput
const repos = pastedInput!
.split(/[,\n ]/g) // split by either comma, new line, or space
.map((line) => {
line.trim(); // trim to remove whitespace
Expand All @@ -36,7 +36,7 @@ export const PasteReposStep = ({ onBulkAddRepos }: PasteReposStepProps) => {
<Button
onClick={() => onBulkAddRepos(parseInput())}
variant="primary"
disabled={pastedInput.trim().length === 0}
disabled={pastedInput!.trim().length === 0}
className="w-fit self-end"
>
Import
Expand Down
Expand Up @@ -55,7 +55,11 @@ export const SelectOrgReposStep = ({
const [filteredRepositories, setFilteredRepositories] = useState<Map<string, boolean>>(repositories);

useEffect(() => {
setFilteredRepositories(new Map([...repositories.entries()].filter(([repo]) => repo.startsWith(organization))));
const lowercasedOrg = organization.toLowerCase();

setFilteredRepositories(
new Map([...repositories.entries()].filter(([repo]) => repo.toLowerCase().startsWith(lowercasedOrg)))
);
}, [repositories, organization]);

const onFilterRepos = (search: string) => {
Expand Down
34 changes: 31 additions & 3 deletions components/Workspaces/TrackedRepoWizard/TrackedRepoWizard.tsx
@@ -1,3 +1,4 @@
import { useLocalStorage } from "react-use";
import { useEffect, useState } from "react";
import { useSearchRepos } from "lib/hooks/useSearchRepos";
import { useUserOrganizations } from "lib/hooks/useUserOrganizations";
Expand All @@ -14,6 +15,7 @@ import { SearchOrgStep } from "./SearchOrgStep";
interface TrackedReposWizardProps {
onAddToTrackingList: (repos: Map<string, boolean>) => void;
onCancel: () => void;
onCloseModal: () => void;
}

type TrackedReposStep =
Expand All @@ -24,17 +26,28 @@ type TrackedReposStep =
| "filterPastedRepos"
| "pickOrgRepos";

export const TrackedReposWizard = ({ onAddToTrackingList, onCancel }: TrackedReposWizardProps) => {
async function organizationExists(orgSearchTerm: string) {
const response = await fetch(`https://api.github.com/orgs/${orgSearchTerm}`);

return response.status === 200;
}

export const TrackedReposWizard = ({ onAddToTrackingList, onCancel, onCloseModal }: TrackedReposWizardProps) => {
const [step, setStep] = useState<TrackedReposStep>("pickReposOrOrg");
const [organization, setOrganization] = useState<string | undefined>();
const [currentTrackedRepositories, setCurrentTrackedRepositories] = useState<Map<string, boolean>>(new Map());

const suggestedRepos: any[] = [];
const [searchTerm, setSearchTerm] = useState<string | undefined>();
const [orgSearchTerm, setOrgSearchTerm] = useState<string | undefined>();
const [filteredOrgs, setFilteredOrgs] = useState<Set<string>>(new Set());

const [pastedInput, setPastedInput, removePastedInput] = useLocalStorage("bulk-add-repos", "");

const { data, isError, isLoading } = useSearchRepos(searchTerm);
const username: string | null = useStore((state) => state.user?.user_metadata.user_name);
const { data: rawUserOrgs, isError: orgsError, isLoading: orgsLoading } = useUserOrganizations(username);

const {
data: rawOrgRepos,
isError: isOrgReposError,
Expand Down Expand Up @@ -66,8 +79,21 @@ export const TrackedReposWizard = ({ onAddToTrackingList, onCancel }: TrackedRep
useEffect(() => {
if (rawUserOrgs) {
const orgs = rawUserOrgs.map((org) => org.organization_user.login);
const orgRepos = new Set(orgs.filter((repo) => !orgSearchTerm || repo.includes(orgSearchTerm)));
setFilteredOrgs(orgRepos);
const orgRepos = new Set(
orgs.filter((repo) => !orgSearchTerm || repo.toLowerCase().includes(orgSearchTerm.toLowerCase()))
);

if (orgSearchTerm && orgRepos.size === 0) {
organizationExists(orgSearchTerm).then((orgExists) => {
if (orgExists) {
setFilteredOrgs(new Set([orgSearchTerm]));
} else {
setFilteredOrgs(orgRepos);
}
});
} else {
setFilteredOrgs(orgRepos);
}
}
}, [rawUserOrgs, orgSearchTerm]);

Expand Down Expand Up @@ -215,12 +241,14 @@ export const TrackedReposWizard = ({ onAddToTrackingList, onCancel }: TrackedRep
return (
<TrackedRepoWizardLayout
onAddToTrackingList={() => {
removePastedInput();
onAddToTrackingList(currentTrackedRepositories);
}}
trackedReposCount={trackedRepos.size}
onCancel={() => {
goBack();
}}
onCloseModal={onCloseModal}
>
{renderStep(step)}
</TrackedRepoWizardLayout>
Expand Down

0 comments on commit c848368

Please sign in to comment.