James 223a95ef3d Adding downloading model table
Signed-off-by: James <james@jan.ai>
2023-10-06 16:46:47 +07:00

28 lines
900 B
TypeScript

import React, { Fragment } from "react";
import { modelDownloadStateAtom } from "@/_helpers/atoms/DownloadState.atom";
import { useAtomValue } from "jotai";
import ModelDownloadingTable from "../ModelDownloadingTable";
import { DownloadState } from "@/_models/DownloadState";
const DownloadingModelTable: React.FC = () => {
const modelDownloadState = useAtomValue(modelDownloadStateAtom);
const isAnyModelDownloading = Object.values(modelDownloadState).length > 0;
if (!isAnyModelDownloading) return null;
const downloadStates: DownloadState[] = [];
for (const [, value] of Object.entries(modelDownloadState)) {
downloadStates.push(value);
}
return (
<Fragment>
<h3 className="text-xl leading-[25px] mt-[50px] mb-4">Downloading Models</h3>
<ModelDownloadingTable downloadStates={downloadStates} />
</Fragment>
);
};
export default DownloadingModelTable;