More cleanup and history added

This commit is contained in:
Jannes Vandepitte
2022-08-25 21:07:41 +02:00
parent 4afa09fd7a
commit c44a01fbc3
10 changed files with 357 additions and 226 deletions

View File

@@ -28,7 +28,8 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
history.push({
id: slot.nzo_id,
name: slot.name,
size: slot.bytes * 1000,
size: slot.bytes,
time: slot.download_time,
});
});
})

View File

@@ -36,7 +36,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
eta: eta.asSeconds(),
name: slot.filename,
progress: parseFloat(slot.percentage),
size: parseFloat(slot.mb),
size: parseFloat(slot.mb) * 1000 * 1000,
state: slot.status.toLowerCase() as any,
});
});

View File

@@ -3,6 +3,8 @@ import { GetServerSidePropsContext } from 'next';
import { useEffect } from 'react';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import AppShelf from '../components/AppShelf/AppShelf';
import LoadConfigComponent from '../components/Config/LoadConfig';
import { Config } from '../tools/types';
@@ -62,6 +64,8 @@ export async function getServerSideProps({
return getConfig(configName as string, translations);
}
const queryClient = new QueryClient();
export default function HomePage(props: any) {
const { config: initialConfig }: { config: Config } = props;
const { setConfig } = useConfig();
@@ -73,9 +77,11 @@ export default function HomePage(props: any) {
setConfig(migratedConfig);
}, [initialConfig]);
return (
<Layout>
<AppShelf />
<LoadConfigComponent />
</Layout>
<QueryClientProvider client={queryClient}>
<Layout>
<AppShelf />
<LoadConfigComponent />
</Layout>
</QueryClientProvider>
);
}