diff --git a/public/icons/cross.png b/public/icons/cross.png new file mode 100755 index 0000000..6a5c057 Binary files /dev/null and b/public/icons/cross.png differ diff --git a/src/components/design/index.ts b/src/components/design/index.ts new file mode 100644 index 0000000..4e20d2b --- /dev/null +++ b/src/components/design/index.ts @@ -0,0 +1 @@ +export * from './Loader' diff --git a/src/components/layout/Downloaders/Downloaders.tsx b/src/components/layout/Downloaders/Downloaders.tsx index c665a6c..4d0fccb 100644 --- a/src/components/layout/Downloaders/Downloaders.tsx +++ b/src/components/layout/Downloaders/Downloaders.tsx @@ -1,4 +1,5 @@ import { Fragment, useState } from 'react' +import classNames from 'classnames' import { Image, Popup } from '../../system' import { Button } from '../Button' @@ -6,10 +7,13 @@ import { GameAssetsDownloader, GameDataDownloader } from '../../../config/GameDo import { handleConvertion } from '../../../tools/handleConvertion' import { Downloader } from './Downloader' import type { ConvertionHandler } from '../../../types/global' +import { Loader } from '../../design' export const Downloaders: React.FC = () => { const [message, setMessage] = useState('') - const [loading, setLoading] = useState(false) + const [error, setError] = useState(false) + const [popup, setPopup] = useState(false) + const [loading, setLoading] = useState(true) const callback: ConvertionHandler = (message, state = 'idle') => { switch (state) { @@ -21,13 +25,47 @@ export const Downloaders: React.FC = () => { return setLoading(false) case 'error': setMessage(message) + setError(true) return setLoading(false) } } + const downloadGameData = async (): Promise => { + setPopup(true) + setLoading(true) + + const startTime = new Date() + await handleConvertion('com', callback) + + const endTime = new Date() + const seconds = ((endTime.getTime() - startTime.getTime()) / 1000).toFixed(2) + + return callback(`Completed in: ${seconds} seconds`, 'success') + } + return ( - xd + + + {message} + + + + +