Skip to content

Commit

Permalink
LoadingState component
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek committed Nov 15, 2023
1 parent eb468f9 commit f2b16d3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/dashboard/src/app/AppLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { FunctionComponent, useEffect, useState } from "react";
import { Heading3, Subheading } from "../components/typography/headings";
import gitpodIcon from "../icons/gitpod.svg";
import { Delayed } from "../components/Delayed";
import { Delayed } from "@podkit/loading/Delayed";

function useDelay(wait: number) {
const [done, setDone] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright (c) 2023 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 { Loader2 } from "lucide-react";
import { Delayed } from "./Delayed";

export const LoadingState = () => {
return (
<Delayed>
<Loader2 className="animate-spin" />
</Delayed>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useConfetti } from "../contexts/ConfettiContext";
import { SetupCompleteStep } from "./SetupCompleteStep";
import { useOIDCClientsQuery } from "../data/oidc-clients/oidc-clients-query";
import { useCurrentOrg } from "../data/organizations/orgs-query";
import { Delayed } from "../components/Delayed";
import { SpinnerLoader } from "../components/Loader";
import { getGitpodService } from "../service/service";
import { UserContext } from "../user-context";
Expand All @@ -21,6 +20,7 @@ import { useQueryParams } from "../hooks/use-query-params";
import { useDocumentTitle } from "../hooks/use-document-title";
import { forceDedicatedSetupParam } from "./use-show-dedicated-setup";
import { Organization } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
import { Delayed } from "@podkit/loading/Delayed";

type Props = {
onComplete: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ConfigurationSettingsField } from "../ConfigurationSettingsField";
import { useUpdateProject } from "../../../data/projects/project-queries";
import { useToast } from "../../../components/toasts/Toasts";
import { LoadingButton } from "@podkit/buttons/LoadingButton";
import { LoadingState } from "@podkit/loading/LoadingState";

interface Props {
configuration: Configuration;
Expand Down Expand Up @@ -58,12 +59,12 @@ export const ConfigurationWorkspaceSizeOptions = ({ configuration }: Props) => {
[configuration.id, selectedValue, toast, updateProject],
);

if (isError) {
if (isError || !classes) {
return <div>Something went wrong</div>;
}

if (isLoading || !classes) {
return <div>Loading...</div>;
if (isLoading) {
return <LoadingState />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/teams/Members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import searchIcon from "../icons/search.svg";
import { organizationClient } from "../service/public-api";
import { useCurrentUser } from "../user-context";
import { SpinnerLoader } from "../components/Loader";
import { Delayed } from "../components/Delayed";
import { InputField } from "../components/forms/InputField";
import { InputWithCopy } from "../components/InputWithCopy";
import { OrganizationMember, OrganizationRole } from "@gitpod/public-api/lib/gitpod/v1/organization_pb";
import { useListOrganizationMembers, useOrganizationMembersInvalidator } from "../data/organizations/members-query";
import { useInvitationId, useInviteInvalidator } from "../data/organizations/invite-query";
import { Delayed } from "@podkit/loading/Delayed";

export default function MembersPage() {
const user = useCurrentUser();
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/user-settings/Integrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Alert from "../components/Alert";
import { CheckboxInputField, CheckboxListField } from "../components/forms/CheckboxInputField";
import ConfirmationModal from "../components/ConfirmationModal";
import { ContextMenuEntry } from "../components/ContextMenu";
import { Delayed } from "../components/Delayed";
import InfoBox from "../components/InfoBox";
import { ItemsList } from "../components/ItemsList";
import { SpinnerLoader } from "../components/Loader";
Expand All @@ -30,6 +29,7 @@ import { SelectAccountModal } from "./SelectAccountModal";
import { useAuthProviders } from "../data/auth-providers/auth-provider-query";
import { useFeatureFlag } from "../data/featureflag-query";
import { EmptyMessage } from "../components/EmptyMessage";
import { Delayed } from "@podkit/loading/Delayed";

export default function Integrations() {
return (
Expand Down

0 comments on commit f2b16d3

Please sign in to comment.