use same Loading progress bar everywhere
This commit is contained in:
@@ -4,6 +4,7 @@ import { apiAuth, User } from "./api";
|
|||||||
import { TeamState, useSession } from "./Session";
|
import { TeamState, useSession } from "./Session";
|
||||||
import TabController from "./TabController";
|
import TabController from "./TabController";
|
||||||
import { Chemistry, MVPRanking, PlayerType } from "./types";
|
import { Chemistry, MVPRanking, PlayerType } from "./types";
|
||||||
|
import Loading from "./Loading";
|
||||||
|
|
||||||
type PlayerListProps = Partial<ReactSortableProps<any>> & {
|
type PlayerListProps = Partial<ReactSortableProps<any>> & {
|
||||||
orderedList?: boolean;
|
orderedList?: boolean;
|
||||||
@@ -300,9 +301,7 @@ function MVPDnD({ user, teams, players }: PlayerInfoProps) {
|
|||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
/>
|
/>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="container">
|
Loading
|
||||||
<progress className="progress is-primary" max="100"></progress>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="columns container is-mobile is-1-mobile">
|
<div className="columns container is-mobile is-1-mobile">
|
||||||
<div className="column">
|
<div className="column">
|
||||||
@@ -422,9 +421,7 @@ function ChemistryDnDMobile({ user, teams, players }: PlayerInfoProps) {
|
|||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
/>
|
/>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="container">
|
Loading
|
||||||
<progress className="progress is-primary" max="100"></progress>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="columns container is-multiline is-mobile is-1-mobile">
|
<div className="columns container is-multiline is-mobile is-1-mobile">
|
||||||
<div className="column is-full is-flex is-justify-content-center">
|
<div className="column is-full is-flex is-justify-content-center">
|
||||||
@@ -526,9 +523,7 @@ export default function Rankings() {
|
|||||||
<TypeDnD {...{ user, teams, players }} />
|
<TypeDnD {...{ user, teams, players }} />
|
||||||
</TabController>
|
</TabController>
|
||||||
) : (
|
) : (
|
||||||
<div className="container">
|
Loading
|
||||||
<progress className="progress is-primary" max="100"></progress>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
6
frontend/src/Loading.tsx
Normal file
6
frontend/src/Loading.tsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const Loading = (
|
||||||
|
<div className="container">
|
||||||
|
<progress className="progress is-primary" max="100"></progress>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
export default Loading;
|
||||||
@@ -3,6 +3,7 @@ import { baseUrl, currentUser, login, User } from "./api";
|
|||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import { useLocation, useNavigate } from "react-router";
|
import { useLocation, useNavigate } from "react-router";
|
||||||
import { Eye, EyeSlash } from "./Icons";
|
import { Eye, EyeSlash } from "./Icons";
|
||||||
|
import Loading from "./Loading";
|
||||||
|
|
||||||
export interface LoginProps {
|
export interface LoginProps {
|
||||||
onLogin: (user: User) => void;
|
onLogin: (user: User) => void;
|
||||||
@@ -101,7 +102,7 @@ export const Login = ({ onLogin }: LoginProps) => {
|
|||||||
login
|
login
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{loading && <span className="loader" />}
|
{loading && Loading}
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { PlayerRanking } from "./types";
|
|||||||
import RaceChart from "./RaceChart";
|
import RaceChart from "./RaceChart";
|
||||||
import { useSession } from "./Session";
|
import { useSession } from "./Session";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
import Loading from "./Loading";
|
||||||
|
|
||||||
const MVPChart = () => {
|
const MVPChart = () => {
|
||||||
let initialData = {} as PlayerRanking[][];
|
let initialData = {} as PlayerRanking[][];
|
||||||
@@ -54,7 +55,7 @@ const MVPChart = () => {
|
|||||||
loadData();
|
loadData();
|
||||||
}, [teams]);
|
}, [teams]);
|
||||||
|
|
||||||
if (loading) return <span className="loader" />;
|
if (loading) return Loading;
|
||||||
else if (error) return <span>{error}</span>;
|
else if (error) return <span>{error}</span>;
|
||||||
else
|
else
|
||||||
return data.map((_data) => <RaceChart std={showStd} playerRanks={_data} />);
|
return data.map((_data) => <RaceChart std={showStd} playerRanks={_data} />);
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ export const GraphComponent = () => {
|
|||||||
<br />
|
<br />
|
||||||
<i>Ctrl</i> or <i>Shift</i>
|
<i>Ctrl</i> or <i>Shift</i>
|
||||||
</p>
|
</p>
|
||||||
|
<br />
|
||||||
<p>drag to pan/rotate</p>
|
<p>drag to pan/rotate</p>
|
||||||
<hr className="has-background-info" />
|
<hr className="has-background-info" />
|
||||||
<p>popularity is meassured by rank-weighted in-degree</p>
|
<p>popularity is meassured by rank-weighted in-degree</p>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { apiAuth, currentUser, loadPlayers, logout, User } from "./api";
|
|||||||
import { Login } from "./Login";
|
import { Login } from "./Login";
|
||||||
import Header from "./Header";
|
import Header from "./Header";
|
||||||
import { Team } from "./types";
|
import { Team } from "./types";
|
||||||
|
import Loading from "./Loading";
|
||||||
|
|
||||||
export interface SessionProviderProps {
|
export interface SessionProviderProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@@ -98,12 +99,7 @@ export function SessionProvider(props: SessionProviderProps) {
|
|||||||
|
|
||||||
let content: ReactNode;
|
let content: ReactNode;
|
||||||
if (loading || (!error && !user))
|
if (loading || (!error && !user))
|
||||||
content = (
|
content = <section className="section is-medium">{Loading}</section>;
|
||||||
<>
|
|
||||||
<Header />
|
|
||||||
<span className="loader" />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
else if (error) {
|
else if (error) {
|
||||||
content = (
|
content = (
|
||||||
<section className="section is-medium">
|
<section className="section is-medium">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useSession } from "./Session";
|
|||||||
import { ErrorState } from "./types";
|
import { ErrorState } from "./types";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import Calendar from "./Calendar";
|
import Calendar from "./Calendar";
|
||||||
|
import Loading from "./Loading";
|
||||||
|
|
||||||
const TeamPanel = () => {
|
const TeamPanel = () => {
|
||||||
const { user, teams, players, reloadPlayers } = useSession();
|
const { user, teams, players, reloadPlayers } = useSession();
|
||||||
@@ -110,7 +111,7 @@ const TeamPanel = () => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<span className="loader" />
|
Loading
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -250,6 +251,6 @@ const TeamPanel = () => {
|
|||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else <span className="loader" />;
|
} else Loading;
|
||||||
};
|
};
|
||||||
export default TeamPanel;
|
export default TeamPanel;
|
||||||
|
|||||||
Reference in New Issue
Block a user