import { useState } from 'react' import { Badge, Button, Tooltip, TooltipArrow, TooltipContent, TooltipTrigger, } from '@janhq/uikit' import { useAtom, useAtomValue, useSetAtom } from 'jotai' import { FaGithub, FaDiscord } from 'react-icons/fa' import DownloadingState from '@/containers/Layout/BottomBar/DownloadingState' import SystemItem from '@/containers/Layout/BottomBar/SystemItem' import CommandListDownloadedModel from '@/containers/Layout/TopBar/CommandListDownloadedModel' import ProgressBar from '@/containers/ProgressBar' import { appDownloadProgress } from '@/containers/Providers/Jotai' import { showSelectModelModalAtom } from '@/containers/Providers/KeyListener' import ShortCut from '@/containers/Shortcut' import { MainViewState } from '@/constants/screens' import { useActiveModel } from '@/hooks/useActiveModel' import { useDownloadState } from '@/hooks/useDownloadState' import { useGetDownloadedModels } from '@/hooks/useGetDownloadedModels' import useGetSystemResources from '@/hooks/useGetSystemResources' import { useMainViewState } from '@/hooks/useMainViewState' import { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom' const menuLinks = [ { name: 'Discord', icon: , link: 'https://discord.gg/FTk2MvZwJH', }, { name: 'Github', icon: , link: 'https://github.com/janhq/jan', }, ] const BottomBar = () => { const { activeModel, stateModel } = useActiveModel() const { ram, cpu } = useGetSystemResources() const progress = useAtomValue(appDownloadProgress) const { downloadedModels } = useGetDownloadedModels() const { setMainViewState } = useMainViewState() const { downloadStates } = useDownloadState() const setShowSelectModelModal = useSetAtom(showSelectModelModalAtom) const [serverEnabled] = useAtom(serverEnabledAtom) return (
{progress && progress > 0 ? ( ) : null}
{!serverEnabled && ( setShowSelectModelModal((show) => !show)} > My Models )} {stateModel.state === 'start' && stateModel.loading && ( )} {stateModel.state === 'stop' && stateModel.loading && ( )} {!stateModel.loading && downloadedModels.length !== 0 && activeModel?.id && ( )} {downloadedModels.length === 0 && !stateModel.loading && downloadStates.length === 0 && ( )}
{/* VERSION is defined by webpack, please see next.config.js */} Jan v{VERSION ?? ''}
{menuLinks .filter((link) => !!link) .map((link, i) => (
{link.icon} {link.name}
))}
) } export default BottomBar