-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repo suggestions improvements (#20582)
* center view button Tool: gitpod/catfood.gitpod.cloud * Small drive-by for insights export toast Tool: gitpod/catfood.gitpod.cloud * Colored suggestions Tool: gitpod/catfood.gitpod.cloud * Remove suggested repository management from repository list Tool: gitpod/catfood.gitpod.cloud * Add recommended list to getting started Tool: gitpod/catfood.gitpod.cloud * fix copy Tool: gitpod/catfood.gitpod.cloud
- Loading branch information
1 parent
58c9a18
commit ba2f367
Showing
9 changed files
with
239 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
components/dashboard/src/repositories/detail/general/ManageRepoSuggestion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* Copyright (c) 2025 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { SwitchInputField } from "@podkit/switch/Switch"; | ||
import { Heading3, Subheading } from "@podkit/typography/Headings"; | ||
import { FC, useCallback } from "react"; | ||
import { InputField } from "../../../components/forms/InputField"; | ||
import PillLabel from "../../../components/PillLabel"; | ||
import { useToast } from "../../../components/toasts/Toasts"; | ||
import { useOrgSettingsQuery } from "../../../data/organizations/org-settings-query"; | ||
import { useUpdateOrgSettingsMutation } from "../../../data/organizations/update-org-settings-mutation"; | ||
import { useId } from "../../../hooks/useId"; | ||
import { ConfigurationSettingsField } from "../ConfigurationSettingsField"; | ||
import { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb"; | ||
import { SquareArrowOutUpRight } from "lucide-react"; | ||
|
||
type Props = { | ||
configuration: Configuration; | ||
}; | ||
export const ManageRepoSuggestion: FC<Props> = ({ configuration }) => { | ||
const { data: orgSettings } = useOrgSettingsQuery(); | ||
const { toast } = useToast(); | ||
const updateTeamSettings = useUpdateOrgSettingsMutation(); | ||
const updateRecommendedRepository = useCallback( | ||
async (configurationId: string, suggested: boolean) => { | ||
const newRepositories = new Set(orgSettings?.onboardingSettings?.recommendedRepositories ?? []); | ||
if (suggested) { | ||
newRepositories.add(configurationId); | ||
} else { | ||
newRepositories.delete(configurationId); | ||
} | ||
|
||
await updateTeamSettings.mutateAsync( | ||
{ | ||
onboardingSettings: { | ||
...orgSettings?.onboardingSettings, | ||
recommendedRepositories: [...newRepositories], | ||
}, | ||
}, | ||
{ | ||
onError: (error) => { | ||
toast(`Failed to update recommended repositories: ${error.message}`); | ||
}, | ||
}, | ||
); | ||
}, | ||
[orgSettings?.onboardingSettings, toast, updateTeamSettings], | ||
); | ||
|
||
const isSuggested = orgSettings?.onboardingSettings?.recommendedRepositories?.includes(configuration.id); | ||
|
||
const inputId = useId({ prefix: "suggested-repository" }); | ||
|
||
return ( | ||
<ConfigurationSettingsField> | ||
<Heading3 className="flex flex-row items-center gap-2"> | ||
Mark this repository as{" "} | ||
<PillLabel className="capitalize bg-kumquat-light shrink-0 text-sm hidden xl:block" type="warn"> | ||
Suggested | ||
</PillLabel> | ||
</Heading3> | ||
<Subheading className="max-w-lg flex flex-col gap-2"> | ||
The Suggested section highlights recommended repositories on the dashboard for new members, making it | ||
easier to find and start working on key projects in Gitpod. | ||
<a | ||
className="gp-link flex flex-row items-center gap-1" | ||
href="https://www.gitpod.io/docs/configure/orgs/onboarding#suggested-repositories" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Learn about suggestions | ||
<SquareArrowOutUpRight size={12} /> | ||
</a> | ||
</Subheading> | ||
<InputField id={inputId}> | ||
<SwitchInputField | ||
id={inputId} | ||
checked={isSuggested} | ||
disabled={updateTeamSettings.isLoading} | ||
onCheckedChange={(checked) => { | ||
updateRecommendedRepository(configuration.id, checked); | ||
}} | ||
label={isSuggested ? "Listed in “Suggested”" : "Not listed in “Suggested”"} | ||
/> | ||
</InputField> | ||
</ConfigurationSettingsField> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.