import ProgressBar from "../ProgressBar"; import SystemItem from "../SystemItem"; import { useAtomValue } from "jotai"; import { appDownloadProgress } from "@/_helpers/JotaiWrapper"; import { currentProductAtom } from "@/_helpers/atoms/Model.atom"; import useGetAppVersion from "@/_hooks/useGetAppVersion"; import useGetSystemResources from "@/_hooks/useGetSystemResources"; import { modelDownloadStateAtom } from "@/_helpers/atoms/DownloadState.atom"; import { DownloadState } from "@/_models/DownloadState"; import { formatDownloadPercentage } from "@/_utils/converter"; const MonitorBar: React.FC = () => { const progress = useAtomValue(appDownloadProgress); const activeModel = useAtomValue(currentProductAtom); const { version } = useGetAppVersion(); const { ram, cpu } = useGetSystemResources(); const modelDownloadStates = useAtomValue(modelDownloadStateAtom); const downloadStates: DownloadState[] = []; for (const [, value] of Object.entries(modelDownloadStates)) { downloadStates.push(value); } return (
{progress && progress >= 0 ? ( ) : null}
{downloadStates.length > 0 && ( )} {activeModel && ( )} v{version}
); }; export default MonitorBar;