Skip to content

Commit

Permalink
Merge pull request #500 from janhq/bug/status-bar-app-download
Browse files Browse the repository at this point in the history
bug: download new version should show in status bar
  • Loading branch information
urmauur authored Oct 30, 2023
2 parents 3f12b7d + ff68f03 commit 8b10aa2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/app/_components/ProgressBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {
}

const ProgressBar: React.FC<Props> = ({ used, total }) => (
<div className="flex items-center gap-2.5 p-[10px]">
<div className="flex items-center gap-2.5">
<div className="flex items-center gap-0.5 text-xs leading-[18px]">
<Image src={'icons/app_icon.svg'} width={18} height={18} alt="" />
Updating
Expand Down
24 changes: 22 additions & 2 deletions web/containers/BottomBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import { modelDownloadStateAtom } from '@helpers/atoms/DownloadState.atom'
import { formatDownloadPercentage } from '@utils/converter'
import { activeAssistantModelAtom, stateModel } from '@helpers/atoms/Model.atom'
import useGetAppVersion from '@hooks/useGetAppVersion'
import ProgressBar from '@/_components/ProgressBar'
import { appDownloadProgress } from '@helpers/JotaiWrapper'

const BottomBar = () => {
const activeModel = useAtomValue(activeAssistantModelAtom)
const stateModelStartStop = useAtomValue(stateModel)
const { ram, cpu } = useGetSystemResources()
const modelDownloadStates = useAtomValue(modelDownloadStateAtom)
const appVersion = useGetAppVersion()
const progress = useAtomValue(appDownloadProgress)

const downloadStates: DownloadState[] = []
for (const [, value] of Object.entries(modelDownloadStates)) {
Expand All @@ -21,7 +24,22 @@ const BottomBar = () => {

return (
<div className="fixed bottom-0 left-0 z-20 flex h-8 w-full items-center justify-between border-t border-border bg-background/50 px-4">
<div className="flex gap-x-2">
<div className="flex items-center gap-x-2">
<div className="flex items-center space-x-2">
{progress && progress >= 0 ? (
<ProgressBar total={100} used={progress} />
) : null}
{downloadStates.length > 0 && (
<SystemItem
name="Downloading"
value={`${downloadStates[0]
?.fileName}: ${formatDownloadPercentage(
downloadStates[0]?.percent
)}`}
/>
)}
</div>

{stateModelStartStop.state === 'start' &&
stateModelStartStop.loading && (
<SystemItem
Expand Down Expand Up @@ -51,7 +69,9 @@ const BottomBar = () => {
<div className="flex gap-x-2">
<SystemItem name="CPU:" value={`${cpu}%`} />
<SystemItem name="Mem:" value={`${ram}%`} />
<p className="text-xs font-semibold">Jan v{appVersion?.version ?? ''}</p>
<p className="text-xs font-semibold">
Jan v{appVersion?.version ?? ''}
</p>
</div>
</div>
)
Expand Down

0 comments on commit 8b10aa2

Please sign in to comment.