import React from "react";
import {
Box,
CircularProgress,
CircularProgressLabel,
Flex,
Stack,
} from "@chakra-ui/react";
import gql from "graphql-tag";
import { useQuery } from "@apollo/client";
import { ErrorMessage, Heading1 } from "./util";
function ConversionPage() {
const { loading, error, data } = useQuery(
gql`
query ConversionPage {
numAppearanceLayersConverted
numAppearanceLayersTotal
numPetLayersConverted: numAppearanceLayersConverted(type: PET_LAYER)
numPetLayersTotal: numAppearanceLayersTotal(type: PET_LAYER)
numItemLayersConverted: numAppearanceLayersConverted(type: ITEM_LAYER)
numItemLayersTotal: numAppearanceLayersTotal(type: ITEM_LAYER)
}
`,
{ onError: (e) => console.error(e) }
);
return (
HTML5 Conversion Hub
{error && (
Oops, we couldn't load the latest data: {error.message}
)}
);
}
function ConversionProgress({
label,
color,
size,
numConverted,
numTotal,
isLoading,
}) {
const convertedPercent = (numConverted / numTotal) * 100;
return (
{numConverted != null && numTotal != null && (
{Math.floor(convertedPercent)}%
)}
{label}
{numConverted != null && numTotal != null && (
{numConverted.toLocaleString()} of {numTotal.toLocaleString()}
)}
);
}
export default ConversionPage;