Skip to content

Commit

Permalink
feat: Add loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
pojntfx committed May 15, 2024
1 parent 7636b96 commit 4466840
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions pkg/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { ILocalContext, IRemoteContext, Registry } from "@pojntfx/panrpc";
import { JSONParser } from "@streamparser/json-whatwg";
import { useEffect, useState } from "react";
import useAsyncEffect from "use-async";
import {
Chart,
ChartAxis,
Expand All @@ -19,6 +15,8 @@ import {
DataListItem,
DataListItemCells,
DataListItemRow,
Flex,
FlexItem,
Form,
FormGroup,
HelperText,
Expand All @@ -27,6 +25,7 @@ import {
Page,
PageSection,
PageSectionVariants,
Spinner,
TextInput,
TextInputGroup,
TextInputGroupMain,
Expand All @@ -45,10 +44,14 @@ import {
PlusIcon,
TimesIcon,
} from "@patternfly/react-icons";
import { ILocalContext, IRemoteContext, Registry } from "@pojntfx/panrpc";
import { JSONParser } from "@streamparser/json-whatwg";
import Papa from "papaparse";
import { useEffect, useState } from "react";
import useAsyncEffect from "use-async";
import { useElementSize } from "usehooks-ts";
import "./main.scss";
import logo from "./logo-dark.png";
import "./main.scss";

const DARK_THEME_CLASS_NAME = "pf-v5-theme-dark";

Expand Down Expand Up @@ -785,7 +788,21 @@ const App = () => {
</Page>
</>
) : (
"Connecting ..."
<Flex
className="pf-v5-u-p-md pf-v5-u-h-100"
spaceItems={{ default: "spaceItemsMd" }}
direction={{ default: "column" }}
justifyContent={{ default: "justifyContentCenter" }}
alignItems={{ default: "alignItemsCenter" }}
>
<FlexItem>
<Spinner aria-label="Loading spinner" />
</FlexItem>

<FlexItem>
<Title headingLevel="h1">Connecting to backend ...</Title>
</FlexItem>
</Flex>
);
};

Expand Down

0 comments on commit 4466840

Please sign in to comment.