From 8eeeb200d58ca217ef533e683479ec13098f9482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Sat, 4 Nov 2023 11:17:20 +0000 Subject: [PATCH 1/3] Migrate more of the Dashboard to Podkit buttons --- .../dashboard/src/components/AuthorizeGit.tsx | 7 ++--- components/dashboard/src/projects/Project.tsx | 26 +++++++++---------- .../user-settings/PersonalAccessTokens.tsx | 15 +++++------ .../src/workspaces/EmptyWorkspacesContent.tsx | 13 ++++------ .../dashboard/src/workspaces/Workspaces.tsx | 2 +- .../src/workspaces/WorkspacesSearchBar.tsx | 11 +++----- .../src/util/gitpod-host-url.ts | 4 +++ 7 files changed, 36 insertions(+), 42 deletions(-) diff --git a/components/dashboard/src/components/AuthorizeGit.tsx b/components/dashboard/src/components/AuthorizeGit.tsx index b53d2a7f59679d..d1c305f539bfd4 100644 --- a/components/dashboard/src/components/AuthorizeGit.tsx +++ b/components/dashboard/src/components/AuthorizeGit.tsx @@ -16,6 +16,7 @@ import { Button } from "./Button"; import { Heading2, Heading3, Subheading } from "./typography/headings"; import classNames from "classnames"; import { iconForAuthProvider, simplifyProviderName } from "../provider-utils"; +import { LinkButton } from "@podkit/buttons/LinkButton"; export function useNeedsGitAuthorization() { const authProviders = useAuthProviders(); @@ -60,9 +61,9 @@ export const AuthorizeGit: FC<{ className?: string }> = ({ className }) => { {!!org.data?.isOwner ? (
You need to configure at least one Git integration. - - - + + Add a Git integration +
) : ( <> diff --git a/components/dashboard/src/projects/Project.tsx b/components/dashboard/src/projects/Project.tsx index 5467c4da13dd32..e08295cf389491 100644 --- a/components/dashboard/src/projects/Project.tsx +++ b/components/dashboard/src/projects/Project.tsx @@ -23,6 +23,8 @@ import { getProjectTabs } from "./projects.routes"; import { shortCommitMessage, toRemoteURL } from "./render-utils"; import search from "../icons/search.svg"; import Tooltip from "../components/Tooltip"; +import { Button } from "@podkit/buttons/Button"; +import { LinkButton } from "@podkit/buttons/LinkButton"; export default function ProjectsPage() { const history = useHistory(); @@ -213,12 +215,9 @@ export default function ProjectsPage() { Authorize {showAuthBanner.host}
to access branch information. - + ) : ( @@ -272,12 +271,12 @@ export default function ProjectsPage() { )} {!isResuming && ( - + )} )} @@ -368,13 +367,12 @@ export default function ProjectsPage() { )} - - - + + New Workspace + {tokens.length > 0 && ( - - - + New Access Token )} {errorMsg.length > 0 && ( @@ -215,9 +214,9 @@ function ListAccessTokensView() {
Make sure to copy your access token — you won't be able to access it again.
- + )} @@ -233,9 +232,7 @@ function ListAccessTokensView() { Generate an access token for applications that need access to the Gitpod API.{" "} - - - + New Access Token ) : ( <> diff --git a/components/dashboard/src/workspaces/EmptyWorkspacesContent.tsx b/components/dashboard/src/workspaces/EmptyWorkspacesContent.tsx index 0b81eb15c0cc77..d49f22dface6ce 100644 --- a/components/dashboard/src/workspaces/EmptyWorkspacesContent.tsx +++ b/components/dashboard/src/workspaces/EmptyWorkspacesContent.tsx @@ -4,10 +4,9 @@ * See License.AGPL.txt in the project root for license information. */ -import { Link } from "react-router-dom"; import { Heading2 } from "../components/typography/headings"; import { StartWorkspaceModalKeyBinding } from "../App"; -import { Button } from "../components/Button"; +import { LinkButton } from "@podkit/buttons/LinkButton"; export const EmptyWorkspacesContent = () => { return ( @@ -30,12 +29,10 @@ export const EmptyWorkspacesContent = () => { - - - + + New Workspace{" "} + {StartWorkspaceModalKeyBinding} + diff --git a/components/dashboard/src/workspaces/Workspaces.tsx b/components/dashboard/src/workspaces/Workspaces.tsx index 885e3664303935..1fced967bd3548 100644 --- a/components/dashboard/src/workspaces/Workspaces.tsx +++ b/components/dashboard/src/workspaces/Workspaces.tsx @@ -179,7 +179,7 @@ const sortWorkspaces = (a: WorkspaceInfo, b: WorkspaceInfo) => { }; /** - * Given a WorkspaceInfo, return a timestamp of the last related activitiy + * Given a WorkspaceInfo, return a timestamp of the last related activity * * @param info WorkspaceInfo * @returns string timestamp diff --git a/components/dashboard/src/workspaces/WorkspacesSearchBar.tsx b/components/dashboard/src/workspaces/WorkspacesSearchBar.tsx index 9ac0431e5fdccf..f604ea0ef0d8b4 100644 --- a/components/dashboard/src/workspaces/WorkspacesSearchBar.tsx +++ b/components/dashboard/src/workspaces/WorkspacesSearchBar.tsx @@ -5,11 +5,10 @@ */ import { FunctionComponent } from "react"; -import { Link } from "react-router-dom"; import { StartWorkspaceModalKeyBinding } from "../App"; import DropDown from "../components/DropDown"; import search from "../icons/search.svg"; -import { Button } from "../components/Button"; +import { LinkButton } from "@podkit/buttons/LinkButton"; type WorkspacesSearchBarProps = { searchTerm: string; @@ -67,11 +66,9 @@ export const WorkspacesSearchBar: FunctionComponent = ]} /> - - - + + New Workspace {StartWorkspaceModalKeyBinding} + ); }; diff --git a/components/gitpod-protocol/src/util/gitpod-host-url.ts b/components/gitpod-protocol/src/util/gitpod-host-url.ts index 74915fdacca7b2..3219586d0aa3d6 100644 --- a/components/gitpod-protocol/src/util/gitpod-host-url.ts +++ b/components/gitpod-protocol/src/util/gitpod-host-url.ts @@ -138,6 +138,10 @@ export class GitpodHostUrl { return this.url.toString(); } + toRelative(): string { + return this.url.pathname + this.url.search + this.url.hash; + } + toStringWoRootSlash() { let result = this.toString(); if (result.endsWith("/")) { From a48130b0943f12d6d1d42ce0a3768bfd68db602b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tron=C3=AD=C4=8Dek?= Date: Sat, 4 Nov 2023 11:28:54 +0000 Subject: [PATCH 2/3] Update Link components to use LinkButton in FromReferrer and PersonalAccessTokensCreateView --- components/dashboard/src/FromReferrer.tsx | 8 ++++---- .../PersonalAccessTokensCreateView.tsx | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/dashboard/src/FromReferrer.tsx b/components/dashboard/src/FromReferrer.tsx index 3ef72dddc2665a..3227bdf8251ecc 100644 --- a/components/dashboard/src/FromReferrer.tsx +++ b/components/dashboard/src/FromReferrer.tsx @@ -4,7 +4,7 @@ * See License.AGPL.txt in the project root for license information. */ -import { Link } from "react-router-dom"; +import { LinkButton } from "@podkit/buttons/LinkButton"; export default function FromReferrer() { const contextUrl = document.referrer; @@ -36,9 +36,9 @@ export default function FromReferrer() {

- - - + + Go to Dashboard + diff --git a/components/dashboard/src/user-settings/PersonalAccessTokensCreateView.tsx b/components/dashboard/src/user-settings/PersonalAccessTokensCreateView.tsx index 80a178b14716f1..8d101e3fd12fa3 100644 --- a/components/dashboard/src/user-settings/PersonalAccessTokensCreateView.tsx +++ b/components/dashboard/src/user-settings/PersonalAccessTokensCreateView.tsx @@ -22,6 +22,7 @@ import { Timestamp } from "@bufbuild/protobuf"; import arrowDown from "../images/sort-arrow.svg"; import { Heading2, Subheading } from "../components/typography/headings"; import { useFeatureFlag } from "../data/featureflag-query"; +import { LinkButton } from "@podkit/buttons/LinkButton"; interface EditPATData { name: string; @@ -152,14 +153,12 @@ function PersonalAccessTokenCreateView() {
- - - + +
+ Back arrow + Back to list +
+
{editToken && (
{editToken && ( - + )}
{errorMsg.length > 0 && ( @@ -256,14 +258,14 @@ function PersonalAccessTokenCreateView() {
{isEditing && ( - + )} - +